Documentation Home Page ◇ ARTEMiS Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.
Tips and Tricks Workarounds with SSN
- Sylvain Ménard
SSN is built on top of SimPowerSystems, which is closed, proprietary code--some SSN limitations are explained here. Other limitations come from the fact that SSN is a nodal method.
On the SSN solver pane, many solvers are available. One specific solver may work better than others without clear reasons. (The same is true of Simulink solvers.). See References for more.
Trapezoidal is the same as EMTP but without Backward Euler steps at switch change. Beware of numerical oscillation.
Backward Euler: Backward Euler is probably the most stable solver of all, actually an L-stable one. The Backward Euler method is however known to excessively damp some components of the simulation.
art5 is the order 5 L-stable Padé approximant to the matrix exponential. In this solver, the input term is considered to vary linearly between time steps.
art5 with Backward Euler nodal interface: this is the same as art5 for the discrete A matrix. But the discrete B matrix is different because the input term is considered fully implicit (u[n+1] only, no u[n] term) during integration. This solution is often more numerically stable than art5.
art5 with balanced zero hold nodal interface: this is the same as art5 for the discrete A matrix. But in this case, the input term is taking 2 values during integration (half the step at u[n] and the next half v[n+1]).
The art5 variations are provided in case the art5 method does not work well.
Use realistic Ron breaker resistance of 1e-4 Ohms, not 1e-12. Extreme values may make the nodal admittance matrix badly conditioned.
Also, avoid unrealistically high transformer core values. It is much better to set transformer core values Lm Rm=inf to extremely high values. Setting Lm=inf will make the SPS solver reduce and eliminate a dependent variable, which is better than creating a super-slow or fast mode with a very high value of Lm.
When using current measurements, SPS may try to take this measurement in a branch located in a different SSN group. The current implementation of SPS current measurement blocks looks for branches on the + side of the sensor.
When this happens, a clear error message appears and explains to you that you must invert the current measurement ports and add a Simulink gain of -1 to the output of the block, giving the same value of current reading.
X-type: it’s only used for custom SSN groups and frequency dependant line models (see References).
V-type and I-type must be chosen to avoid the illegal connection of the current source and voltage source in the determination of state-space equations. This is because of the underlying state-space formulation used to determine SSN groups equations.
V-type NIB, which contains a virtual voltage source, is better when connected to inductive inputs of SSN groups and I-Type NIB, which contains a virtual current source, and is better when connected to a capacitive input of groups, like a shunt capacitor. In many cases, both V-type and I-type can be used if they do not trigger SPS connectivity errors. This is the case on a purely resistive group for example.
The reason is that in the current implementations of SPS, the presence of SPS Multimeter blocks forces the merging of all the circuits in the diagram even if they are independent. SSN cannot currently work with this situation.
When compiling an ARTEMiS model, lack of memory may occur, especially when the size of the SSN group matrices ABDC are big and the number of switches is high.
ARTEMiS tried to calculate all matrix permutation in all SSN groups of the electrical network. For example, for a very small network (only 10 states, 12 inputs and 11 outputs), the state-space matrices would be like:
x' = Ax+Bu (A is [10x10], B is [10x12], x is [10x1], x' is [10x1], u is [12,1])
Y = Cx+Du (C is [11x10], D is [11x12])
And the number of switches is 15, the size of memory required is:
( (10*10 + 10 + 10*12 + 12 + 10) + (11*10 + 10 + 11*12 + 12 + 11) ) * 2^15 * 8 = 138MB
Now the same calculation for a network with 40 states, 40 inputs and 40 outputs is 1.76GB.
In SSN, the number of switch per SSN group is limited to 15 but should ideally be less than 10. It is ALWAYS POSSIBLE in SSN to limit the number of switch per group to a certain number, just by putting switches in different groups. The MATLAB prompt gives an indication of the memory used by the SSN matrices, including the nodal admittance matrix. As a general guideline, this memory usage should be kept low whenever possible. Value under 100 Mb is generally ok on Xeon V2 or V3 computers.
.....
Y has 318 zeros out of 676 elements
ARTEMiS-SSN: approx. memory required: 71.4192 Mb (including nodal matrix)
SSN group info
Group 1 : 10 states, 24 inputs, 24 outputs, 12 switches.
Group 2 : 14 states, 21 inputs, 24 outputs, 9 switches.
Group 3 : 3 states, 9 inputs, 10 outputs, 6 switches.
Group 4 : 0 states, 18 inputs, 20 outputs, 10 switches.
Group 5 : 0 states, 15 inputs, 15 outputs, 6 switches.
Group 6 : 12 states, 28 inputs, 28 outputs, 10 switches.
SSN nodal matrix is of rank 26 (47.0414 % of zeros)
ARTEMiS network information: the network contains 127 general EMTP equivalent nodes (RLC branches, sources, etc..)
The I-Type NIB block contains a virtual current source, which is there for SSN to determine SSN groups. This source is visible by SPS and it sometimes creates connectivity error by which this current source is put in series with another current source or an inductor. (Physically, current sources are not supposed to be connected in series with inductors, it’s like trying to force a system state to a known value)
In ARTEMiS v7, I-type NIB comes with a shunt resistor of high value (default 1e9 Ohms), that do not interfere with the simulation accuracy and avoid this connectivity error. Note that this I-type shunt resistor may prevent the user to see limit problematic cases. Multi-I-Type groups without ground reference may no have a correct state-space equation but the shunt I-type resistor will permit it, with possibly adverse numerical effect. The previous version of the bipolar HVDC link with switched filters had such an all I-type group (upper 6-pulse valves) that was quite sensible numerically (even unstable with the LDLT solver). It’s now fine with V-type interfaces.
During model preparation and SSN group separation, the following criteria should be looked for:
- minimize the number of SSN nodes (because matrix factorization is O(n^3), where n is the number of nodes);
- while also maximizing the number of groups (because groups divide the states of the system); 2 groups of n/2 states (2*n^2/4=n^2/2 mult-add of A matrix) is faster to compute than 1 group of n state (n^2 mult-add);
- while also always keeping the number of switch/breakers <=9 optimally in each group (12 is ok sometimes), because pre-calculation is made within the SSN groups.
When looking at an electric network to be simulated with SSN, two main criteria should be followed:
Points 1- and 2- also mean: the higher SSN group number/number of SSN nodes ratio the better.
For example, choosing an SSN node at the feeder point of star-connected distribution grid (Figure 37) will create 5 SSN groups while using a single (3-phase)SSN node. After this, the grey points are the next best locations of SSN nodes because they split each existing SSN group into 2.
The switched filter bank node of the bipolar HVDC example is another good example of an excellent SSN node location because it creates many SSN groups with a single SSN node.
- Try to correctly balance the size of the SSN group.
This is better when using the parallel SSN option in real-time. To help localize a specific SSN group, one can attach an ’SSN Group tag’ to different groups in the model, like shown in Fig.38. The MATLAB prompt listing will then refer to the different tag used:
ARTEMiS-SSN: approx. memory required: 0.59939 Mb (including nodal matrix)
SSN group info
Group 1: 3 states, 7 inputs, 8 outputs, 2 switches.
Group 2: 21 states, 9 inputs, 6 outputs, 3 switches. TAG: capa
Group 3: 12 states, 16 inputs, 18 outputs, 6 switches. TAG: xfo
Group 4: 6 states, 7 inputs, 4 outputs, 1 switches. TAG: rect
SSN nodal matrix is of rank 4 (0 % of zeros)
ARTEMiS network information: the network contains 43 general EMTP equivalent nodes (RLC branches, sources....).
- Try to optimize nodal admittance factorization and state-space calculation costs.
Since version 7.2, with the advent of LDLT factorization, the computing costs of nodal admittance factorization and state-space parts are displayed. For the demo ssn_power_hvdc_itvc, the following values are obtained:
ARTEMIS-SSN: LDLT factorization/repeat solution operation count: 18
ARTEMIS-SSN: State-space operation count: 2334
The model could be optimized by trying to divide existing state-space groups into small ones (this should decrease the number of state-space operation) while not increasing too much the node count because matrix factorization operation count is an O(R3) when R is the node count.
Lets’ say that one wishes to optimize this model for real-time performance by 1) removing the node at the DC terminal and 2) merging the source and switch filter groups.
ARTEMIS-SSN: LDLT factorization/repeat solution operation count: 9
ARTEMIS-SSN: State-space operation count: 3247
We observe that the removal of the DC node has decreased the LDLT factorization (good) but merging the 2 groups has created a bigger group with a total of 50% more mult/add operation approximately (bad).
The nature of the SSN solver makes it prone to misusage. NIB placement, NIB type and parameters can greatly influence the numerical precision. As an example, take the model on the figure below:
It can only be simulated in SSN with a hybrid V-type and I-type interface on the group on the right with L and C. Putting 2 V-type NIB would induce a voltage loop with the V-type virtual voltage source and the capacitor C. Putting both I-type NIB would create a conflict with the 2 inductances L and L1 (with I_type shunt resistance =inf). In the latter case, one could use a non-infinite I-type R_shunt but we see here that we are close to a numerical issue.
SSN is not a Fully Iterative Solver
Some imprecision of SSN may come from the fact that it is not a fully iterative solver unless you use the iSwitch and iMOV methods. By comparison, SPS is fully iterative.
Some SSN groups can lead the model close to numerical instability and it is quite difficult to predict. Many numerical issues of SSN are linked to floating groups (groups without ground reference), typically when all ports of an SSN group are I-type. Rcond() is the reverse conditioning number for matrix inversion in MATLAB and can be used to detect these problems. By setting the variable USE_MFILE_SSN_SFUNCTION=1 in the workspace, one can view the worst rcond indicator of each group of this numerical problem.
The bipolar HVDC SSN demo exhibits this problem when the <upper> valve group of either rectifiers or inverters is all connected with I-type NIB. The lower valve group has a ground connection and do not have this problem.
With USE_MFILE_SSN_SFUNCTION=1, this model listing shows up like this:
SSN group info
Group 1: 5 states, 9 inputs, 15 outputs, 0 switches. TAG: rect
Group 2: 5 states, 9 inputs, 15 outputs, 0 switches.
Group 3: 21 states, 6 inputs, 3 outputs, 0 switches.
Group 4: 6 states, 6 inputs, 3 outputs, 0 switches.
Group 5: 1 states, 3 inputs, 6 outputs, 1 switch.
Group 6: 1 states, 3 inputs, 6 outputs, 1 switch.
Group 7 : 6 states, 22 inputs, 11 outputs, 6 switches. (WARNING: low Y rcond= 8.3326e-013 )
Group 8 : 6 states, 20 inputs, 10 outputs, 6 switches. (Y rcond= 5.5556e-008 )
Group 9 : 6 states, 20 inputs, 10 outputs, 6 switches. (Y rcond= 5.5556e-008 )
Group 10 : 6 states, 22 inputs, 11 outputs, 6 switches. (WARNING: low Y rcond= 8.3326e-013 )
Group 11 : 21 states, 9 inputs, 6 outputs, 3 switches. (Y rcond= 5.8525e-005 )
Group 12 : 21 states, 9 inputs, 6 outputs, 3 switches. (Y rcond= 5.8525e-005 )
Group 13 : 21 states, 9 inputs, 6 outputs, 3 switches. (Y rcond= 5.8525e-005 )
Group 14 : 21 states, 9 inputs, 6 outputs, 3 switches. (Y rcond= 5.8525e-005 )
Group 15 : 21 states, 9 inputs, 6 outputs, 3 switches. (Y rcond= 5.8525e-005 )
Group 16 : 21 states, 9 inputs, 6 outputs, 3 switches. (Y rcond= 5.8525e-005 )
SSN nodal matrix is of rank 19 (45.4294 % of zeros) (0 prefactorized col/rows)
The WARNING lines leads to the upper valves groups. Using the LDLT solver on this demo actually leads to instabilities. The LDLT solver assumes symmetric admittance matrices. Badly conditioned SSN group matrices often lead to very small asymmetry in the group nodal matrix during inversion and then in the global admittance matrix. By contrast, the LU factorization will deal correctly with small numerical asymmetry of the nodal admittance matrix.
In the demo, changing one I-type port to V-type solves the issue: the WARNING disappears and the simulation is stable with LDLT factorization (LDLT is twice as fast as LU for factorization of large matrices, that’s why we want to use it).
OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter