Skip to content

Commit

Permalink
[NF] Added complex flow test.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Mar 27, 2018
1 parent 964de8b commit 019bec7
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
55 changes: 55 additions & 0 deletions flattening/modelica/scodeinst/ConnectComplexFlow1.mo
@@ -0,0 +1,55 @@
// name: ConnectComplexFlow1
// keywords:
// status: correct
// cflags: -d=newInst
//

operator record Complex
replaceable Real re;
replaceable Real im;
end Complex;

package Modelica
package SIunits
type Current = Real;
type Voltage = Real;

operator record ComplexCurrent = Complex(
redeclare Modelica.SIunits.Current re,
redeclare Modelica.SIunits.Current im
);

operator record ComplexVoltage = Complex(
redeclare Modelica.SIunits.Voltage re,
redeclare Modelica.SIunits.Voltage im
);
end SIunits;
end Modelica;

package Internals
operator record ComplexVoltage =
Modelica.SIunits.ComplexVoltage(re(nominal = 1e3), im(nominal = 1e3));
operator record ComplexCurrent =
Modelica.SIunits.ComplexCurrent(re(nominal = 1e3), im(nominal = 1e3));

connector Pin
ComplexVoltage v;
flow ComplexCurrent i;
end Pin;
end Internals;

model ConnectComplexFlow1
Internals.Pin pin;
end ConnectComplexFlow1;

// Result:
// class ConnectComplexFlow1
// Real pin.v.re(nominal = 1000.0);
// Real pin.v.im(nominal = 1000.0);
// Real pin.i.re(nominal = 1000.0);
// Real pin.i.im(nominal = 1000.0);
// equation
// pin.i.re = 0.0;
// pin.i.im = 0.0;
// end ConnectComplexFlow1;
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -128,6 +128,7 @@ ConnectAlgorithm.mo \
ConnectArrays1.mo \
ConnectArrays2.mo \
ConnectArrays3.mo \
ConnectComplexFlow1.mo \
ConnectDiffOrder1.mo \
ConnectDiffOrder2.mo \
ConnectInitial.mo \
Expand Down

0 comments on commit 019bec7

Please sign in to comment.