At the start of the simulation, this block establishes a socket connection using the Berkeley Software Distribution socket (BSD socket). At each sampling interval, data are exchanged between Modelica and the BCVTB. When Dymola terminates, a signal is sent to the BCVTB so that it can terminate gracefully.
For each element in the input vector uR[nDblWri]
,
the value of the flag flaDblWri[nDblWri]
determines whether
the current value, the average over the sampling interval or the integral
over the sampling interval is sent to the BCVTB. The following three options are allowed:
flaDblWri[i] | Value sent to the BCVTB |
0 | Current value of uR[i] |
1 | Average value of uR[i] over the sampling interval |
2 | Integral of uR[i] over the sampling interval |
For the first call to the BCVTB interface, the value of the parameter uStart[nDblWri]
will be used instead of uR[nDblWri]
. This avoids an algebraic loop when determining
the initial conditions. If uR[nDblWri]
were to be used, then computing the initial conditions
may require an iterative solution in which the function exchangeWithSocket
may be called
multiple times.
Unfortunately, it does not seem possible to use a parameter that would give a user the option to either
select uR[i]
or uStart[i]
in the first data exchange. The reason is that the symbolic solver does not evaluate
the test that picks uR[i]
or uStart[i]
, and hence there would be an algebraic loop.
If the parameter activateInterface
is set to false, then no data is exchanged with the BCVTB.
The output of this block is then equal to the value of the parameter yRFixed[nDblRea]
.
This option can be helpful during debugging. Since during model translation, the functions are
still linked to the C library, the header files and libraries need to be present in the current working
directory even if activateInterface=false
.
Buildings.Utilities.IO.BCVTB.BaseClasses.exchangeReals
in the initial algorithm
section.
This is needed to propagate the initial condition to the server.
It also leads to one more data exchange, which is correct and avoids the
warning message in Ptolemy that says that the simulation reached its stop time
one time step prior to the final time.