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.

Making SSN User Custom Blocks UCB

User Custom Blocks (UCBs) in SSN are used to simulate an electric subsystem or element inside the SSN solver. They are functionally equivalent to other SSN groups, but are entirely built by the user as opposed to standard SSN groups built automatically from the Simscape Electrical Specialized Power Systems (SPS) elements.

SSN-UCBs produce what is sometimes called a Discrete Companion Model (DCM), in Norton form, composed of a discrete resistance matrix Ye and a current history vector Ih. Ye and Ih are computed from past nodal voltage solutions and are used to compute the next step voltage solution of the main SSN solver.

The DCM can be computed using a Simulink S-function, with an S-function builder block, or with standard Simulink blocks. The latter method is often preferred because it’s simpler to use. The Simulink block method is used for most of the existing UCB models like SSN Rotating Machine models or OLTC.

Making Your Own SSN-UCB

  1. Determine the number of electric terminal or phase (nbp) of your UCB

  2. Select the proper UCB template corresponding to nbp in ARTEMiS/SSN/UCB Templates

  3. Code your UCB

  4. Use the UCB

UCB Template Constituents

The UCB templates are designed to simplify UCB design and have some built-in features that should not be modified by users.

Mask Types & Parameters


Mask Types & Parameters


Main mask type

The UCB is recognized by the SSN solver by its Simulink Mask Type: Norton-Type External Nodal Subsystem

Mask parameter Number of Electric nodes and associated variable nnode

Indicates the number of electric nodes. They should not be modified.

Mask parameter Unique Tag Identifier (automatic)

Used to obtain a unique tag name for use inside the block. Some callbacks inside the block initialization are also used with this mask parameter and should not be altered.

Inside the UCB, some blocks must not be altered:

Simulink From blocks named FromV

Used to read the nodal solution of SSN

Simulink Goto blocks GotoY and GotoHist

Used to send the UCB Yc and Ih to the SSN solver.

Simulink subsystem Xinterface

Used to identify the nodes of the UCB and match them with the internal nodes of other blocks used in SSN. From the mathematical point of view, the phase letters ’a’, ’b’, ’c’, etc... on the Xinterface block correspond to the UCB row/column of the Yc and Ih matrix and vector. You can rename the Pm-ports that go outside the UCB as you'd like.

UCB Coding

SSN-UCB are usually coded in accordance with SSN methods. UCB code usually has the following steps:

  1. Identify the continuous-time domain differential equation.

  2. Discretization by an implicit method such as Trapezoidal or Backward Euler. The former is more precise while the latter is more immune to numerical instabilities. Discretization can be changed during simulation if desired.

  3. Form the SSN DCM from the discretized equation.

SSN-UCB Based on S-Functions

SSN-UCB can be coded using S-functions instead of Simulink blocks. S-function based UCB can be preferred in case of very complex models like MMC that require many ’for’ loops, something that is more convenient to code in ’C’ language[3]. A complex rotating machine can still be coded using the techniques described in this chapter, using only Simulink blocks [4].

A good example of S-function based UCB is artemis/SSN/SSN OLTC/SSN OLTC xfo, with its Simulink-only counterpart artemis/SSN/SSN OLTC/SSN OLTC xfo v2 by its side.


OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323