Spice Netlist to Simscape Conversion Issue - LIB directive
이전 댓글 표시
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
Sangeeta
2022년 10월 19일
Hi Nazim,
Is your problem solved as I am too getting the same error as you mentioned.?
If its solved can you kindly lwt me know how did you solve it.
Thanks in advance,
Sangeeta
David John
2022년 11월 21일
Can you please attach the lib file that you're trying to use?
NAZIM YILDIZ
2022년 11월 21일
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?
채택된 답변
추가 답변 (1개)
David John
2022년 11월 21일
편집: David John
2022년 11월 21일
1 개 추천
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.
댓글 수: 1
NAZIM YILDIZ
2022년 11월 21일
편집: NAZIM YILDIZ
2022년 11월 21일
카테고리
도움말 센터 및 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!