Model Communication
Communication between DEVSLib
models
The interfaces for model communication are arranged in the package
Interfaces.
Input Ports
The inPort model represents the interface for input messages.
It contains two variables, the event and the queue.
The event represents that a new message or messages have been
received at the port. It is a flow variable because multiple models
can send messages to the same port, so the total number of messages
must be summed up.
The queue represents a reference to the storage space for the
incoming messages.
Output Ports
The outPort model represents the interface for output
messages.
It contains two variables, the event and the queue.
The event represents that a new message or messages have been sent
through the port. It is a flow variable because multiple models can
send messages to the same port, so the total number of messages
must be summed up.
The queue represents a reference to the storage space for the
outgoing messages.
Messages
The communication between models is performed as a message
passing mechanism. The output function of one model generates a
message that is sent to the input port of a connected model. The
model that receives the message executes an external
transition.
Due to the restrictions of the Modelica language, this message
pasing mechanism has been implemented using external functions that
store messages in dynamic memory. Only references to the messages
and the data structures that store the messages (queues, lists,
etc) are stored in the Modelica variables. The implementation of
these external functions is included in the file
events.c.
Message Management Functions
Several functions for message and queue management have been
included in the library:
- sendEvent, sends a message to a queue (message is stored a the
end of the queue).
- sendEventLIFO, sends a message to a queue (message is stored at
the beginning of the queue).
- sendEventLVF, sends a message to a queue (message is stored by
increasing 'value').
- sendEventHVF, sends a message to a queue (message is stored by
decreasing 'value').
- readEvent, reads a message from the 'position' of the
queue.
- getEvent, reads a message from the 'position' of the
queue.
- numEvents, returns the number of messages in the queue.
- eventOrder, returns the ordering value for the message in that
'position' of the queue.
- CreateQueue, creates a new queue for messages.
Generated at 2026-04-05T18:18:26Z by OpenModelicaOpenModelica 1.26.3 using
GenerateDoc.mos