The circuit shows the capability of ARTEMiS-SSN to interface with user's custom nodal code with a Simulink S-function builder block.
This model is a 6-pulse HVDC system, similar to the 'SSN small HVDC network with ITVC' demo, copied in 2 different RT-LAB subsystems.
In the 'SM_SSN_ExternalSSN_Group' top-level subsystem, the 3-phase inductive source is coded as an SSN external block using the S-function builder block of Simulink. In the SS_ subsystem, the normal SSN method is used for comparison purposes.
The block below contains the SSN Custom User Code for the Source+RL elements. If you Look Under Mask, you will see the S-function builder block.
Figure 1: SSN external block with online modifiable parameter inputs
Figure 2: S-function builder block with SSN interface
This function codes the 3-phase inductive source using a classic nodal method (like in the old EMTP) and allows direct on-line modification of the source voltage, resistance, inductance, and frequency.
Nodal method for SSN (1 phase of the RL source)
The block iterations are made starting from the nodal voltage solution of the main SSN solver.
The nodal admittance algorithm steps for the RL source are then in the following order:
- Step 1: Completion of group state, the inductance current: iL=-I-vnode/Rtot (From last I and vnode)
- Step 2: Update of inductance historty source : iHL=iL(t-h)+vL(t-h)=2*iL(t-h)-iHL(t-h)
- Step 3: Compute new injection for the group: I=-(vs+iHL*RL)/Rtot (minus sign because of SSN convention)
The code of this S-function is written with the classic EMTP methodology with the following interface considerations:
- The group total nodal injection must be made as going out of the node (instead of going into the node in EMTP). This is a convention for the SSN solver.
- Phases a, b, c correspond to    indexes in 'C' code.
Model notes for off-line simulation and RT-LAB compilation
Note 1: IMPORTANT: even for off-line simulation, you have to build the S-function. The SSN Custom User Coded block contains a button in the dialog box to do this conveniently.
Note 2: The S-function builder block requires to add the following files for download to target during RT-LAB compilation:
- $MATLAB/R2011b/toolbox/physmod/powersys/powersys/sfun_discreteVariableDelay.c (in R2011B+ versions)