The circuit is a simple example of ARTEMiS-SSN user's custom nodal code with a Simulink S-function builder block. The case of a simple inductance is studied here.
This model implements an RLC circuit in two ways: one with standard SSN and the other with the inductance coded using Dommel method directly in "C" code.
The inductance discrete equations can be viewed in the S-function of the model.
Because the SSN group computation starts with the last nodal voltage solution coming from the main SSN solver, the inductance model does the following operations at each time step in this order:
- update the inductance state (the current) from the last nodal voltage solution and previous history source.
- compute new history source and admittance
- put these history sources and admittance at the output of the S-function, to be read-back at the next time step. (because the author does not know how to keep values inside the S-function from one time step to the next)
This S-function builder block is located inside the SSN block of inductance. If you 'Look Under Mask', you will see the S-function builder block.
Inside the S-function Builder bloc, you can study the SSN code used to implement this feature.
Model notes for off-line simulation and RT-LAB compilation
Note 1: IMPORTANT! Even for off-line simulation, users have to create the S-function code by pressing the 'Build' button of the S-function builder block. The dialog of the SSN Custom Coded inductance block also contains a button to start this compilation easily.
The S-function builder block requires to add the generated files for downloading to the target during RT-LAB compilation.