The circuit shows the capability of ARTEMiS-SSN to interface with the user's custom nodal code with a Simulink S-function builder block and to make the execution of this code in a different core than the main SSN solver.
This model is very similar to the demo Custom user's nodal code interface with SSN using SSN External group feature; both demos use the SSN Custom User Code and SSN External Group to simulate a part of the circuit (source +RL).
Refer to the other demos for explanations on SSN Custom User Code methodology.
This model is a 6-pulse HVDC system, similar to the SSN small HVDC network with ITVC demo, copied in 3 different RT-LAB subsystems.
- In the SS_regular_SSN, the normal SSN method is used to model a 6-pulse HVDC system.
- In the SM_SSN_ExternalSSN_Group top-level subsystem, the 3-phase inductive source is replaced by an SSN external block interface.
- In the SS_rl_src_group, the 3-phase source and R-L impedance are coded using the S-function builder block of Simulink.
Now, what is particular in this demo is that the External SSN group code is executed in a different RT-LAB subsystem BUT in series with the main nodal solver located in the SM_SSN_ExternalSSN_Group.
The reason for this is that there is only one delay in the loop going between the two RT-LAB subsystems SS_rl_src_group and SM_SSN_ExternalSSN_Group and therefore they can only be computed sequentially.
Does this accelerate the simulation?
No, not for this model. But if a model has many External SSN Groups, each located in different RT-LAB subsystems, then some speed gains would be expected because all the groups would be computed at the same time, parallel to the main SSN solver.
In offline mode, however, all computations are ultimately made in series on a single-core, whatever the arrangements.
Because the SSN algorithm allows some parallelization for the group's calculations, it's possible to take advantage of this to accelerate the simulation in multi-core RT-LAB targets. A good application of this feature is in MMC-HVDC system where all MMC arms can be computed in parallel.
Figure 1: SSN algorithm
The S-function builder block is located inside the SS_rl_src_group subsystem. If you Look Under Mask, you will see the S-function builder block.
There are two similar copies of the external SSN block: one contains the SSN interface with SPS blocks and the other contains the S-function builder and code only.
About standard SSN parallelization in RT-LAB
SSN allows the parallelization of group calculation as a standard feature, without explicitly separating the SSN groups into different SS_ subsystems.
This parallelization can be done for regular SSN groups within RT-LAB in the Assign targets to subsystems menu, selecting Advanced and adding core in the Cores column of the SM_ or SS_ containing an SSN system.
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)
Note 3: in RT-LAB, you will need to disable the serial execution checking routines by setting:
- in the 'RT-LAB'->'Simulation Tools'->'Matlab command before opening model' of RT-LAB.