Sei sulla pagina 1di 3

Sections of a CBuilder Models .

c File
STATIC:
This section should only be used to declare variables. Anything declared in this section may be used in
both the RAM_PASS1, RAM_PASS2 and CODE sections. Variables defined here will retain their value
from one time-step to the next.
RAM_FUNCTIONS:
Any user-defined functions to be called in either the RAM_PASS1 or RAM_PASS2 sections should be
defined here.
RAM: (alternately RAM_PASS2:)
Code placed here is executed once on the workstation running RSCAD when a DRAFT case is compiled.
The code here can be more complex and will never be subject to the constraint of real-time
performance. Constants required for the CODE section can be calculated and stored here. Time
consuming and complex algorithms such as those for curve fitting can be implemented here. Only the
results can be reference in the CODE section.
RAM_PASS1:
RAM_PASS1 like RAM_PASS2 is executed when a DRAFT case is compiled. It is very similar to the RAM
section except that in the series of steps involved in compiling a case, RAM_PASS1 is executed before
the RAM (RAM_PASS2) section. Certain function calls/variable assignments must be placed in the
RAM_PASS1 section. The definition of the overlay matrices g_mat_nods[] and g_mat_over[][], for
instance, must be done in the RAM_PASS1 section.
CODE_FUNCTIONS:
Any user-defined functions to be called in the CODE section should be defined here.
CODE:
All code placed in this section is executed on the RTDS Simulation hardware. The code is execute once
every time-step. Because of the imposed real-time constraint this code must be fairly efficient and
cannot take an excessive amount of time to complete. Code which requires too long to complete can
trigger a time-step overflow error and halt the simulation.
For a power system component, a time-step is broken up into several parts. Within every time-step
there are three (3) computation intervals and three (3) communication intervals. During the
computation intervals the required calculations for the model are made and during the communication
intervals, information is sent from one processor to another or to the shared backplane memory.
The figure below shows the different computation and communication intervals that would be involved
in a simple simulation containing a source, a simple transformer and the network solution. The figure is
simplified in many ways but is meant to illustrate how information is passed between different
processors and models. Each interval is described below the diagram.

1) Computation Interval 1: For any given Power System Component, all computations needed to
produce the current injections and conductance contributions to the network solution (if any)
should be completed in this computation interval. Usually the voltage vector resulting from the
Network Solution at the previous time-step is used to produce the current injections. For
efficiency reasons, code not associated with the calculation of current injections and
conductance values should be excluded from this computation interval. Any code found
immediately below the BEGIN_TO: label will be part of Computation Interval 1.
2) Communication Interval T0: The calculated current injections and conductance contributions (if
any) from Computation Interval 1 are passed to the processor that will be completing the
network solution computations.
3) Computation Interval 2: During this computation interval the Network Solution solves the
circuit using the current injections and conductance values it received and produces a voltage
vector of all the node voltages. While this is happening, the different power system
components can complete any calculations that were not needed to find the current injections
and/or conductance values. Calculations associated with any signals being monitored are
suitable for this computation interval. Any code found immediately below the T0_T1: label will
be part of Computation Interval 2.
2

4) Communication Interval T1: The voltage vector produced by the Network Solution is made
available to the component processors.
5) Computation Interval 3: The updated voltages from the Network Solution are available for
further computations if needed. Theses voltages are needed, for instance, if the calculation of
the current flowing through a component at the current time-step is desired. Any code found
immediately below the T1_T2: label will be part of Computation Interval 3.
6) Communication Interval T2: All other monitored signals are communicated during this
communication interval. The voltage vector calculated by the network solution is again made
available for use in the next time-step.
*** If a component does not make use of Communication Interval T1 then the label T0_T2: can be used
instead of T0_T1: and T1_T2:.

Potrebbero piacerti anche