model CurrentSensor "Multiphase current sensor"
extends Modelica.Icons.RotationalSensor;
parameter Integer m(final min = 1) = 3 "Number of phases";
Interfaces.PositivePlug plug_p(final m = m) annotation (Placement(transformation(extent = {
{-110, -10},
{-90, 10}})));
Interfaces.NegativePlug plug_n(final m = m) annotation (Placement(transformation(extent = {
{90, -10},
{110, 10}})));
Modelica.Blocks.Interfaces.RealOutput i[m] "current in the branch from p to n as output signal"
annotation (Placement(transformation(
origin = {0, -110},
extent = {
{10, -10},
{-10, 10}},
rotation = 90)));
Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor[m] annotation (Placement(transformation(extent = {
{-10, -10},
{10, 10}})));
equation
connect(plug_p.pin,currentSensor.p) annotation (Line(
points = {
{-100, 0},
{-10, 0}},
color = {0, 0, 255}));
connect(currentSensor.i,i) annotation (Line(
points = {
{0, -11},
{0, -110}},
color = {0, 0, 127}));
connect(currentSensor.n,plug_n.pin) annotation (Line(
points = {
{10, 0},
{100, 0}},
color = {0, 0, 255}));
annotation (
Icon(
coordinateSystem(
preserveAspectRatio = false,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Text(
extent = {
{-29, -11},
{30, -70}},
textString = "A"),
Line(points = {
{-70, 0},
{-90, 0}}),
Line(points = {
{70, 0},
{90, 0}}),
Line(
points = {
{0, -100},
{0, -70}},
color = {0, 0, 127}),
Text(
extent = {
{150, -100},
{-150, -70}},
textString = "m=%m"),
Text(
extent = {
{-150, 80},
{150, 120}},
textString = "%name",
lineColor = {0, 0, 255})}),
Documentation(info = "<html>\n<p>\nContains m current sensors (Modelica.Electrical.Analog.Sensors.CurrentSensor),\nthus measuring the m currents <em>i[m]</em> flowing from the m pins of plug_p to the m pins of plug_n.\n</p>\n</html>"));
end CurrentSensor;