Spice Netlist to Simscape Conversion Issue - LIB directive
11 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I'm using LTspice to design power electronics topology or circuits for a while, and to control it I'm tring to use Simulink. So far I've done some simple simulations with using these two subcircuit2ssc('ABC.cir','+ABC') and ssc_build commands. However, I've been facing an issue with usage of .LIB directive.
The circuit below is what I'm trying to map into simulink. The FETs models are inside a separate .lib file.
Netlist for this diagram is as below:
.SUBCKT HALFBRIDGE VPP VPN G_H S_H G_L S_L
L1 VPP N004 {L} Rser=100m
E1 N006 N008 G_L S_L 1
R1 N007 N006 10
*V1 VPP VPN 430
E2 N001 N003 G_H S_H 1
R2 N002 N001 10
*Vgs1 G_H S_H PULSE(0 5 0 10n 10n {(1-D)/fs + DT} {1/fs})
*Vgs2 G_L S_L PULSE(0 5 0 10n 10n {D/fs - DT} {1/fs})
XU1 N002 VPP N004 N003 GS-065-008-1-L_L1V4P1
XU2 N007 N004 0 N008 GS-065-008-1-L_L1V4P1
R3 G_H S_H 1k
R4 G_L S_L 1k
C1 VPP N005 {C}
R5 N005 VPN 10m
.param fs = 100k
.param D = 0.2
.param DT = 100n
*.tran 100u
.param L = 10u
.param C = 10u
.lib GanSystem_Fets.lib
.ENDS
The library file(GanSystem_Fets.lib) is also in the same directory with the netlist file.
When I run subcircuit2ssc('GanFet_Test_Matlab.cir','+HalfBridge') spice to simscape converter function, I'm getting below error output:
Error using spiceSubckt.cleanNetlistStringArray
Line continuation is not in expected format.
Error in spiceSubckt/handleLibIncFiles
Error in spiceSubckt/loadSubckt
Error in spiceSubckt
Error in subcircuit2ssc
Error in subcircuit2ssc (line 31)
subcircuit2ssc(netlist,target);
From this document what my understanding is subcircuit2ssc() function should be able to handle .LIB directives. Without copying and then pasting the .LIB content in to the netlist file, are there any way to make .LIB files visible to subcircuit2ssc function/module?
Thanks in advance,
Nazım
4 个评论
Uruj
2023-5-2
Hello,
How come dnlim is throwing up an error as an unrecognised function for me? Should I include some perticular addons?
采纳的回答
David John
2022-11-21
On lines 25 and 111 of the lib file, you have stray newlines in the middle of a continued line. Please try removing those two blank lines.
更多回答(1 个)
David John
2022-11-21
编辑:David John
2022-11-21
The .subckt definition is not quite right for XU1 and XU2. There are some dashes missing from the subcircuit names in order to look like in your lib file. It looks like we should improve the error message for this to make it more clear.
Note that this answer is referring to your followup question.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Choose and Parameterize Blocks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!