hfss 3d layout py 脚本

本文介绍两个脚本:renameport用于将3Dlayout仿真的端口名格式化,便于后续操作;IL_RL_FEXT_NEXT打印脚本检查并整理输出格式。脚本适用于AnsoftElectronicsDesktop环境,提升设计后期处理效率。

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


脚本说明

1、这几个脚本只适用于3D layout 仿真组件
2、脚本作用是为了仿真完成后能快速打印出IL,RL,NEXT,FEXT的图形

1、rename port 脚本

这个脚本的作用是将软件自动生成的端口名[器件位号].[器件引脚].[网络名称]改成[网络名称]__[器件位号]_[器件引脚]
比如软件自动生成的端口U1.AC2.DDR2_A_DQ0 重命名为 DDR2_A_DQ0_U1_AC2

做这一步的目的是为后续的操作做准备

import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oProject = oDesktop.GetActiveProject()
active_project_name = oProject.GetName()
oDesign = oProject.GetActiveDesign()
active_design_name_str = oDesign.GetName()
active_design_name_list = active_design_name_str.split(";")
active_design_name = active_design_name_list[1]

oModule = oDesign.GetModule("Excitations")
all_port_list = oModule.GetAllPortList()

def delete_illegal_char(str_net,illegal_char)
	for char_x in illegal_char:
		str_net = str_net.replace(char_x ,"")
	return str_net

for port in all_port_list:
	list1 = port.split(".")
	if list1.__len__() == 3:
		comp_name = list1[0]
		pin_num = list1[1]
		net_name = list1[2]
		net_name = delete_illegal_char(net_name, "[]")
		port_rename = "{net_name}_{component}_{pin_number}".format(component= comp_name , net_name = net_name, pin_number = pin_num )
		oModule.Rename(port,port_rename)
		InfoMessage = "{old_name} rename to {new_name}".format(old_name = port , new_name = port_rename )
		oDesktop.AddMessage(active_project_name, active_design_name, 0, InfoMessage, "Port rename")
	else:
		InfoMessage = "{old_name} is not a Component.Pin.Netname format, the renaming has been ignored".format(old_name = port )
		oDesktop.AddMessage(active_project_name, active_design_name, 1, InfoMessage, "Port rename")

all_port_list_new = oModule.GetAllPortList()

diff_keyword_list = [
["TXP","TXN"],
["RXP","RXN"],
["T","C"],
["DQS","DQSB"]]

diff_keyword_position = -3

z_single = 50
z_diff = 100

		

2、IL_RL_FEXT_NEXT 打印脚本

*Global - Messages [warning] Left-alt + shift is currently used by the system to toggle the input language. It is also used in some portions of this application, which may cause the input language to change unexpectedly. [info] GRPC server running on port: 55885. [info] Project Via_Example has been created. [info] OpenGL Version: 4.6.0 - Build 32.0.101.6078 [info] Added design 'HFSSDesign' of type HFSS 3D Layout Design. [info] Aedt Objects correctly read [info] Loading Modeler. [info] Modeler loaded. [info] EDB loaded. [info] Layers loaded. [info] Primitives loaded. [info] Modeler class has been initialized! Elapsed time: 0m 0sec [info] Materials class has been initialized! Elapsed time: 0m 0sec [info] Parsing F:/ANSYS/Via_Example.aedt. [info] File F:/ANSYS/Via_Example.aedt correctly loaded. Elapsed time: 0m 0sec [info] aedt file load time 0.015329599380493164 [info] Linear step sweep sweep_frequency has been correctly created. [info] Key Desktop/ActiveDSOConfigurations/HFSS 3D Layout Design correctly changed. [info] Solving design setup frequency_sweep [info] Design setup frequency_sweep solved correctly in 0.0h 0.0m 57.0s [error] ************************************************************** [error] File "F:\HFSS_python\chafen2_2_1\chafen2_2_2.py", line 274, in <module> [error] parametric_setup = hfss.parametrics.add( [error] AEDT API Error on activate_variable_tuning [error] Method arguments: [error] name = m1 [error] ************************************************************** [info] Key Desktop/ActiveDSOConfigurations/HFSS 3D Layout Design correctly changed. [info] Solving Optimetrics [info] Key Desktop/ActiveDSOConfigurations/HFSS 3D Layout Design correctly changed. [error] Error in Solving or Missing Setup M1_Parametric_Sweep [info] PostProcessor class has been initialized! Elapsed time: 0m 0sec [info] Post class has been initialized! Elapsed time: 0m 0sec [info] Solution Data Correctly Loaded. [info] Solution Data Correctly Loaded. [info] Solution Data Correctly Loaded. [info] Solution Data Correctly Loaded. [error] 'FigureCanvasInterAgg' object has no attribute 'tostring_rgb' [error] File "F:\HFSS_python\chafen2_2_1\chafen2_2_2.py", line 394, in <module> [error] plt.show() [error] ~~~~~~~~^^ Via_Example (F:/ANSYS/) HFSSDesign [info] Mesh pre-processing took: 0.116 sec (cpu: 0.109) (12:47:41 下午 8月 16, 2025) [info] An interpolating frequency sweep with 81 points has been started using HFSS - Solving Distributed. (12:48:23 下午 8月 16, 2025) [info] Interpolating frequency sweep complete. Converged. (12:48:34 下午 8月 16, 2025) [error] Script macro error: m1 is not a child name of Variables. (12:48:36 下午 8月 16, 2025) [error] Script macro error: Property 'm1' does not exist. (12:48:36 下午 8月 16, 2025) [warning] The variable 'Phase' doesn't have an associated sweep and is excluded from the definition of trace. (12:48:37 下午 8月 16, 2025) [warning] The variable 'Phase' doesn't have an associated sweep and is excluded from the definition of trace. (12:48:37 下午 8月 16, 2025) [warning] The variable 'Phase' doesn't have an associated sweep and is excluded from the definition of trace. (12:48:37 下午 8月 16, 2025) [warning] The variable 'Phase' doesn't have an associated sweep and is excluded from the definition of trace. (12:48:38 下午 8月 16, 2025) 这个hfss报错的原因
08-17
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值