Towards User-Defined Relations

Christoph Höger
christoph.hoeger@tu-berlin.de
04.02.2013 - Openmodelica Workshop 2013

Agenda

Problem Scope

Current situation

The Specification's Issue With Connection Semantics

The User's/Implementor's Issue With Connection Semantics

The Implementor's Solution

What do we need?

Steps needed

Variables as objects

Equality can be computed on variables, since they are globally named!

OpenModelica's current answer

Warning: In component , in relation x <> y, <> on Reals is only allowed inside functions.

But in fact, we know that they are different:

Relations as objects

connect(x,y);

Ideally, we could represent a relation as a special data structure in Modelica:


Syntax compatible extension

connect(x,y);

Unfortunately, we do not have that currently.



This record is like a model, except it cannot be constructed implicitly.

Evaluate relations like records

[/tmp/X.mo:7:18-7:20:writable] Error: No viable alternative near token: if

Equivalent rewrite

They should be the same!

Demo: What works now

Simple Example

Calculating Connected Sets

(Using External Java functions)

Calculating Equations

(More or less Modelica)

Result (no flows yet)

There would have been a demo...

Calculating Equations differently

(Equivalent formulation)

Result (no flows yet)

Future

Resolution of relations

#

/