subcircuit2ssc
function to generate Simscape language component files from a SPICE netlist file. You can use the optional subcircuit1,…,subcircuitN
input arguments to specify which subcircuits to convert.unsupportedCommands
output argument to generate a struct
array that lists unsupported SPICE commands for each subcircuit. ssc_build
or add individual components to your model using Simscape Component blocks..FUNC
— Reusable function.PARAM
— Definable parameter.MODEL
— Set of reusable component parameters.SUBCKT
— Subcircuit.LIB
— Directive to include models from an external netlist.INC
— Directive to include contents of external netlist.FUNC
SPICE commands using Simscape functions. These functions are placed inside a package sublibrary named +subcircuit_name
_simscape_functions
, where subcircuit_name
is the name of the subcircuit being converted. .MODEL
syntax for resistors, capacitors, and inductors, asr
, c
, and l
values are scaling factors for the value specified on the component declaration. This behavior complies with PSpice, but is not consistent across all simulators..IC
statement. However, you can specify initial conditions for capacitors and inductors using the syntax IC=<value>
. Also, you can manually convert any .IC
statements from the generated Simscape component files..TRAN
, are ignored.Suffix | Name | Scale |
---|---|---|
T | Tera | 1e12 |
G | Giga | 1e9 |
MEG | Mega | 1e6 |
K | Kilo | 1e3 |
M | Milli | 1e-3 |
MIL | -- | 25.4e-6 |
U | Micro | 1e-6 |
N | Nano | 1e-9 |
P | Pico | 1e-12 |
F | Femto | 1e-15 |
Name | SPICE Function | MATLAB Function |
---|---|---|
Absolute value | abs | abs |
Smallest element | min | min |
Largest element | max | max |
Sign function | sgn | sign |
Name | SPICE Function | MATLAB Function |
---|---|---|
Sine | sin | sin |
Inverse sine | asin | asin |
Hyperbolic sine | sinh | sinh |
Cosine | cos | cos |
Inverse cosine | acos | acos |
Hyperbolic cosine | cosh | cosh |
Tangent | tan | tan |
Inverse tangent | atan | atan |
Four-quadrant inverse tangent | atan2 | atan2 |
Hyperbolic tangent | tanh | tanh |
Name | SPICE Function | MATLAB Function |
---|---|---|
Power | ** or pwr | ^ or power |
Exponential | exp | exp |
Natural logarithm | ln or log | log |
Base-10 logarithm | log10 | log10 |
Square root | sqrt | sqrt |
log()
as the natural logarithm rather than the base-10 logarithm. Not all SPICE simulators are consistent in this regard, so ensure that this interpretation is congruent with your SPICE model.Name | SPICE Function |
---|---|
If condition | if |
Saturation | limit |
Current through device | i |
Voltage across device | v |
Step function | stp |
+
at the start of a line indicates line continuation from the previous line*
at the start of a line indicates that the entire line is a comment;
within a line indicates the beginning of an inline comment<argument>
refers to a required item in a command line<argument>*
refers to a required item in a command line that occur one or more times[argument]
refers to an optional item in a command line[argument]*
refers to an optional item in a command line that occur zero or more times.MODEL
parameters that differ from SPICE default values.subcircuit2ssc
.ssc_build
| subcircuit2ssc
rcsubcircuit.cir
that contains a simple RC subcircuit.rcsubcircuit.cir
to equivalent Simscape files and place them in a package directory called mylibrary
.rc1.ssc
in the mylibrary
package to verify that no manual conversion is required.ssc_build
.mylibrary_lib.slx
to access the RC component as a Simscape block.temperatureresistor.cir
that contains a resistor with temperature dependence.temperatureresistor.cir
to equivalent Simscape files and place them in a package directory called mylibrary
.temperatureresistor.ssc
in the mylibrary
package to identify required manual conversions.TC
.components
section of the component file, replace the resistor with a SPICE resistor, which models temperature dependence:ssc_build
.mylibrary_lib.slx
to access the resistor with temperature dependence component as a Simscape block.