forked from modelica/ModelicaStandardLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MultiSensor.mo
116 lines (114 loc) · 5.47 KB
/
MultiSensor.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
within Modelica.Electrical.QuasiStatic.SinglePhase.Sensors;
model MultiSensor "Sensor to measure current, voltage and power"
extends Modelica.Icons.RoundSensor;
import Modelica.ComplexMath.conj;
import Modelica.ComplexMath.abs;
import Modelica.ComplexMath.arg;
QuasiStatic.SinglePhase.Interfaces.PositivePin pc
"Positive pin, current path"
annotation (Placement(transformation(extent={{-90,-10},{-110,10}})));
QuasiStatic.SinglePhase.Interfaces.NegativePin nc
"Negative pin, current path"
annotation (Placement(transformation(extent={{110,-10},{90,10}})));
QuasiStatic.SinglePhase.Interfaces.PositivePin pv
"Positive pin, voltage path"
annotation (Placement(transformation(extent={{-10,110},{10,90}})));
QuasiStatic.SinglePhase.Interfaces.NegativePin nv
"Negative pin, voltage path"
annotation (Placement(transformation(extent={{10,-110},{-10,-90}})));
Modelica.ComplexBlocks.Interfaces.ComplexOutput i(
redeclare final SI.Current re, redeclare final SI.Current im)
"Current as complex output signal" annotation (Placement(transformation(
origin={-60,-110},
extent={{10,10},{-10,-10}},
rotation=90), iconTransformation(
extent={{10,10},{-10,-10}},
rotation=90,
origin={-60,-110})));
Modelica.ComplexBlocks.Interfaces.ComplexOutput v(
redeclare final SI.Voltage re, redeclare final SI.Voltage im)
"Voltage as complex output signal" annotation (Placement(transformation(
origin={60,-110},
extent={{10,10},{-10,-10}},
rotation=90), iconTransformation(
extent={{10,10},{-10,-10}},
rotation=90,
origin={60,-110})));
Modelica.ComplexBlocks.Interfaces.ComplexOutput apparentPower(
redeclare final SI.ActivePower re, redeclare final SI.ReactivePower im)
"Instantaneous apparent power as complex output signal" annotation (Placement(transformation(
origin={-110,-60},
extent={{-10,10},{10,-10}},
rotation=180), iconTransformation(
extent={{-10,10},{10,-10}},
rotation=180,
origin={-110,-60})));
output SI.Current abs_i=abs(i) "Absolute of complex current";
output SI.Angle arg_i=arg(i) "Argument of complex current";
output SI.Voltage abs_v=abs(v) "Absolute of complex voltage";
output SI.Angle arg_v=arg(v) "Argument of complex voltage";
output SI.ApparentPower abs_apparentPower=abs(apparentPower) "Absolute of complex apparent power";
output SI.Angle arg_apparentPower=arg(apparentPower) "Argument of complex apparent power";
equation
Connections.branch(pc.reference, nc.reference);
pc.reference.gamma = nc.reference.gamma;
Connections.branch(pv.reference, nv.reference);
pv.reference.gamma = nv.reference.gamma;
Connections.branch(pc.reference, pv.reference);
pc.reference.gamma = pv.reference.gamma;
pc.i + nc.i = Complex(0);
pc.v - nc.v = Complex(0);
pv.i = Complex(0);
nv.i = Complex(0);
i = pc.i;
v = pv.v - nv.v;
apparentPower = v*conj(i);
annotation (
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={
Line(points = {{0,100},{0,70}}, color={85,170,255}),
Line(points = {{0,-70},{0,-100}}, color={85,170,255}),
Line(points = {{-100,0},{100,0}}, color={85,170,255}),
Line(points = {{0,70},{0,40}}),
Text(
extent={{-150,110},{150,150}},
textString="%name",
textColor={0,0,255}),
Line(points={{-100,-60},{-80,-60},{-56,-42}},
color={85,170,255}),
Line(points={{-60,-100},{-60,-80},{-42,-56}},
color={85,170,255}),
Line(points={{60,-100},{60,-80},{42,-56}},
color={85,170,255}),
Text(
extent={{-100,-20},{-60,-60}},
textColor={64,64,64},
textString="V.A"),
Text(
extent={{-80,-60},{-40,-100}},
textString="A",
textColor={64,64,64}),
Text(
extent={{40,-60},{80,-100}},
textString="V",
textColor={64,64,64})}),
Documentation(info="<html>
<p>This multi sensor measures current, voltage and instantaneous electrical power of a single-phase system and has a separated voltage and current path.
The pins of the voltage path are pv and nv, the pins of the current path are pc and nc.
The internal resistance of the current path is zero, the internal resistance of the voltage path is infinite.</p>
<h4>See also</h4>
<p>
<a href=\"modelica://Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.ReferenceSensor\">ReferenceSensor</a>,
<a href=\"modelica://Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.FrequencySensor\">FrequencySensor</a>,
<a href=\"modelica://Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.PotentialSensor\">PotentialSensor</a>,
<a href=\"modelica://Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.VoltageSensor\">VoltageSensor</a>,
<a href=\"modelica://Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.VoltageRMSSensor\">VoltageRMSSensor</a>,
<a href=\"modelica://Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.CurrentSensor\">CurrentSensor</a>,
<a href=\"modelica://Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.CurrentRMSSensor\">CurrentRMSSensor</a>,
<a href=\"modelica://Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.PowerSensor\">PowerSensor</a>
</p>
</html>", revisions="<html>
<ul>
<li><em>20170306</em> first implementation by Anton Haumer</li>
</ul>
</html>"));
end MultiSensor;