1 | package TestComplexConnect
|
---|
2 | connector pin
|
---|
3 | Modelica.SIunits.ComplexVoltage v;
|
---|
4 | flow Modelica.SIunits.ComplexCurrent i;
|
---|
5 | end pin;
|
---|
6 |
|
---|
7 | model VSource
|
---|
8 | parameter Modelica.SIunits.ComplexVoltage v = Complex(0);
|
---|
9 | pin p;
|
---|
10 | equation
|
---|
11 | p.v = v;
|
---|
12 | end VSource;
|
---|
13 |
|
---|
14 |
|
---|
15 | model Impedance1
|
---|
16 | pin p;
|
---|
17 | parameter Modelica.SIunits.ComplexImpedance Z;
|
---|
18 | equation
|
---|
19 | p.v = Z * p.i;
|
---|
20 | end Impedance1;
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 |
|
---|
25 | model Impedance2
|
---|
26 | pin p,n;
|
---|
27 | parameter Modelica.SIunits.ComplexImpedance Z;
|
---|
28 | Modelica.SIunits.ComplexVoltage v;
|
---|
29 | Modelica.SIunits.ComplexCurrent i;
|
---|
30 | equation
|
---|
31 | v = p.v - n.v;
|
---|
32 | p.i + n.i = Complex(0);
|
---|
33 | i = p.i;
|
---|
34 | v = Z*i;
|
---|
35 | end Impedance2;
|
---|
36 |
|
---|
37 |
|
---|
38 | model Circuit1
|
---|
39 | VSource V1(v = Complex(1, 0));
|
---|
40 | Impedance1 Z1(Z = Complex(0, 1));
|
---|
41 | equation
|
---|
42 | connect(V1.p, Z1.p);
|
---|
43 | end Circuit1;
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 | model Circuit1a
|
---|
48 | VSource V1(v = Complex(1, 0));
|
---|
49 | Impedance1 Z1(Z = Complex(0, 1));
|
---|
50 | Impedance1 Z2(Z = Complex(1, 0));
|
---|
51 | equation
|
---|
52 | connect(V1.p, Z1.p);
|
---|
53 | connect(V1.p, Z2.p);
|
---|
54 | end Circuit1a;
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 | model Circuit2
|
---|
62 | VSource V1(v = Complex(1,0));
|
---|
63 | VSource V2;
|
---|
64 | Impedance2 Z1(Z = Complex(0,1));
|
---|
65 | equation
|
---|
66 | connect(V1.p, Z1.p);
|
---|
67 | connect(Z1.n, V2.p);
|
---|
68 | end Circuit2;
|
---|
69 |
|
---|
70 | end TestComplexConnect;
|
---|