For Ptolemy II related information, we recommend to read the Ptolemy II web page and the Ptolemy II tutorial from UC Berkeley.
In Ptolemy II, different models of computations can be used to define how the different actors interact with each other. The model of computation is defined by a director that needs to be included in the Ptolemy II flow chart diagram. For the BCVTB, we typically use the Synchronous Dataflow director, which is in Ptolemy II called SDF Director. This director can be dragged into the model from the left pane shown in Figure 4.1 .
For convenience, the examples in the BCVTB expose the
three parameters startTime
,
timeStep
and finalTime
. These
three parameters have units of seconds and needs to
correspond with the start time, time step and final time
that is used in the simulation program. The parameters
used to configure the SDF Director are shown in
Figure 4.2
.
Flow charts with the SDF director must not contain
algebraic loops. If there is an algebraic loop, then a
sample delay actor needs to be inserted. This actor can
be found in the Ptolemy II actor library in
(Actors->FlowControl->SequenceControl->SampleDelay
).
Figure 4.3
shows the use of a SampleDelay
actor for
delaying the output of a controller by one sampling
interval.
Figure 4.3.
Implementation of the controller with the SampleDelay
actor that delays its output by one sampling interval. This delay eliminates an algebraic loop, which is not allowed with the SDF director.
The Simulator
actor conducts the data
exchange with the simulation program. There can be any
number of Simulator
actors in a model. The
parameters of the Simulator
actor are as
shown in
Table 4.1, “Parameters of the Simulator
actor.”
.
Table 4.1. Parameters of the Simulator
actor.
Parameter | Description |
---|---|
programName | The name of the executable that starts the simulation. |
programArguments | Arguments needed by the simulation. Text arguments need to be enclosed in apostrophes. |
workingDirectory | Working directory of the program. For the current directory, enter a period. |
simulationLogFile | Name of the file to which the BCVTB will write the console output and error stream that it receives from the simulation program. Use a separate file for each simulation program. This file typically shows what may have caused an error. |
socketTimeout | Time out in milliseconds for the initial socket connection. At the start of the simulation, the BCVTB waits for the simulation program to connect through a socket connection to the BCVTB. If the simulation program does not connect within the here specified time, the BCVTB will stop with an error. |
showConsoleWindow | Check box; if activated, a separate window will be opened that displays the console output of the program. |
Note | |
---|---|
The value of the parameter |
An example that starts EnergyPlus on Linux and Mac is shown in Figure 4.4 .