Connectivity and Deployment

Leonardo Laguna Ruiz

Software Developer, Wolfram MathCore

Simulating Models with Wolfram SystemModeler™

SystemModeler can generate:

Standalone simulation executable

FMUs that can be used with other simulators

Connecting with the Simulation Executable

Control the simulation: start, stop, pause, restart

Read/write parameters, inputs, and outputs

Mathematica examples of TCP/IP connection

This is a text cell.

Needs["WSMLink`"];

mmodel="MathematicaExamples.Basic.WithTime";

ℳ=WSMSimulate[mmodel]

WSMPlot[ℳ,{"y","z"}]

Demo: TCP/IP Control

External application written in Java (using “Processing” IDE)

Connect through TCP/IP

Changing the value of the resistor

Demo: Three tank system

External application writen in Max

Allows visualization and control of the simulation

Using External C/C++ Code with Modelica Models

Functions in C files
Example: IntroductoryExamples.ExternalFunctions.SeriesCircuit

Functions from DLLs 
Example: ModelPlug

ModelPlug: Connecting to sensors and actuators with Arduino

Example: Use an Arduino as a DAC board

Analog and digital I/O

Servo control

Demo: Connecting to Arduino

The simulation model reads analog signals from the knobs and sends the positions to the servos

Using FMUs

Creates exchangeable models (FMUs) that can be used with other simulators

Demo: Exporting an FMU to VeriStand

The model is created with SystemModeler

Imported and controlled with NI VeriStand

Summary

SystemModeler connectivity alternatives:

Controlling the simulation executable through TCP/IP

Using external C/C++ code

Using ModelPlug to interface with hardware

Exporting FMUs to use in other simulators