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.

UCM: Progressive Practices with UCM

Progressive Practices with UCM

Resistor Description

Build a UCM to represent a three-phase resistor connected in Y, the neutral is grounded. The parameters for the UCM are the vector R[3] of 3 values of resistance. The resistors are connected to the external node T. Calculate the current in each phase and send them to control outputs Ia, Ib, Ic, which are grouped together and sent to connector I.

Codes

%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN GENERAL INFORMATION -- Enter or modify general information
UCM_NAME = Resistor
UCM_TYPE = NetworkElement
UCM_CATEGORY = User
UCM_VERSION = "1.0"
UCM_EXEC_TIME = 5.0e-6
UCM_DESCRIPTION = "Resistor 3 phase-ground" # Description du modele
%% END GENERAL INFORMATION
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN DOCUMENTATION -- Enter model’s documentation after this line...
Documentation de Exemple.
---------------------
Three-phase resistor connected in Y grounded
%% END DOCUMENTATION
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN TUNABLE PARAMETERS -- Enter parameters table after this line...
R "R" - double 3 [1.0 1.0 1.0] 0.0 1.0e12 - "R"
%% END TUNABLE PARAMETERS
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN CONTROL IOS -- Enter control IOs table after this line...
Ia A double out auto I "Ia"
Ib A double out auto I "Ib"
Ic A double out auto I "Ic"
%% END CONTROL IOS
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN NODES DEFINITIONS -- Enter nodes table after this line...
T 3 extern bottom no "Network Connection"
%% END NODES DEFINITIONS
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN CALCULATED PARAMETERS -- Enter parameters table after this line...
G - double 3 "Equiv.conductance"
%% END CALCULATED PARAMETERS
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN PREPARATORY GLOBAL CODE -- Enter code under the appropriate comment...
/* 8.3.1.1 -- User includes */
#include <stdio.h>
%% END PREPARATORY GLOBAL CODE
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN PREPARATION FUNCTION CODE -- Enter code after this line...
int i, j;
G[0] = 1.0 / R[0];
G[1] = 1.0 / R[1];
G[2] = 1.0 / R[2];
/* Initialization of Yini and Yfill */
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
ucmYini(i,j) = 0.0;
ucmYfill(i,j) = 0;
}
}
/* Calculate Yini and define Yfill */
ucmYini(T_a, T_a) = 1.0 * G[0];
ucmYini(T_b, T_b) = 1.0 * G[1];
ucmYini(T_c, T_c) = 1.0 * G[2];
ucmYfill(T_a, T_a) = 1;
ucmYfill(T_b, T_b) = 1;
ucmYfill(T_c, T_c) = 1;
%% END PREPARATION FUNCTION CODE
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%%vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
%% BEGIN AFTER VOLTAGE CALCULATION -- Enter code ->...
/* Calculate Resistor current and send them to control outputs */
Ia = ucmVNode(T_a) * G[0];
Ib = ucmVNode(T_b) * G[1];
Ic = ucmVNode(T_c) * G[2];
%% END AFTER VOLTAGE CALCULATION CODE
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



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