Configuration Manual
This manual describes configuration options for CDP Simulator. See Getting Started for creating a Simulator project.
SimulatorManager
Most simulation options are configured within SimulatorManager component which is included by default in every simulator application. These options affect all DynamicSimComponents in the same application.
Integration
Sets the algorithm used to evaluate differential equations. If Integration table is left empty, RungeKutta4 algorithm is used.
It is possible to implement a custom algorithm by inheriting CDPSim::IntegrationBase but the following are provided with CDPSim:
Properties
Property | Description |
---|---|
fs | Sets the processing frequency for DynamicSimComponents in this applications. This is used to run component state machine and sync routed signal and property values. Therefore it should be at least as high as the highest fs of other components which route values to/from DynamicSimComponents. |
TimeStep | Sets how frequently EvaluateDiffEquations() is executed. A high degree of accuracy is obtained by running the simulations at very small time steps, much smaller than the periodic processes of standard CDP components set by fs property. If the selected integration algorithm (for example RungeKutta4) uses adaptive time step, then this value will set the minimum time step. |
Autostart | If false , simulation is started once Start message is received. Otherwise simulation will start automatically. |
Note: When the component processing period (1 / fs) is not an exact multiple of TimeStep or if the selected integration algorithm (for example RungeKutta4) uses adaptive time step, then there can be slight inaccuracies in the values published by simulator. This is similar to real world control systems if CDP IOServer fs does not exactly match the actual sensor sampling frequency.
Alarms
Alarm | Description |
---|---|
NotRealTime | Set when simulator is not able to run simulation components in real-time. Increase TimeStep and restart the simulation. |
Messages
Message | Description |
---|---|
Start | Starts simulation. Happens automatically if Autostart property is true . |
Stop | Stops simulation. |
Reset | Calls CDPSim::DynamicSimComponent::Reset for all simulator components in this application. That will reset all CDPSignal, CDPSim::SimSignal and CDPSim::StateVariable variables back to their initial values set by configuration XML (by default 0), and Init() is called on all operators. |
Signals
The following are measured values describing the runtime performance of simulation. To configure expected values, modify the SimulatorManager properties.
Signal | Description |
---|---|
RunsPerSchedule | Measured simulator iterations per simulator period. |
dt | Time since previous run. Should equal T, but may not be exactly T because of scheduler imperfection. |
T | Requested simulation period. Starting with value of property TimeStep, but may change dynamically. |
Initial Conditions
When simulating systems, it is important to set sensible initial values to every CDPSim::StateVariable, CDPSim::SimSignal and other objects the simulator is using. Initial conditions can be set from CDP Studio Configure mode by editing the Value attribute of a StateVariable, SimSignal, signal, parameter or property before running the system. When SimulatorManager starts up (in SimulatorManager::Activate()), and if SimulatorManager's TimeStep or fs is changed during runtime, SimulatorManager's message 'Reset' is automatically called.
Further Reading
See also CDPSim C++ Classes documentation for information how to configure and use other objects provided with CDPSim. If you click on a simulator application in the Project tree, and then expand CDPSim in the Resource tree, DynamicSimComponent and Integrator will appear. You may read more about them in DynamicSimComponent and Integrator.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.