| 1 | within ;
|
|---|
| 2 | package BugPeak
|
|---|
| 3 | model simpleMesh
|
|---|
| 4 |
|
|---|
| 5 | Modelica.Electrical.QuasiStationary.SinglePhase.Sources.VoltageSource U(
|
|---|
| 6 | V=10,
|
|---|
| 7 | f=50,
|
|---|
| 8 | phi=0.34906585039887) annotation (Placement(transformation(
|
|---|
| 9 | extent={{-10,-10},{10,10}},
|
|---|
| 10 | rotation=-90,
|
|---|
| 11 | origin={-80,18})));
|
|---|
| 12 | Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Resistor resistor(
|
|---|
| 13 | R_ref=1) annotation (Placement(transformation(
|
|---|
| 14 | extent={{-10,-10},{10,10}},
|
|---|
| 15 | rotation=0,
|
|---|
| 16 | origin={-14,40})));
|
|---|
| 17 | Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Ground ground
|
|---|
| 18 | annotation (Placement(transformation(extent={{-90,-42},{-70,-22}})));
|
|---|
| 19 | Modelica.Electrical.QuasiStationary.SinglePhase.Sources.VoltageSource U1(
|
|---|
| 20 | f=50,
|
|---|
| 21 | V=10,
|
|---|
| 22 | phi=0) annotation (Placement(transformation(
|
|---|
| 23 | extent={{-10,-10},{10,10}},
|
|---|
| 24 | rotation=-90,
|
|---|
| 25 | origin={40,10})));
|
|---|
| 26 | Modelica.Electrical.QuasiStationary.SinglePhase.Sensors.PowerSensor S
|
|---|
| 27 | annotation (Placement(transformation(extent={{8,30},{28,50}})));
|
|---|
| 28 | Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Inductor inductor(L=
|
|---|
| 29 | 0.01) annotation (Placement(visible=true, transformation(
|
|---|
| 30 | origin={-47.5652,40.4348},
|
|---|
| 31 | extent={{-10,-10},{10,10}},
|
|---|
| 32 | rotation=0)));
|
|---|
| 33 | getUPeak getUPeak1 annotation (Placement(transformation(
|
|---|
| 34 | extent={{-10,-10},{10,10}},
|
|---|
| 35 | rotation=-90,
|
|---|
| 36 | origin={72,16})));
|
|---|
| 37 | equation
|
|---|
| 38 | connect(inductor.pin_p, U.pin_p) annotation (Line(points={{-57.5652,40.4348},
|
|---|
| 39 | {-80,40.4348},{-80,28}},color={85,170,255}));
|
|---|
| 40 | connect(inductor.pin_n, resistor.pin_p) annotation (Line(points={{-37.5652,
|
|---|
| 41 | 40.4348},{-24,40}}, color={85,170,255}));
|
|---|
| 42 | connect(U.pin_n, ground.pin) annotation (Line(
|
|---|
| 43 | points={{-80,8},{-80,-22}},
|
|---|
| 44 | color={85,170,255},
|
|---|
| 45 | smooth=Smooth.None));
|
|---|
| 46 | connect(U1.pin_n, ground.pin) annotation (Line(
|
|---|
| 47 | points={{40,0},{40,-8},{-80,-8},{-80,-22}},
|
|---|
| 48 | color={85,170,255},
|
|---|
| 49 | smooth=Smooth.None));
|
|---|
| 50 | connect(S.currentP, resistor.pin_n) annotation (Line(
|
|---|
| 51 | points={{8,40},{-4,40}},
|
|---|
| 52 | color={85,170,255},
|
|---|
| 53 | smooth=Smooth.None));
|
|---|
| 54 | connect(S.currentN, U1.pin_p) annotation (Line(
|
|---|
| 55 | points={{28,40},{40,40},{40,20}},
|
|---|
| 56 | color={85,170,255},
|
|---|
| 57 | smooth=Smooth.None));
|
|---|
| 58 | connect(S.voltageP, S.currentP) annotation (Line(
|
|---|
| 59 | points={{18,50},{8,50},{8,40}},
|
|---|
| 60 | color={85,170,255},
|
|---|
| 61 | smooth=Smooth.None));
|
|---|
| 62 | connect(S.voltageN, ground.pin) annotation (Line(
|
|---|
| 63 | points={{18,30},{18,-8},{-80,-8},{-80,-22}},
|
|---|
| 64 | color={85,170,255},
|
|---|
| 65 | smooth=Smooth.None));
|
|---|
| 66 | connect(getUPeak1.positivePin, S.currentN) annotation (Line(
|
|---|
| 67 | points={{72,26},{72,40},{28,40}},
|
|---|
| 68 | color={85,170,255},
|
|---|
| 69 | smooth=Smooth.None));
|
|---|
| 70 | connect(getUPeak1.negativePin, ground.pin) annotation (Line(
|
|---|
| 71 | points={{72,6.2},{72,-8},{-80,-8},{-80,-22}},
|
|---|
| 72 | color={85,170,255},
|
|---|
| 73 | smooth=Smooth.None));
|
|---|
| 74 | annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 75 | -100},{100,100}}), graphics));
|
|---|
| 76 | end simpleMesh;
|
|---|
| 77 |
|
|---|
| 78 | model getUPeak "gives the peak value of the mesured voltage"
|
|---|
| 79 | Modelica.Electrical.QuasiStationary.SinglePhase.Sensors.VoltageSensor
|
|---|
| 80 | voltageSensor
|
|---|
| 81 | annotation (Placement(transformation(extent={{-10,24},{10,44}})));
|
|---|
| 82 | Modelica.ComplexBlocks.ComplexMath.ComplexToPolar complexToPolar
|
|---|
| 83 | annotation (Placement(transformation(
|
|---|
| 84 | extent={{-10,-10},{10,10}},
|
|---|
| 85 | rotation=-90,
|
|---|
| 86 | origin={0,0})));
|
|---|
| 87 | Modelica.Blocks.Math.Gain gain(k=sqrt(2)) annotation (Placement(
|
|---|
| 88 | transformation(
|
|---|
| 89 | extent={{-10,-10},{10,10}},
|
|---|
| 90 | rotation=-90,
|
|---|
| 91 | origin={0,-46})));
|
|---|
| 92 | Modelica.Blocks.Interfaces.RealOutput y annotation (Placement(
|
|---|
| 93 | transformation(
|
|---|
| 94 | extent={{-10,-10},{10,10}},
|
|---|
| 95 | rotation=-90,
|
|---|
| 96 | origin={0,-110})));
|
|---|
| 97 | Modelica.Electrical.QuasiStationary.SinglePhase.Interfaces.PositivePin
|
|---|
| 98 | positivePin
|
|---|
| 99 | annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
|
|---|
| 100 | Modelica.Electrical.QuasiStationary.SinglePhase.Interfaces.NegativePin
|
|---|
| 101 | negativePin
|
|---|
| 102 | annotation (Placement(transformation(extent={{88,-10},{108,10}})));
|
|---|
| 103 | equation
|
|---|
| 104 | connect(voltageSensor.y, complexToPolar.u) annotation (Line(
|
|---|
| 105 | points={{0,23},{0,12},{0.00000000000000222045,12}},
|
|---|
| 106 | color={85,170,255},
|
|---|
| 107 | smooth=Smooth.None));
|
|---|
| 108 | connect(complexToPolar.len, gain.u) annotation (Line(
|
|---|
| 109 | points={{6,-12},{6,-34},{0.00000000000000222045,-34}},
|
|---|
| 110 | color={0,0,127},
|
|---|
| 111 | smooth=Smooth.None));
|
|---|
| 112 | connect(gain.y, y) annotation (Line(
|
|---|
| 113 | points={{-0.0000000000000019984,-57},{-0.0000000000000019984,-62.5},{0,
|
|---|
| 114 | -62.5},{0,-110}},
|
|---|
| 115 | color={0,0,127},
|
|---|
| 116 | smooth=Smooth.None));
|
|---|
| 117 | connect(voltageSensor.pin_p, positivePin) annotation (Line(
|
|---|
| 118 | points={{-10,34},{-52,34},{-52,0},{-100,0}},
|
|---|
| 119 | color={85,170,255},
|
|---|
| 120 | smooth=Smooth.None));
|
|---|
| 121 | connect(voltageSensor.pin_n, negativePin) annotation (Line(
|
|---|
| 122 | points={{10,34},{52,34},{52,0},{98,0}},
|
|---|
| 123 | color={85,170,255},
|
|---|
| 124 | smooth=Smooth.None));
|
|---|
| 125 | annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 126 | -100},{100,100}}), graphics), Icon(coordinateSystem(
|
|---|
| 127 | preserveAspectRatio=false, extent={{-100,-100},{100,100}}),
|
|---|
| 128 | graphics={
|
|---|
| 129 | Line(
|
|---|
| 130 | points={{-94,0},{92,0}},
|
|---|
| 131 | color={85,170,255},
|
|---|
| 132 | smooth=Smooth.None),
|
|---|
| 133 | Ellipse(
|
|---|
| 134 | extent={{-56,56},{56,-56}},
|
|---|
| 135 | lineColor={0,0,255},
|
|---|
| 136 | fillColor={255,255,255},
|
|---|
| 137 | fillPattern=FillPattern.Solid),
|
|---|
| 138 | Line(
|
|---|
| 139 | points={{-30,30},{-30,-30}},
|
|---|
| 140 | color={0,0,255},
|
|---|
| 141 | smooth=Smooth.None),
|
|---|
| 142 | Line(
|
|---|
| 143 | points={{30,30},{30,-30}},
|
|---|
| 144 | color={0,0,255},
|
|---|
| 145 | smooth=Smooth.None),
|
|---|
| 146 | Text(
|
|---|
| 147 | extent={{-102,42},{102,-40}},
|
|---|
| 148 | lineColor={0,0,255},
|
|---|
| 149 | fillColor={255,255,255},
|
|---|
| 150 | fillPattern=FillPattern.Solid,
|
|---|
| 151 | textString="U"),
|
|---|
| 152 | Line(
|
|---|
| 153 | points={{0,-56},{0,-102}},
|
|---|
| 154 | color={0,0,255},
|
|---|
| 155 | smooth=Smooth.None)}));
|
|---|
| 156 | end getUPeak;
|
|---|
| 157 | annotation (uses(Modelica(version="3.2")));
|
|---|
| 158 | end BugPeak;
|
|---|