**Documentation Home Page** ◇ **HYPERSIM Home Page**

Pour la **documentation en FRANÇAIS**, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

# Load Flow | Configuration in User-Coded Model (UCM)

Once the load flow solution is found, the UCM initializes from this solution into an EMT simulation. The User Coded Model (UCM) is a HYPERSIM utility allowing users to create their own templates that can not otherwise be built using existing templates. UCM is coded by users, in C, according to HYPERSIM rules.

UCM allows you to build models of power and control components. The advantage of using the UCM is that the power portion is solved simultaneously with other power components of the network. The admittance of the UCM is added to the admittance of the whole network and all the node voltages are solved together in the same calculation step. This gives greater numerical stability than if the power UCM were represented as controlled sources involving a computation time. Because the power UCM is solved with other power elements, users must follow the same procedure as used in the HYPERSIM algorithm to resolve node voltages.

# Model Type for Power Flow Solution

To implement the power flow solution in the User Coded Model (UCM) of HYPERSIM, the UCM form was updated to take into account the model type (Admittance or Generation) in the Model description section of the form to indicate to HYPERSIM whether the UCM is participating or not in the power flow solution.

The added variable is UCM_LOADFLOW_TYPE and can have the following values:

| If not included in Section 1, the UCM does not participate in the power flow solution. |
---|---|

| Model UCM participates in power flow solution as being considered as a load. |

| Model UCM participates in the power flow solution as a generator. |

In case of selecting the Generation type for the load flow option, a new tab is introduced to the component's interface.

It is important to note that this tab becomes visible following the update of the UCM code. To perform the update, the user should right-click on the UCM, and in the UCM section, the Update option should be selected.

Figure 2 shows the code in Section 1 for the UCM Linear Impedance Model RL. Note that in this case the variable UCM_LOADFLOW_TYPE is equal to Admittance.

# Function of the Admittance Calculation (Section 8.3.3)

The Load Flow admittance calculation function allows the UCM to be considered by the power flow solution.

The figure below shows the code in Section 8.3.3 for the UCM Linear Impedance Model RL. Note that the actual (ucmYlfReal) and imaginary (ucmYlfImag) values of the UCM must be defined separately in the nodal admittance matrix.

# Function of Updating Historical Values (Section 8.3.4)

The Load Flow Historical Values Update Function allows the voltage history values and currents associated with the UCM model to initialize from the power flow solution.

The figure below shows the code in Section 8.3.4 for the UCM Linear Impedance Model RL. Note that the ucmVlfHist and ucmIlfHist variables correspond to the voltage and current histories respectively.

# Function of Model Parameter Update (Section 8.3.5)

The Load Flow Model Parameters Update Function allows the voltage and angle values for Generation-type UCMs to be updated with the initial values of the power flow solution.

The figure below shows the code in Section 8.3.5 for a UCM model of voltage source with internal impedance. Note that the variables ucmVintReal and ucmVintImag correspond to the initial values of internal voltage (voltage behind impedance) calculated from the power flow solution.

# Important considerations of using variables in load flow and initialization sections

Variables in the "Loadflow Historical Values" section should only be set based on those defined in "Historical Currents."

Variables in the "Loadflow Model parameters" section should only be set based on those defined in "Calculated Parameters."

The voltage refers to the peak voltage of the phase to ground in the variables

,**ucmVlfHist**,**ucmVlfActual**, and**ucmVintReal**.**ucmVintImag**Variables

and**ucmVlfHist**provide voltage of terminal component while variables**ucmVlfActual**and**ucmVintReal**provide voltage of voltage source within the component**ucmVintImag**The current refers to the peak current of the phase in the variables

and**ucmIlfHist**.**ucmIlfActual**The variable results of load flow, namely

,**ucmIlfHist**,**ucmIlfActual**,**ucmVlfHist**,**ucmVlfActual**, and**ucmVintReal**, are accessible after the function of the Admittance Calculation (Section 8.3.3).**ucmVintImag**

**Defined variables**

This section explains available variables to the users in the Preparatory sections. **These are for advanced users only.**

| retrieves the equivalent impedance of EMT method between nodes i and j. This variable is used for dynamic simulation. |
---|---|

| retrieves a one in case |

| returns the timeStep of simulation. |

| retrieves the real part of the equivalent impedance of the phasor method between nodes i and j. This variable is used for load flow calculation. |

| retrieves the imaginary part of the equivalent impedance of the phasor method between nodes i and j. This variable is used for load flow calculation. |

| returns current at one time-step before starting the simulation. |

| returns current at starting the simulation. |

| returns voltage at one time-step before starting the simulation. |

| returns voltage at starting the simulation. |

| returns the real part of an internal source in the phasor domain from load flow calculation. |

| returns the imaginary part of an internal source in the phasor domain from load flow calculation. |

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