Help - Search - Members - Calendar
Full Version: Exchange variables between two models without I/O ports
Modelica Forum > Modelica > Modelica
dragos
Hello,

I'm interested in creating a simulation that is controlled by a stategraph. The idea is to have two separate models, one for my simulation and the other one for the stategraph that will control my simulation and to interchange/use variables between them without using input/output ports. The problem is that my model can have an unknown number of variables to use and for me it would be simple to use variables names from each model.

Thanks,
Dragos
wagner
Hello Dragos,

on the last Modelica Conference we published a Library for simulation of distributed systems. Inside the controller models we've had a similar problem. The tasks running inside a controller model were supposed to exchange arbitrary information without explicitely defining connectors for each value to be exchanged. Our solution was to introduce a Modelica external shared memory component which can store strings that are addressed by a unique id.

Click to view attachment

The library can be downloaded from our homepage (NCLib) (http://www.eit.uni-kl.de/frey) in the software section.

You'll find the shared memory model (RAM) in the Controller.Memory subpackage of Controller.mo. An example on how to use the RAM component can be found in the subpackage Controller.Examples (Model PureSynchronisationEffects).

For your purpose you just need to write converter functions to transform the strings stored and read in the memory to the data format you want to use. Converter Functions for Real and Boolean values are already defined in Controller.Memory.Functions.

Instead of using variable names you then need to use the memory address to read and write values to your variables in the simulation and controller model.

Regards

Florian
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.