Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.

Ansys Learning Forum Forums Discuss Simulation Photonics – Chinese 对于如何使用script element的脚本编辑问题 Reply To: 对于如何使用script element的脚本编辑问题

Chih-Hao Chen
Ansys Employee

您好

我有幾個疑問。看您的腳本中,如果signalIn3有大於零的值(drop),腳本是直接用等於2的index減掉二,若以[1,0.5,2,3]為例,相當於變成index 1。這好像和您描述的行為不一致。(到drop有输入时,y的索引值会向上增加一个,即y变为3)

同理,如果drop和through都沒有值,腳本是用2的index減掉3,若以[1,0.5,2,3]為例,相當於要找索引值為-1,我覺得有點奇怪。

然後,腳本中是以有沒有大於0去判斷有沒有值,我們能確保通過物件的值都是大於零嗎?有沒有負數甚至是複數的可能呢?

我會建議您先用簡單的腳本出發,先個別測試情況是否符合預期,最後再組合起來。

 

 

[bingo_chatbox]