This simple queueing example demonstrates the Dataset Writer block functionality. In FigureĀ E.33, the Entity Generator block in the upper left corner creates entities every two minutes and sends them to a Queue block where they wait for a server to become available. After being serviced, each entity passes through a Bucket block where the attributes Time and Age are collected. Then the entity leaves the system.
Every five minutes, the Entity Generator block in the lower left creates an entity. The entity is sent to a Gate block where
first a Boolean signal (with value true) is sent to the InSaveNow port of the Dataset Writer block. Once the true Boolean
signal arrives at the InSaveNow port, it is used as a signal to save the contents of the data model currently provided to
the Dataset Writer block through the InData port. In this example, the InData port is connected to the OutData port of the
Bucket, so the information collected up to that point by the Bucket is saved. Since the InPolicy port of the Dataset Writer
block has a connection, the location of the saved data is set dynamically. The following string expression is passed from
the Formula block to the InPolicy port of the Dataset Writer block to set the location: concat("result",toString(timeNow()),".sas7bdat")
. For example, the first data set saved is named result5.sas7bdat
.
After the entity generated by the second Entity Generator block signals the Dataset Writer block to save the Bucket data, another Boolean true signal is generated by the Gate block and sent to the InClearData port of the Bucket. This signal clears all data that have been collected by the Bucket block up to that time during the simulation execution. So the first data set saved by the Dataset Writer block contains the data collected by the Bucket between time 0 and time 5, and similarly the second data set saved contains the data collected by the Bucket between time 5 and time 10.
Figure E.33: Dataset Writer Block Example