VILLASframework
Modular co-simulation framework
|
The File node-type can be used to log or replay samples to / from disk.
This node-type does not have any special library dependencies. It is always available.
The source code of the node-type is available here: https://git.rwth-aachen.de/acs/public/villas/node/blob/master/lib/nodes/file.cpp
Every file
node can be configured to only read or write or to do both at the same time. The node configuration is divided into two sub-groups: in
and out
.
Specifies the URI to a file from which is written to or read from depending in which group (in
or out
) is used.
This setting allows to add special paceholders for time and date values. See strftime(3) for a list of supported placeholder.
Example:
will create a file called:
A IO format identifier selecting the file format which is used for reading and writing from the file.
See Format-types for a complete list of supported formats.
The epoch describes the point in time when the first message will be read from the file. This setting allows to select the behaviour of the following epoch
setting. It can be used to adjust the point in time when the first value should be read.
The behaviour of epoch
is depending on the value of epoch_mode
.
To facilitate the following description of supported epoch_mode
's, we will introduce some intermediate variables (timestamps). Those variables will also been displayed during the startup phase of the server to simplify debugging.
epoch
is the value of the epoch
setting.first
is the timestamp of the first message / line in the input file.offset
will be added to the timestamps in the file to obtain the real time when the message will be sent.start
is the point in time when the first message will be sent (first + offset
).eta
the time to wait until the first message will be send (start - now
)The supported values for epoch_mode
:
epoch_mode | offset | start = first + offset |
---|---|---|
direct | now - first + epoch | now + epoch |
wait | now + epoch | now + first |
relative | epoch | first + epoch |
absolute | epoch - first | epoch |
original | 0 | immeadiatly |
By default send_rate
has the value 0
which means that the time between consecutive samples is the same as in the in
file based on the timestamps in the first column.
If this setting has a non-zero value, the default behaviour is overwritten with a fixed rate.
Defines the behaviour if the end of file of the input file is reached.
rewind
will rewind the file pointer and restart reading samples from the beginning of the file.exit
will terminated the program.wait
will periodically test if there are new samples which have been appended to the file.Similar to out.buffer_size (unsigned) = 0. This means that the data is loaded into the buffer before it is passed on to the node.
If in.buffer_size = 0
, no buffer will be generated.
With this setting enabled, the outgoing file is flushed whenever new samples have been written to it. For remote files this means that the new sample is appended to the remote file which involves network IO.
Note: Not all network file protocols might support partial uploads. It's know that this feature works for local files but not for WebDav. Other protocols hav not been tested yet.
If this is set to a positive value <X>
, the node will generate a full stream buffer with a size of <X>
bytes. This means that the data is buffered and not written until the buffer is full or until the node is stopped.
If out.buffer_size = 0
, no buffer will be generated.