.DESLib.DEVSLib.UsersGuide.NewCoupled

Information

Development of new Coupled DEVS models using DEVSLib

A coupled model is a DEVS model composed by a combination of atomic, coupled or both models. Like other DEVS models, a coupled model has input and output ports, that have to be connected to the internal components of the coupled model. Each input port will be connected to an input port of a component. Each ouptut port will be connected to one or more output ports of one or several components.

The following images show examples of DEVS coupled models.


Coupled models with DEVSLib

Coupled DEVS models can be developed easyly using DEVSlib. The library includes the coupledDraft model that contains the basic structure for a coupled model. The steps to build a new coupled model are:

  1. Duplicate and rename the coupledDraft model to obtain the basic structure for the new model.
  2. Copy/Paste or delete the input and output ports of the model, to define the required amount of input and output ports in the model.
  3. Include the components of the coupled model, using drag and drop from the Package Browser.
  4. Connect the components between them and with the input and output ports as required by the models behavior.

The following figure shows a simple coupled DEVS model (corresponds to the NetSwitch model of the library examples).

Duplicating Messages

Due to the design (queues that receive messages) and implementation (external C structures dynamically managed) of the communication mechanism between models in the DEVSLib package, it is not possible to connect the same output port of a component to several input ports of other components.

However, to provide a solution to this restriction, a DEVS model that provides the duplication of messages has been included in the library. This model is included in the AuxModels package, and it is called DUP. The DUP model sends a copy of each received message through its two output ports. If more that two copies of the same message are needed, several DUP models can be nested in multiple levels. (to simplify this procedure a DUP3 model with three output ports has been included in the Auxmodels package).

An example of DUP usage is provided in the testDup model, and is shown in the next figure.


Algebraic Loops

During the construction of coupled models algebraic loops can be created. This problem can be avoided in two ways:

The BreakLoop model breaks the loop by including a "pre" statement in the detection of the incomming messages.

An example of BreakLoop usage is provided in the testSwitch2 model, and is shown in the next figure.



Generated at 2024-04-28T18:16:21Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos