How to fix "Model is not globally balanced" with SMPM and inverter - modelica

Based on the example Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMPM_VoltageSource, I am trying to use the inverter from Modelica.Electrical.PowerConverters.DCAC.MultiPhase2Level to feed the SMPM.
Unfortunately I get the error
Simulation model is not globally balanced, having 337 variables and
335 equations
but I can't figure out which two equations are missing.
What confuses me even more is that the model is balanced if I remove the signalPWM, inverter and the constantVoltage sources.
model SMPM_VoltageSource_Inverter
import Modelica.Constants.pi;
constant Integer m = 3 "Number of phases";
parameter Modelica.SIunits.Frequency f = 1000 "Switching frequency";
parameter Modelica.SIunits.Frequency f1 = 50 "Fundamental wave AC frequency";
parameter Modelica.SIunits.Current Idq[2] = {-53.5, 84.6} "Desired d- and q-current";
parameter Modelica.SIunits.AngularVelocity wNominal = 2 * pi * smpmData.fsNominal / smpmData.p "Nominal speed";
parameter Modelica.SIunits.Torque TLoad = 181.4 "Nominal load torque";
parameter Modelica.SIunits.Inertia JLoad = 0.29 "Load's moment of inertia";
Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_PermanentMagnet smpm(phiMechanical(start = 0, fixed = true), wMechanical(start = 0, fixed = true), useSupport = false, useThermalPort = false, p = smpmData.p, fsNominal = smpmData.fsNominal, Rs = smpmData.Rs, TsRef = smpmData.TsRef, Lszero = smpmData.Lszero, Lssigma = smpmData.Lssigma, Jr = smpmData.Jr, Js = smpmData.Js, frictionParameters = smpmData.frictionParameters, statorCoreParameters = smpmData.statorCoreParameters, strayLoadParameters = smpmData.strayLoadParameters, VsOpenCircuit = smpmData.VsOpenCircuit, Lmd = smpmData.Lmd, Lmq = smpmData.Lmq, useDamperCage = smpmData.useDamperCage, Lrsigmad = smpmData.Lrsigmad, Lrsigmaq = smpmData.Lrsigmaq, Rrd = smpmData.Rrd, Rrq = smpmData.Rrq, TrRef = smpmData.TrRef, permanentMagnetLossParameters = smpmData.permanentMagnetLossParameters, TsOperational = 293.15, alpha20s = smpmData.alpha20s, TrOperational = 293.15, alpha20r = smpmData.alpha20r) annotation(Placement(transformation(extent = {{-20, -50}, {0, -30}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Blocks.Sources.Constant iq(k = Idq[2]) annotation(Placement(transformation(extent = {{-90, 20}, {-70, 40}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Blocks.Sources.Constant id(k = Idq[1]) annotation(Placement(transformation(extent = {{-90, 60}, {-70, 80}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(terminalConnection = "Y") annotation(Placement(transformation(extent = {{-20, -34}, {0, -14}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {20, -10}), visible = true));
Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J = JLoad) annotation(Placement(transformation(extent = {{50, -50}, {70, -30}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque quadraticSpeedDependentTorque(tau_nominal = -TLoad, w_nominal(displayUnit = "rad/s") = wNominal) annotation(Placement(transformation(extent = {{100, -50}, {80, -30}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Electrical.MultiPhase.Sensors.CurrentSensor currentSensor(m = m) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-10, -10}), visible = true));
Modelica.Electrical.Machines.Utilities.VoltageController voltageController(p = smpm.p, Ld = smpm.Lssigma + smpm.Lmd, Lq = smpm.Lssigma + smpm.Lmq, Rs = Modelica.Electrical.Machines.Thermal.convertResistance(smpm.Rs, smpm.TsRef, smpm.alpha20s, smpm.TsOperational), fsNominal = smpm.fsNominal, VsOpenCircuit = smpm.VsOpenCircuit) annotation(Placement(transformation(extent = {{-50, 40}, {-30, 60}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Mechanics.Rotational.Sensors.TorqueSensor torqueSensor annotation(Placement(transformation(extent = {{10, 10}, {-10, -10}}, rotation = 180, origin = {40, -70}), visible = true));
Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {50, -10}), visible = true));
Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorDisplacementAngle(p = smpm.p) annotation(Placement(transformation(origin = {20, -50}, extent = {{-10, 10}, {10, -10}}, rotation = 270), visible = true));
Modelica.Electrical.Analog.Basic.Ground groundM annotation(Placement(transformation(origin = {-80, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 270), visible = true));
Modelica.Electrical.MultiPhase.Basic.Star starM(final m = m) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-60, -20}), visible = true));
Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = 180, origin = {-30, -20}), visible = true));
parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData smpmData(useDamperCage = false) annotation(Placement(transformation(extent = {{-20, -80}, {0, -60}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor annotation(Placement(transformation(origin = {-10, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 270), visible = true));
Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM signalPWM[m](each useConstantDutyCycle = false, each f = f) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, origin = {-4.866, 46.285}, rotation = 0), visible = true));
Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage_n(V = 50) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {87.166, 41.725}), visible = true));
Modelica.Electrical.PowerConverters.DCAC.MultiPhase2Level inverter(useHeatPort = false, m = m) annotation(Placement(transformation(extent = {{50, 20}, {30, 40}}, origin = {-3.885, 35.399}, rotation = 0), visible = true));
Modelica.Electrical.Analog.Basic.Ground ground1 annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {67.166, 71.725}), visible = true));
Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage_p(V = 50) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {87.166, 81.725}), visible = true));
initial equation
smpm.is[1:2] = zeros(2);
equation
connect(terminalBox.plug_sn, smpm.plug_sn) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-16, -40}));
connect(terminalBox.plug_sp, smpm.plug_sp) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-4, -40}));
connect(quadraticSpeedDependentTorque.flange, inertiaLoad.flange_b) annotation(Line(points = {{80, -40}, {70, -40}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
connect(smpm.flange, angleSensor.flange) annotation(Line(points = {{-6.667, -10}, {3.333, -10}, {3.333, 20}, {13.333, 20}}, visible = true, origin = {6.667, -40}, color = {64, 64, 64}));
connect(currentSensor.plug_n, terminalBox.plugSupply) annotation(Line(points = {{-10, -10}, {-10, -28}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(id.y, voltageController.id_rms) annotation(Line(points = {{-69, 70}, {-60, 70}, {-60, 56}, {-52, 56}}, color = {1, 37, 163}, visible = true, origin = {-0, -10}));
connect(iq.y, voltageController.iq_rms) annotation(Line(points = {{-69, 30}, {-60, 30}, {-60, 44}, {-52, 44}}, color = {1, 37, 163}, visible = true, origin = {-0, -10}));
connect(angleSensor.phi, voltageController.phi) annotation(Line(points = {{20, 11}, {20, 34}, {-34, 34}, {-34, 38}}, color = {1, 37, 163}, visible = true, origin = {0, -10}));
connect(currentSensor.i, voltageController.iActual) annotation(Line(points = {{-21, 0}, {-46, 0}, {-46, 38}}, color = {1, 37, 163}, visible = true, origin = {-0, -10}));
connect(inertiaLoad.flange_a, torqueSensor.flange_b) annotation(Line(points = {{50, -40}, {50, -60}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
connect(torqueSensor.flange_a, smpm.flange) annotation(Line(points = {{30, -60}, {30, -40}, {0, -40}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
connect(speedSensor.flange, smpm.flange) annotation(Line(points = {{23.333, 20}, {13.333, 20}, {13.333, -10}, {-26.667, -10}}, visible = true, origin = {26.667, -40}, color = {64, 64, 64}));
connect(rotorDisplacementAngle.flange, smpm.flange) annotation(Line(points = {{10, -40}, {0, -40}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
connect(rotorDisplacementAngle.plug_p, smpm.plug_sp) annotation(Line(points = {{14, -30}, {-4, -30}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(rotorDisplacementAngle.plug_n, smpm.plug_sn) annotation(Line(points = {{26, -30}, {26, -20}, {-16, -20}, {-16, -30}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(voltageQuasiRMSSensor.plug_p, currentSensor.plug_n) annotation(Line(points = {{-20, -10}, {-10, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(starM.plug_p, voltageQuasiRMSSensor.plug_n) annotation(Line(points = {{-50, -10}, {-40, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(groundM.p, starM.pin_n) annotation(Line(points = {{-70, -28}, {-70, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(currentQuasiRMSSensor.plug_n, currentSensor.plug_p) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-10, 0}));
connect(signalPWM.fire, inverter.fire_p) annotation(Line(points = {{-24.66, 1.943}, {-24.66, 6.943}, {-3.66, 6.943}, {-3.66, -6.943}, {28.321, -6.943}, {28.321, -1.943}}, color = {190, 52, 178}, visible = true, origin = {13.794, 55.342}));
connect(constantVoltage_n.n, inverter.dc_n) annotation(Line(points = {{-32.834, 6.725}, {-73.885, 6.725}, {-73.885, 30.399}}, color = {10, 90, 224}, visible = true, origin = {120, 25}));
connect(signalPWM.notFire, inverter.fire_n) annotation(Line(points = {{-12.66, 1.943}, {-12.66, 6.943}, {-3.66, 6.943}, {-3.66, -6.943}, {16.321, -6.943}, {16.321, -1.943}}, color = {190, 52, 178}, visible = true, origin = {13.794, 55.342}));
connect(constantVoltage_p.n, constantVoltage_n.p) annotation(Line(points = {{-70, 40}, {-70, 20}}, color = {10, 90, 224}, visible = true, origin = {157.166, 31.725}));
connect(constantVoltage_p.p, inverter.dc_p) annotation(Line(points = {{-70, 60}, {-111.051, 60}, {-111.051, 43.673}}, color = {10, 90, 224}, visible = true, origin = {157.166, 31.725}));
connect(inverter.ac, currentQuasiRMSSensor.plug_p) annotation(Line(visible = true, origin = {2.038, 50.266}, points = {{24.077, 15.133}, {-12.038, 15.133}, {-12.038, -30.266}}, color = {10, 90, 224}));
connect(voltageController.y[1], signalPWM[1].dutyCycle) annotation(Line(visible = true, origin = {-23.467, 43.142}, points = {{-5.533, -3.142}, {-0.533, -3.142}, {-0.533, 3.142}, {6.6, 3.142}}, color = {1, 37, 163}));
connect(ground1.p, constantVoltage_p.n) annotation(Line(points = {{-10, 0}, {-10, -5}, {10, -5}, {10, 10}}, color = {10, 90, 224}, visible = true, origin = {77.166, 61.725}));
annotation(experiment(StopTime = 2.0, Interval = 0.001), Documentation(info = "<html>
<p>
A synchronous induction machine with permanent magnets accelerates a quadratic speed dependent load from standstill.
The rms values of d- and q-current in rotor fixed coordinate system are controlled by the voltageController,
and the output voltages fed to the machine. The result shows that the torque is influenced by the q-current,
whereas the stator voltage is influenced by the d-current.</p>
<p>
Default machine parameters of model SM_PermanentMagnet are used.
</p>
</html>"));
end SMPM_VoltageSource_Inverter;
Does someone may know how to fix the problem so I can make this model run?
Any help would be highly appreciated!

You vectorized the component componentsignalPWM, using m=3 instances. But only the first instance has its input connected.
Change the connection
connect(voltageController.y[1], signalPWM[1].dutyCycle)
to
connect(voltageController.y, signalPWM.dutyCycle)
to connect the three outputs of voltageController to the inputs of the three signalPWM blocks.

Related

Modelica v4.0.0 Visualizers are Broken

I have recently migrated to modelica version 4.0.0, am am having some problems, it turns out that some visualizer settings for the SignalArrow and sensors, such as the absoluteSensor had their diameter settings removed,
Changes in Modelica Version 4
Namely:
WorldForce The parameters diameter and N_to_m have been removed.
AbsoluteSensor The parameter arrowDiameter has been removed.
RelativeSensor The parameter arrowDiameter has been removed.
Distance The parameter arrowDiameter has been removed.
And many other things. This is somewhat frustrating, however I managed to find these missing settings have been moved into the world class,
However these changes do not affect the diameter sizes of these arrows from sensors and visualizers.
For example, in this image, the yellow and pink arrows should be 5mm (the same diameter of the black coordinate arrows), and not whatever modelica has calculated them to be.
I have attempted removing all visualizers and reinserting them, disabling then renabling them and everything else I can think of. Their diameters are being calculated from something somewhere. I however cannot seem to find it.
How can this be fixed or is this just broken in 4.0.0?
Added Code
v 3.2.3
model asdfa
inner Modelica.Mechanics.MultiBody.World world(label2 = "z", label1 = "x", n = {0, 0, -1}) annotation(Placement(visible = true, transformation(origin = {-110, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Joints.Revolute revolute1(n = {0, 1, 0}) annotation(Placement(visible = true, transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation1(r = {0, -1, 0}, animation = false) annotation(Placement(visible = true, transformation(origin = {10, 72.396}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Parts.PointMass pointMass1(m = 1) annotation(Placement(visible = true, transformation(origin = {52.304, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Visualizers.SignalArrow signalArrow1(diameter = 0.008) annotation(Placement(visible = true, transformation(origin = {85, 55}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation2(r = {1, 0, 0}, animation = false) annotation(Placement(visible = true, transformation(origin = {17.792, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Sensors.AbsoluteSensor absoluteSensor1(get_r = true, resolveInFrame = Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.world, arrowDiameter = 0.008, arrowColor = {255, 0, 255}) annotation(Placement(visible = true, transformation(origin = {45, -21.932}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(revolute1.frame_a, world.frame_b) annotation(Line(visible = true, origin = {-80, 30}, points = {{20, 0}, {-20, -0}}));
connect(revolute1.frame_b, fixedTranslation2.frame_a) annotation(Line(visible = true, origin = {-16.104, 30}, points = {{-23.896, 0}, {23.896, 0}}));
connect(fixedTranslation1.frame_a, world.frame_b) annotation(Line(visible = true, origin = {-27.5, 51.198}, points = {{27.5, 21.198}, {22.5, 21.198}, {22.5, -21.198}, {-72.5, -21.198}}));
connect(absoluteSensor1.r, signalArrow1.r_head) annotation(Line(visible = true, origin = {60, -16.449}, points = {{-25, -16.483}, {-25, -21.483}, {25, -21.483}, {25, 59.449}}));
connect(fixedTranslation1.frame_b, signalArrow1.frame_a) annotation(Line(visible = true, origin = {36.25, 63.698}, points = {{-16.25, 8.698}, {-11.25, 8.698}, {-11.25, -8.698}, {38.75, -8.698}}));
connect(fixedTranslation2.frame_b, pointMass1.frame_a) annotation(Line(visible = true, origin = {40.048, 30}, points = {{-12.256, 0}, {12.256, 0}}));
connect(absoluteSensor1.frame_a, pointMass1.frame_a) annotation(Line(visible = true, origin = {39.922, -5.546}, points = {{-4.922, -16.386}, {-9.922, -16.386}, {-9.922, -1.386}, {12.383, -1.386}, {12.383, 35.546}}));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, extent = {{-100, -100}, {100, 100}}, radius = 25), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name")}));
end asdfa;
Migrated to v4.0.0
model asdfa
inner Modelica.Mechanics.MultiBody.World world(label2 = "z", label1 = "x", n = {0, 0, -1}, defaultArrowDiameter = 0.008) annotation(Placement(visible = true, transformation(origin = {-110, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Joints.Revolute revolute1(n = {0, 1, 0}) annotation(Placement(visible = true, transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation1(r = {0, -1, 0}, animation = false) annotation(Placement(visible = true, transformation(origin = {10, 72.396}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Parts.PointMass pointMass1(m = 1) annotation(Placement(visible = true, transformation(origin = {52.304, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Visualizers.SignalArrow signalArrow1 annotation(Placement(visible = true, transformation(origin = {85, 55}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
/*diameter = 0.008*/
Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation2(r = {1, 0, 0}, animation = false) annotation(Placement(visible = true, transformation(origin = {17.792, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Sensors.AbsoluteSensor absoluteSensor1(get_r = true, resolveInFrame = Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.world, /*arrowDiameter = 0.008,*/ arrowColor = {255, 0, 255}) annotation(Placement(visible = true, transformation(origin = {45, -21.932}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(revolute1.frame_a, world.frame_b) annotation(Line(visible = true, origin = {-80, 30}, points = {{20, 0}, {-20, -0}}));
connect(revolute1.frame_b, fixedTranslation2.frame_a) annotation(Line(visible = true, origin = {-16.104, 30}, points = {{-23.896, 0}, {23.896, 0}}));
connect(fixedTranslation1.frame_a, world.frame_b) annotation(Line(visible = true, origin = {-27.5, 51.198}, points = {{27.5, 21.198}, {22.5, 21.198}, {22.5, -21.198}, {-72.5, -21.198}}));
connect(absoluteSensor1.r, signalArrow1.r_head) annotation(Line(visible = true, origin = {60, -16.449}, points = {{-25, -16.483}, {-25, -21.483}, {25, -21.483}, {25, 59.449}}));
connect(fixedTranslation1.frame_b, signalArrow1.frame_a) annotation(Line(visible = true, origin = {36.25, 63.698}, points = {{-16.25, 8.698}, {-11.25, 8.698}, {-11.25, -8.698}, {38.75, -8.698}}));
connect(fixedTranslation2.frame_b, pointMass1.frame_a) annotation(Line(visible = true, origin = {40.048, 30}, points = {{-12.256, 0}, {12.256, 0}}));
connect(absoluteSensor1.frame_a, pointMass1.frame_a) annotation(Line(visible = true, origin = {39.922, -5.546}, points = {{-4.922, -16.386}, {-9.922, -16.386}, {-9.922, -1.386}, {12.383, -1.386}, {12.383, 35.546}}));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, extent = {{-100, -100}, {100, 100}}, radius = 25), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name")}));
end asdfa;

PI-Controller doesn't reach reference value with inverter and PMSM in Modelica

I'm trying to investigate the Modelica example Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMPM_VoltageSource
but I replaced the signalVoltage by an inverter and a PWM block signalPWM which is based on Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM. So instead of sine voltages I want to investigate PWM modulated voltages.
The problem is that the controller keeps increasing its output linearily because of the integrating part of the controller as it never reaches the reference value of the desired q-current. In addition it outputs strange values for voltageController.y[1] in the range of [24E3,...,150E3], which is probrably the problem.
The controller output:
and the current output:
Unfortunately I don't understand why the controller works fine with the sine voltages and doesnt with the PWM voltages.
Below is my main model:
model SMPM_INV_SineLoad "Test example: PermanentMagnetSynchronousInductionMachine fed by FOC"
extends Modelica.Icons.Example;
import Modelica.Constants.pi;
constant Integer m = 3 "Number of phases";
parameter Modelica.SIunits.Frequency f = 8000 "Switching frequency";
parameter Modelica.SIunits.AngularVelocity wRef = 30 "Desired speed of the PMSM";
parameter Modelica.SIunits.Current Idq[2] = {0, 10} "Desired d- and q-current";
parameter Modelica.SIunits.AngularVelocity wNominal = 2 * pi * smpmData.fsNominal / smpmData.p "Nominal speed";
parameter Modelica.SIunits.Torque TLoad = 5 "Nominal load torque";
parameter Modelica.SIunits.Inertia JLoad = 0.29 "Load's moment of inertia";
parameter Modelica.SIunits.Voltage VBat_2 = 100 "Half Battery Voltage";
Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_PermanentMagnet smpm(phiMechanical(start = 0, fixed = true), wMechanical(start = 0, fixed = true), useSupport = false, useThermalPort = false, p = smpmData.p, fsNominal = smpmData.fsNominal, Rs = smpmData.Rs, TsRef = smpmData.TsRef, Lszero = smpmData.Lszero, Lssigma = smpmData.Lssigma, Jr = smpmData.Jr, Js = smpmData.Js, frictionParameters = smpmData.frictionParameters, statorCoreParameters = smpmData.statorCoreParameters, strayLoadParameters = smpmData.strayLoadParameters, VsOpenCircuit = smpmData.VsOpenCircuit, Lmd = smpmData.Lmd, Lmq = smpmData.Lmq, useDamperCage = smpmData.useDamperCage, Lrsigmad = smpmData.Lrsigmad, Lrsigmaq = smpmData.Lrsigmaq, Rrd = smpmData.Rrd, Rrq = smpmData.Rrq, TrRef = smpmData.TrRef, permanentMagnetLossParameters = smpmData.permanentMagnetLossParameters, TsOperational = 293.15, alpha20s = smpmData.alpha20s, TrOperational = 293.15, alpha20r = smpmData.alpha20r) annotation(Placement(transformation(extent = {{-20, -50}, {0, -30}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(terminalConnection = "Y") annotation(Placement(transformation(extent = {{-20, -34}, {0, -14}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {20, -10}), visible = true));
Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J = JLoad) annotation(Placement(transformation(extent = {{50, -50}, {70, -30}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Electrical.MultiPhase.Sensors.CurrentSensor currentSensor(m = m) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-10, -10}), visible = true));
Modelica.Electrical.Machines.Utilities.VoltageController voltageController(p = smpm.p, Ld = smpm.Lssigma + smpm.Lmd, Lq = smpm.Lssigma + smpm.Lmq, Rs = Modelica.Electrical.Machines.Thermal.convertResistance(smpm.Rs, smpm.TsRef, smpm.alpha20s, smpm.TsOperational), fsNominal = smpm.fsNominal, VsOpenCircuit = smpm.VsOpenCircuit) annotation(Placement(transformation(extent = {{-50, 40}, {-30, 60}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Mechanics.Rotational.Sensors.TorqueSensor torqueSensor annotation(Placement(transformation(extent = {{10, 10}, {-10, -10}}, rotation = 180, origin = {40, -70}), visible = true));
Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {50, -10}), visible = true));
Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorDisplacementAngle(p = smpm.p) annotation(Placement(transformation(origin = {20, -50}, extent = {{-10, 10}, {10, -10}}, rotation = 270), visible = true));
Modelica.Electrical.Analog.Basic.Ground groundM annotation(Placement(transformation(origin = {-80, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 270), visible = true));
Modelica.Electrical.MultiPhase.Basic.Star starM(final m = m) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-60, -20}), visible = true));
Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = 180, origin = {-30, -20}), visible = true));
parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData smpmData(useDamperCage = false) annotation(Placement(transformation(extent = {{-20, -80}, {0, -60}}, origin = {-0, -10}, rotation = 0), visible = true));
Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor annotation(Placement(transformation(origin = {-10, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 270), visible = true));
Modelica.Mechanics.Rotational.Sources.SignTorque signTorque1(tau_constant = -TLoad, w0 = wNominal) annotation(Placement(visible = true, transformation(origin = {90, -50}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant id(k = Idq[1]) annotation(Placement(transformation(extent = {{-90, 60}, {-70, 80}}, origin = {-0, -10}, rotation = 0), visible = true));
SignalPWM signalPWM1[m](useConstantDutyCycle = false, f = f) annotation(Placement(visible = true, transformation(origin = {22.087, 64.88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Electrical.PowerConverters.DCAC.MultiPhase2Level multiPhase2Level1 annotation(Placement(visible = true, transformation(origin = {22.083, 116.565}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Electrical.Analog.Sources.ConstantVoltage U_n(V = VBat_2) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-30, 97.365}), visible = true));
Modelica.Electrical.Analog.Basic.Ground ground annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-50, 127.365}), visible = true));
Modelica.Electrical.Analog.Sources.ConstantVoltage U_p(V = VBat_2) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-30, 137.365}), visible = true));
Modelica.Blocks.Sources.Constant iq(k = Idq[2]) annotation(Placement(transformation(extent = {{-90, 20}, {-70, 40}}, origin = {0, -10}, rotation = 0), visible = true));
initial equation
smpm.is[1:2] = zeros(2);
equation
connect(terminalBox.plug_sn, smpm.plug_sn) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-16, -40}));
connect(terminalBox.plug_sp, smpm.plug_sp) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-4, -40}));
connect(smpm.flange, angleSensor.flange) annotation(Line(points = {{-6.667, -10}, {3.333, -10}, {3.333, 20}, {13.333, 20}}, visible = true, origin = {6.667, -40}, color = {64, 64, 64}));
connect(currentSensor.plug_n, terminalBox.plugSupply) annotation(Line(points = {{-10, -10}, {-10, -28}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(angleSensor.phi, voltageController.phi) annotation(Line(points = {{20, 11}, {20, 34}, {-34, 34}, {-34, 38}}, color = {1, 37, 163}, visible = true, origin = {0, -10}));
connect(currentSensor.i, voltageController.iActual) annotation(Line(points = {{-21, 0}, {-46, 0}, {-46, 38}}, color = {1, 37, 163}, visible = true, origin = {-0, -10}));
connect(inertiaLoad.flange_a, torqueSensor.flange_b) annotation(Line(points = {{50, -40}, {50, -60}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
connect(torqueSensor.flange_a, smpm.flange) annotation(Line(points = {{30, -60}, {30, -40}, {0, -40}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
connect(speedSensor.flange, smpm.flange) annotation(Line(points = {{23.333, 20}, {13.333, 20}, {13.333, -10}, {-26.667, -10}}, visible = true, origin = {26.667, -40}, color = {64, 64, 64}));
connect(rotorDisplacementAngle.flange, smpm.flange) annotation(Line(points = {{10, -40}, {0, -40}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
connect(rotorDisplacementAngle.plug_p, smpm.plug_sp) annotation(Line(points = {{14, -30}, {-4, -30}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(rotorDisplacementAngle.plug_n, smpm.plug_sn) annotation(Line(points = {{26, -30}, {26, -20}, {-16, -20}, {-16, -30}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(voltageQuasiRMSSensor.plug_p, currentSensor.plug_n) annotation(Line(points = {{-20, -10}, {-10, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(starM.plug_p, voltageQuasiRMSSensor.plug_n) annotation(Line(points = {{-50, -10}, {-40, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(groundM.p, starM.pin_n) annotation(Line(points = {{-70, -28}, {-70, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
connect(currentQuasiRMSSensor.plug_n, currentSensor.plug_p) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-10, 0}));
connect(inertiaLoad.flange_b, signTorque1.flange) annotation(Line(visible = true, origin = {75, -50}, points = {{-5, 0}, {5, 0}}, color = {64, 64, 64}));
connect(id.y, voltageController.id_rms) annotation(Line(points = {{-69, 70}, {-60, 70}, {-60, 56}, {-52, 56}}, color = {1, 37, 163}, visible = true, origin = {-0, -10}));
connect(voltageController.y[1:3], signalPWM1[1:3].dutyCycle) annotation(Line(visible = true, origin = {-16.728, 52.44}, points = {{-12.272, -12.44}, {-7.272, -12.44}, {-7.272, 12.44}, {26.815, 12.44}}, color = {1, 37, 163}));
connect(ground.p, U_n.p) annotation(Line(visible = true, origin = {-40, 112.78}, points = {{-10, 4.585}, {-10, 4.557}, {10, 4.557}, {10, -5.415}}, color = {10, 90, 224}));
connect(U_p.n, U_n.p) annotation(Line(visible = true, origin = {-30, 117.365}, points = {{0, 10}, {0, -10}}, color = {10, 90, 224}));
connect(U_n.n, multiPhase2Level1.dc_n) annotation(Line(visible = true, origin = {-15.583, 93.045}, points = {{-14.417, -5.68}, {-14.417, -10.68}, {0.583, -10.68}, {0.583, 13.52}, {27.666, 13.52}}, color = {10, 90, 224}));
connect(U_p.p, multiPhase2Level1.dc_p) annotation(Line(visible = true, origin = {-15.583, 141.045}, points = {{-14.417, 6.32}, {-14.417, 11.32}, {0.583, 11.32}, {0.583, -14.48}, {27.666, -14.48}}, color = {10, 90, 224}));
connect(signalPWM1[1:3].fire, multiPhase2Level1.fire_p[1:3]) annotation(Line(visible = true, origin = {16.085, 85.551}, points = {{0.002, -9.671}, {0.002, -4.671}, {-0.002, -4.671}, {-0.002, 19.014}}, color = {190, 52, 178}));
connect(signalPWM1[1:3].notFire, multiPhase2Level1.fire_n[1:3]) annotation(Line(visible = true, origin = {28.085, 85.551}, points = {{0.002, -9.671}, {0.002, -4.671}, {-0.002, -4.671}, {-0.002, 19.014}}, color = {190, 52, 178}));
connect(multiPhase2Level1.ac, currentQuasiRMSSensor.plug_p) annotation(Line(visible = true, origin = {22.417, 66.626}, points = {{9.666, 49.939}, {27.583, 49.939}, {27.583, -26.626}, {-32.417, -26.626}, {-32.417, -46.626}}, color = {10, 90, 224}));
connect(iq.y, voltageController.iq_rms) annotation(Line(visible = true, origin = {-62.25, 27}, points = {{-6.75, -7}, {-1.75, -7}, {-1.75, 7}, {10.25, 7}}, color = {1, 37, 163}));
annotation(experiment(StopTime = 2.0, Interval = 0.1), Diagram(coordinateSystem(extent = {{-200, -200}, {200, 200}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {10, 10})), Documentation(info = "<html>
<p>
A synchronous induction machine with permanent magnets accelerates a quadratic speed dependent load from standstill.
The rms values of d- and q-current in rotor fixed coordinate system are controlled by the voltageController,
and the output voltages fed to the machine. The result shows that the torque is influenced by the q-current,
whereas the stator voltage is influenced by the d-current.</p>
<p>
Default machine parameters of model SM_PermanentMagnet are used.
</p>
</html>"));
end SMPM_INV_SineLoad;
And the signalPWM model:
model SignalPWM "Generates a pulse width modulated (PWM) boolean fire signal"
extends Modelica.Electrical.PowerConverters.Icons.Control;
parameter Boolean useConstantDutyCycle = true "Enables constant duty cycle";
parameter Real constantDutyCycle = 0 "Constant duty cycle" annotation(Dialog(enable = useConstantDutyCycle));
parameter Modelica.SIunits.Frequency f = 1000 "Switching frequency";
parameter Modelica.SIunits.Time startTime = 0 "Start time";
Modelica.Blocks.Interfaces.RealInput dutyCycle if not useConstantDutyCycle "Duty cycle" annotation(Placement(transformation(extent = {{-140, -20}, {-100, 20}})));
Modelica.Blocks.Interfaces.BooleanOutput fire "Firing PWM signal" annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-60, 110})));
Modelica.Blocks.Interfaces.BooleanOutput notFire "Firing PWM signal" annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {60, 110})));
Modelica.Blocks.Sources.Constant const(final k = constantDutyCycle) if useConstantDutyCycle annotation(Placement(transformation(extent = {{-100, -60}, {-80, -40}})));
Modelica.Blocks.Nonlinear.Limiter limiter(uMax = 500000, uMin = -500000) annotation(Placement(transformation(extent = {{-60, -10}, {-40, 10}})));
Modelica.Blocks.Logical.Less greaterEqual annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, origin = {22, -8})));
Modelica.Blocks.Discrete.ZeroOrderHold zeroOrderHold(final startTime = startTime, final samplePeriod = 1 / f) annotation(Placement(transformation(extent = {{-30, -10}, {-10, 10}})));
Modelica.Blocks.Sources.SawTooth sawtooth(final period = 1 / f, final amplitude = 1000000, final nperiod = -1, final offset = -500000, final startTime = startTime) annotation(Placement(transformation(origin = {-50, -50}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Logical.Not inverse annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = 90, origin = {52, 20})));
equation
connect(const.y, limiter.u) annotation(Line(points = {{-79, -50}, {-70, -50}, {-70, 0}, {-62, 0}}, color = {0, 0, 127}));
connect(dutyCycle, limiter.u) annotation(Line(points = {{-120, 0}, {-62, 0}}, color = {0, 0, 127}));
connect(limiter.y, zeroOrderHold.u) annotation(Line(points = {{-39, 0}, {-32, 0}}, color = {0, 0, 127}));
connect(zeroOrderHold.y, greaterEqual.u2) annotation(Line(points = {{-9, 0}, {10, 0}}, color = {0, 0, 127}));
connect(sawtooth.y, greaterEqual.u1) annotation(Line(points = {{-39, -50}, {0, -50}, {0, -8}, {10, -8}}, color = {0, 0, 127}));
connect(greaterEqual.y, inverse.u) annotation(Line(points = {{33, -8}, {52, -8}, {52, 8}}, color = {255, 0, 255}));
connect(greaterEqual.y, fire) annotation(Line(points = {{33, -8}, {36, -8}, {36, 80}, {-60, 80}, {-60, 110}}, color = {255, 0, 255}));
connect(inverse.y, notFire) annotation(Line(points = {{52, 31}, {52, 80}, {60, 80}, {60, 110}}, color = {255, 0, 255}));
annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, initialScale = 0.1, grid = {10, 10}), graphics = {Line(visible = true, points = {{-100, 0}, {-98, 0}, {12, 0}}, color = {64, 64, 64}), Line(visible = true, points = {{-60, -22}, {-60, -64}, {44, -64}, {44, -36}}, color = {64, 64, 64}), Line(visible = true, points = {{-80, -16}, {-80, -20}, {-40, 20}, {-40, -20}, {-36, -16}}, color = {64, 64, 64}), Line(visible = true, points = {{-62, 0}, {-76, 4}, {-76, -4}, {-62, 0}}, color = {64, 64, 64}), Line(visible = true, points = {{44, -36}, {44, -36}, {40, -50}, {44, -50}, {48, -50}, {44, -36}}, color = {64, 64, 64}), Line(visible = true, points = {{20, -20}, {22, -20}, {24, -20}, {24, 20}, {44, 20}, {44, -20}, {64, -20}, {64, -16}}, color = {190, 53, 179}), Line(visible = true, points = {{-40, -16}, {-40, -20}, {0, 20}, {0, -20}, {4, -16}}, color = {64, 64, 64}), Line(visible = true, points = {{60, -20}, {62, -20}, {64, -20}, {64, 20}, {84, 20}, {84, -20}, {84, -20}, {88, -20}}, color = {190, 53, 179})}), Documentation(info = "<html>
<p>
This controller can be used both for DC/DC and AC/DC converters.
The signal input of the PWM controller is the duty cycle; the duty cycle is the ratio of the on time
to the switching period. The output firing signal is strictly determined by the actual duty cycle, indicated as <code>d</code> in Fig. 1.
</p>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
<caption align=\"bottom\"><b>Fig. 1:</b> Firing (<code>fire</code>) and inverse firing (<code>notFire</code>) signal of PWM control; <code>d</code> = duty cycle; <code>f</code> = switching frequency </caption>
<tr>
<td>
<img src=\"modelica://Modelica/Resources/Images/Electrical/PowerConverters/dutyCycle.png\">
</td>
</tr>
</table>
<p>
The firing signal is generated by comparing the sampled duty cycle input with a periodic saw tooth signal [Williams2006].
</p>
</html>"));
end SignalPWM;
Edit: I already lowered the desired q-current from Idq={0,84} Ato Idq={0,10} A and the load from TLoad = 120 Nm to TLoad = 5 Nm and still get those insanely high voltage signals from the voltageController.
Has someone may an idea how to fix the problem with the controller so I get proper results for the simulation?
Why is it not able to reach the reference value as in the MSL example? Is the PWM block that big of a problem?
This behaviour of the simulation confuses me because I work with a real motor and a PWM control and it works fine with a similar configuration..
Any help would be highly appreciated!
Original Answer
With a voltage of ±200V and a load of 120Nm its simply not possible to obtain the demanded currents.
In contrast to the original MSL example you use a sign torque with 120Nm as load.
If you use that in the original MSL example, you will notice that the machine
keeps accelerating and that the required voltage grows without bounds (plot e.g. smpm.plug_sp.pin[1].v to see that).
In your example the voltage is limited to 200V. The demanded currents of -53A and 84.6A are not obtained,
but the machine still generates a torque of 127Nm, which lets the machine accelerate.
With increasing speed the required voltages increase also for a certain torque / current demand - but in your example the actual voltage is limited. Therefore the set currents are never reached.
What you can consider:
increase the available voltage
(but for the current setup you need unrealistic high values of several thousand volts)
demand lower currents
(You can set Id on 0 anyway, as you have a machine with Ld=Lq, so only Iq produces torque and Id is used for field weakening)
make your current controllers aware of the voltage limit
(use e.g. Modelica.Blocks.Continuous.LimPID for that, which contains anti-windup already)
Updated Answer
The problem lies in your PWM computation.
I rebuilt the example with the original SignalPWM block from the MSL and a VoltageToDutyCycle component.
In the screenshot below the simulation results of the new model with f=14kHz are compared with the MSL version with ideal voltage supply. The screenshot shows the controller output (like in your question) and Iq.
The results were computed with the package below. It contains
a partial model for all common components and variables
an example with PWM and inverter
an example with ideal continuous voltage supply
Note that the hints from my original answer remain, if the maximum voltage is reached. The controllers are not aware of the voltage limit, which can lead to integrator windup problems.
package SMPM
partial model SMPM_base "Test example: PermanentMagnetSynchronousInductionMachine fed by FOC"
extends Modelica.Icons.Example;
import Modelica.Constants.pi;
constant Integer m=3 "Number of phases";
parameter Modelica.SIunits.Frequency f=14000 "Switching frequency";
parameter Modelica.SIunits.AngularVelocity wRef=30 "Desired speed of the PMSM";
parameter Modelica.SIunits.Current Idq[2]={0,10} "Desired d- and q-current";
parameter Modelica.SIunits.AngularVelocity wNominal=2*pi*smpmData.fsNominal/smpmData.p "Nominal speed";
parameter Modelica.SIunits.Torque TLoad=5 "Nominal load torque";
parameter Modelica.SIunits.Inertia JLoad=0.29 "Load's moment of inertia";
parameter Modelica.SIunits.Voltage VBat_2=100 "Half Battery Voltage";
final parameter Real Vmax=VBat_2*sqrt(2);
Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_PermanentMagnet smpm(
phiMechanical(start=0, fixed=true),
wMechanical(start=0, fixed=true),
useSupport=false,
useThermalPort=false,
p=smpmData.p,
fsNominal=smpmData.fsNominal,
Rs=smpmData.Rs,
TsRef=smpmData.TsRef,
Lszero=smpmData.Lszero,
Lssigma=smpmData.Lssigma,
Jr=smpmData.Jr,
Js=smpmData.Js,
frictionParameters=smpmData.frictionParameters,
statorCoreParameters=smpmData.statorCoreParameters,
strayLoadParameters=smpmData.strayLoadParameters,
VsOpenCircuit=smpmData.VsOpenCircuit,
Lmd=smpmData.Lmd,
Lmq=smpmData.Lmq,
useDamperCage=smpmData.useDamperCage,
Lrsigmad=smpmData.Lrsigmad,
Lrsigmaq=smpmData.Lrsigmaq,
Rrd=smpmData.Rrd,
Rrq=smpmData.Rrq,
TrRef=smpmData.TrRef,
permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
TsOperational=293.15,
alpha20s=smpmData.alpha20s,
TrOperational=293.15,
alpha20r=smpmData.alpha20r) annotation (Placement(transformation(
extent={{-20,-50},{0,-30}},
origin={40,-50},
rotation=0), visible=true));
Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(terminalConnection="Y") annotation (Placement(transformation(
extent={{-20,-34},{0,-14}},
origin={40,-50},
rotation=0), visible=true));
Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={60,-80}), visible=true));
Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J=JLoad) annotation (Placement(transformation(
extent={{50,-50},{70,-30}},
origin={60,-50},
rotation=0), visible=true));
Modelica.Electrical.MultiPhase.Sensors.CurrentSensor currentSensor(m=m) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={30,-20}), visible=true));
Modelica.Electrical.Machines.Utilities.VoltageController voltageController(
p=smpm.p,
Ld=smpm.Lssigma + smpm.Lmd,
Lq=smpm.Lssigma + smpm.Lmq,
Rs=Modelica.Electrical.Machines.Thermal.convertResistance(
smpm.Rs,
smpm.TsRef,
smpm.alpha20s,
smpm.TsOperational),
fsNominal=smpm.fsNominal,
VsOpenCircuit=smpm.VsOpenCircuit) annotation (Placement(transformation(
extent={{-50,40},{-30,60}},
origin={-60,-10},
rotation=0), visible=true));
Modelica.Mechanics.Rotational.Sensors.MultiSensor multiSensor annotation (Placement(transformation(
extent={{10,10},{-10,-10}},
rotation=180,
origin={90,-90}), visible=true));
Modelica.Electrical.Analog.Basic.Ground groundM annotation (Placement(transformation(
origin={-60,-60},
extent={{-10,-10},{10,10}},
rotation=270), visible=true));
Modelica.Electrical.MultiPhase.Basic.Star starM(final m=m) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-30,-60}), visible=true));
Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=180,
origin={-10,-60}), visible=true));
parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData smpmData(useDamperCage=false)
annotation (Placement(transformation(extent={{140,100},{160,120}}, rotation=0), visible=true));
Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor annotation (Placement(transformation(
origin={30,10},
extent={{-10,-10},{10,10}},
rotation=270), visible=true));
Modelica.Mechanics.Rotational.Sources.SignTorque signTorque1(tau_constant=-TLoad, w0=wNominal) annotation (Placement(visible=true,
transformation(
origin={150,-90},
extent={{10,-10},{-10,10}},
rotation=0)));
Modelica.Blocks.Sources.Constant id(k=Idq[1])
annotation (Placement(transformation(extent={{-160,50},{-140,70}}, rotation=0), visible=true));
Modelica.Blocks.Sources.Constant iq(k=Idq[2])
annotation (Placement(transformation(extent={{-160,0},{-140,20}}, rotation=0), visible=true));
Modelica.Electrical.MultiPhase.Sensors.VoltageSensor voltageSensor annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=180,
origin={-10,-88}), visible=true));
Modelica.Blocks.Math.Mean meanVoltage(f=f/4) annotation (Placement(transformation(extent={{-30,-120},{-50,-100}})));
initial equation
smpm.is[1:2] = zeros(2);
equation
connect(terminalBox.plug_sn, smpm.plug_sn)
annotation (Line(
points={{24,-80},{24,-80}},
color={0,0,255}));
connect(terminalBox.plug_sp, smpm.plug_sp)
annotation (Line(
points={{0,0},{0,0}},
color={0,0,255},
origin={36,-80}));
connect(starM.plug_p, voltageQuasiRMSSensor.plug_n)
annotation (Line(
points={{-50,-10},{-50,-10}},
color={10,90,224},
origin={30,-50}));
connect(voltageSensor.plug_n, voltageQuasiRMSSensor.plug_n) annotation (Line(points={{-20,-88},{-20,-60}}, color={0,0,255}));
connect(meanVoltage.u, voltageSensor.v[1]) annotation (Line(points={{-28,-110},{-10,-110},{-10,-98.3333}}, color={0,0,127}));
connect(angleSensor.flange, smpm.flange) annotation (Line(points={{60,-90},{40,-90}}, color={0,0,0}));
connect(smpm.flange, multiSensor.flange_a) annotation (Line(points={{40,-90},{80,-90}}, color={0,0,0}));
connect(voltageController.phi, angleSensor.phi) annotation (Line(points={{-94,28},{-94,-6},{60,-6},{60,-69}}, color={0,0,127}));
connect(id.y, voltageController.id_rms) annotation (Line(points={{-139,60},{-120,60},{-120,46},{-112,46}}, color={0,0,127}));
connect(iq.y, voltageController.iq_rms) annotation (Line(points={{-139,10},{-120,10},{-120,34},{-112,34}}, color={0,0,127}));
connect(voltageController.iActual, currentSensor.i) annotation (Line(points={{-106,28},{-106,-20},{19,-20}}, color={0,0,127}));
connect(voltageQuasiRMSSensor.plug_p, terminalBox.plugSupply)
annotation (Line(points={{0,-60},{30,-60},{30,-78}}, color={0,0,255}));
connect(voltageSensor.plug_p, terminalBox.plugSupply)
annotation (Line(points={{0,-88},{10,-88},{10,-60},{30,-60},{30,-78}}, color={0,0,255}));
connect(currentSensor.plug_n, terminalBox.plugSupply) annotation (Line(points={{30,-30},{30,-78}}, color={0,0,255}));
connect(multiSensor.flange_b, inertiaLoad.flange_a) annotation (Line(points={{100,-90},{110,-90}}, color={0,0,0}));
connect(inertiaLoad.flange_b, signTorque1.flange) annotation (Line(points={{130,-90},{140,-90}}, color={0,0,0}));
connect(starM.pin_n, groundM.p) annotation (Line(points={{-40,-60},{-50,-60}}, color={0,0,255}));
connect(currentQuasiRMSSensor.plug_n, currentSensor.plug_p) annotation (Line(points={{30,0},{30,-10}}, color={0,0,255}));
annotation (
experiment(
StopTime=0.2,
Interval=0.00001,
__Dymola_Algorithm="Dassl"),
Diagram(coordinateSystem(extent={{-180,-140},{180,140}}, preserveAspectRatio=true)));
end SMPM_base;
model SMPM_PWM
extends SMPM_base;
Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM pwm[m](each useConstantDutyCycle=false, each f=f)
annotation (Placement(visible=true, transformation(extent={{-20,30},{0,50}}, rotation=0)));
Modelica.Electrical.PowerConverters.DCAC.MultiPhase2Level multiPhase2Level
annotation (Placement(visible=true, transformation(extent={{-20,90},{0,110}}, rotation=0)));
Modelica.Electrical.PowerConverters.DCDC.Control.VoltageToDutyCycle voltageToDutyCycle[3](
each useBipolarVoltage=true,
each useConstantMaximumVoltage=true,
each vMax=VBat_2) annotation (Placement(transformation(extent={{-60,30},{-40,50}})));
Modelica.Electrical.Analog.Sources.ConstantVoltage U_n(V=VBat_2) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-60,80}), visible=true));
Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-80,100}), visible=true));
Modelica.Electrical.Analog.Sources.ConstantVoltage U_p(V=VBat_2) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-60,120}), visible=true));
Modelica.Blocks.Math.Mean meanIq(f=f/4) annotation (Placement(transformation(extent={{-120,-60},{-140,-40}})));
equation
connect(pwm[1:3].fire,multiPhase2Level. fire_p[1:3]) annotation (Line(
visible=true,
origin={-15.915,71.551},
points={{-0.085,-20.551},{-0.085,17.7823}},
color={190,52,178}));
connect(pwm[1:3].notFire,multiPhase2Level. fire_n[1:3]) annotation (Line(
visible=true,
origin={-3.915,71.551},
points={{-0.085,-20.551},{-0.085,17.7823}},
color={190,52,178}));
connect(U_p.p,multiPhase2Level. dc_p) annotation (Line(points={{-60,130},{-40,130},{-40,106},{-20,106}}, color={0,0,255}));
connect(U_n.n,multiPhase2Level. dc_n) annotation (Line(points={{-60,70},{-40,70},{-40,94},{-20,94}}, color={0,0,255}));
connect(voltageToDutyCycle.dutyCycle,pwm. dutyCycle) annotation (Line(points={{-39,40},{-22,40}}, color={0,0,127}));
connect(multiPhase2Level.ac, currentQuasiRMSSensor.plug_p)
annotation (Line(points={{0,100},{30,100},{30,20}}, color={0,0,255}));
connect(voltageController.y,voltageToDutyCycle. v) annotation (Line(points={{-89,40},{-62,40}}, color={0,0,127}));
connect(ground.p,U_n. p) annotation (Line(points={{-70,100},{-60,100},{-60,90}}, color={0,0,255}));
connect(U_p.n,U_n. p) annotation (Line(points={{-60,110},{-60,90}}, color={0,0,255}));
connect(meanIq.u, currentSensor.i[2]) annotation (Line(points={{-118,-50},{-106,-50},{-106,-20},{19,-20}}, color={0,0,127}));
annotation (experiment(
StopTime=0.2,
Interval=0.00001,
__Dymola_Algorithm="Dassl"));
end SMPM_PWM;
model SMPM_Continuous
extends SMPM_base;
Modelica.Electrical.MultiPhase.Basic.Star star(final m=m) annotation (
Placement(transformation(extent={{10,-10},{-10,10}},
rotation=270,
origin={30,70})));
Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(
transformation(
origin={30,100},
extent={{-10,-10},{10,10}},
rotation=180)));
Modelica.Electrical.MultiPhase.Sources.SignalVoltage signalVoltage1(final m=m)
annotation (Placement(transformation(
origin={30,40},
extent={{10,10},{-10,-10}},
rotation=270)));
equation
connect(star.pin_n,ground. p)
annotation (Line(points={{30,80},{30,90}}, color={0,0,255}));
connect(star.plug_p, signalVoltage1.plug_n) annotation (Line(points={{30,60},{30,50}}, color={0,0,255}));
connect(signalVoltage1.plug_p, currentQuasiRMSSensor.plug_p) annotation (Line(points={{30,30},{30,20}}, color={0,0,255}));
connect(voltageController.y, signalVoltage1.v) annotation (Line(points={{-89,40},{18,40}}, color={0,0,127}));
annotation (
experiment(StopTime=0.2, __Dymola_Algorithm="Dassl"));
end SMPM_Continuous;
annotation(uses(Modelica(version="3.2.3")));
end SMPM;

Wrong simulation results when connecting an inverter with a smpm in Modelica

I'm using SystemModeler from Wolfram to investigate the system behaviour of an inverter connected to a permanent magnet synchronous machine.
Unfortunately I get wrong simulation results eventhough I only used components from the Modelica Standard Library.
I tried several settings so far with my model below.
model InverterSMPM
import Modelica.Constants.pi;
parameter Integer m = 3 "Number of phases";
parameter Modelica.SIunits.Frequency f = 1000 "Switching frequency";
parameter Modelica.SIunits.Frequency f1 = 50 "Fundamental wave AC frequency";
parameter Modelica.SIunits.Torque TLoad = 181.4 "Nominal load torque";
parameter Modelica.SIunits.Inertia JLoad = 0.29 "Load's moment of inertia";
Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage_n(V = 50) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-105, 4}), visible = true));
Modelica.Electrical.PowerConverters.DCAC.MultiPhase2Level inverter(useHeatPort = false, m = m) annotation(Placement(transformation(extent = {{-50, 20}, {-30, 40}}, origin = {-35, -6}, rotation = 0), visible = true));
Modelica.Electrical.Analog.Basic.Ground ground annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-125, 34}), visible = true));
Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM signalPWM[m](each useConstantDutyCycle = false, each f = f) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, origin = {-75, -26}, rotation = 0), visible = true));
Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage_p(V = 50) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-105, 44}), visible = true));
Modelica.Blocks.Sources.Sine sine[m](phase = -Modelica.Electrical.MultiPhase.Functions.symmetricOrientation(m), startTime = zeros(m), amplitude = fill(0.5, m), offset = fill(0.5, m), freqHz = fill(f1, m)) annotation(Placement(transformation(extent = {{-30, -64}, {-50, -44}}, origin = {-35, -6}, rotation = 0), visible = true));
Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_PermanentMagnet smpm(Jr = 0.29, p = 8, fsNominal = f1, VsOpenCircuit = 100, TsOperational = 293.15, TrOperational = 293.15, Rs = 4.7, TsRef = 293.15, alpha20s = Modelica.Electrical.Machines.Thermal.Constants.alpha20Aluminium, Lssigma = 0.001, Lmd = 0.0133, Lmq = 0.0133, useDamperCage = false) annotation(Placement(visible = true, transformation(origin = {5, -15}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox1(terminalConnection = "Y") annotation(Placement(visible = true, transformation(origin = {5, 2.209}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Inertia inertia1(J = JLoad) annotation(Placement(visible = true, transformation(origin = {35, -15}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStep1(stepTorque = -TLoad, offsetTorque = 0, startTime = 2, useSupport = false) annotation(Placement(visible = true, transformation(origin = {76.657, -15}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor1 annotation(Placement(visible = true, transformation(origin = {35, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(constantVoltage_p.n, constantVoltage_n.p) annotation(Line(points = {{-70, 40}, {-70, 20}}, color = {10, 90, 224}, visible = true, origin = {-35, -6}));
connect(constantVoltage_p.p, inverter.dc_p) annotation(Line(points = {{-70, 60}, {-50, 60}, {-50, 40}}, color = {10, 90, 224}, visible = true, origin = {-35, -6}));
connect(constantVoltage_n.n, inverter.dc_n) annotation(Line(points = {{-70, -0}, {-50, 0}, {-50, 20}}, color = {10, 90, 224}, visible = true, origin = {-35, -6}));
connect(ground.p, constantVoltage_p.n) annotation(Line(points = {{-90, 30}, {-70, 30}, {-70, 40}}, color = {10, 90, 224}, visible = true, origin = {-35, -6}));
connect(sine.y, signalPWM.dutyCycle) annotation(Line(points = {{-51, -54}, {-60, -54}, {-60, -20}, {-52, -20}}, color = {1, 37, 163}, visible = true, origin = {-35, -6}));
connect(signalPWM.fire, inverter.fire_p) annotation(Line(points = {{-46, -9}, {-46, 18}}, color = {190, 52, 178}, visible = true, origin = {-35, -6}));
connect(signalPWM.notFire, inverter.fire_n) annotation(Line(points = {{-34, -9}, {-34, 18}}, color = {190, 52, 178}, visible = true, origin = {-35, -6}));
connect(terminalBox1.plug_sn, smpm.plug_sn) annotation(Line(visible = true, origin = {-1, -4.396}, points = {{0, 0.604}, {0, -0.604}}, color = {10, 90, 224}));
connect(terminalBox1.plug_sp, smpm.plug_sp) annotation(Line(visible = true, origin = {11, -4.396}, points = {{0, 0.604}, {0, -0.604}}, color = {10, 90, 224}));
connect(smpm.flange, inertia1.flange_a) annotation(Line(visible = true, origin = {20, -15}, points = {{-5, 0}, {5, 0}}, color = {64, 64, 64}));
connect(inertia1.flange_b, torqueStep1.flange) annotation(Line(visible = true, origin = {55.828, -15}, points = {{-10.828, 0}, {10.828, 0}}, color = {64, 64, 64}));
connect(speedSensor1.flange, smpm.flange) annotation(Line(visible = true, origin = {20, 2.5}, points = {{5, 17.5}, {0, 17.5}, {0, -17.5}, {-5, -17.5}}, color = {64, 64, 64}));
connect(inverter.ac, terminalBox1.plugSupply) annotation(Line(visible = true, origin = {-18.333, 15.403}, points = {{-46.667, 8.597}, {23.333, 8.597}, {23.333, -17.194}}, color = {10, 90, 224}));
annotation(experiment(StartTime = 0.00, StopTime = 5, NumberOfIntervals = 5000, __Wolfram_Algorithm = "dassl", Tolerance = 1e-6, __Wolfram_SynchronizeWithRealTime = false), Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})));
end InverterSMPM;
One setting is: JLoad=0 and TLoad=0
I would expect the motor to run freely and with idle speed. Instead the speed sensor shows a sine wave with amplitudes [-0.46;0.46]
Another setting: JLoad=0.29 and TLoad=-180
The motor has speed=0 and decreases and gets negative values from t=2s when I apply the torque step.
Can someone may tell me what I'm doing wrong with my model and why the simulation results are wrong?
I also tried some examples from the library but they never use an inverter together with a motor. But I want to investigate on the PWM and don't want to work with ideal sine voltages and currents as in the examples...
Thank you for any help!!
What you are trying to do in you model is, to let a synchronous machine operate at nominal electrical frequency directly from standstill. This will make the machine "fall out of step", which is the reason for the machine not to operate as you would expect, but just oscillate in a seemingly random manner.
Try to reduce sine[*].freqHz to fill(0.01*f1, m) and you will see that there it will - after some oscillations - start to operate at one percent of its nominal frequency. It's just that the machine cannot overcome the oscillations for the jump to the nominal frequency.
There are multiple possibilities to work around that issue:
Initialize the machine properly: This can be done by setting at least smpm.wMechancial.start and smpm.phiMechancial.start to the correct values. Additionally it would be good to also initialize the phase currents correctly. This can be pretty tedious to do. But gives the advantage that you don't have to ramp up the speed.
It's likely easier to copy parts of the example Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMPM_Inverter, where a voltage-frequency-controller is used to start the machine.
Many synchronous machines are actually controlled (e.g. by field-orientation or direct-torque control). For this some clues can be taken from Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMPM_CurrentSource and Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMPM_VoltageSource.
Additionally I would suggest to first try to get your example running with a continuous inverter like in Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMPM_Inverter. If that works asexpected, move on the switched one.
Some things that look suspicious to me:
smpm.Rs seems pretty big to me with 4.7 Ohms especially when considering the inertias smpm.Jr (with 0.29 kg.m2) and inertia1.J (with 0.29 kg.m2).
For testing, try to increase the switching frequency above 1kHz. This is a bit low for a fundamental wave frequency of 50Hz (although it should work).

How do I resolve an error pertaining to a variable not located within my OpenModelica Model?

I'm currently working on building a heat recovery steam generator and have just started building from the ThermoPower Library and connected an evaporator to the economizer.
When trying to simulate, an error occurs within the OMEdit Simulator:
division by zero at time 0, (a=-458389.9207317767) / (b=0), where divisor b expression is: 8.75988806777792 * Economizer.metalTube.Am * Economizer.metalTube.rhomcm * /Real/(Economizer.metalTube.Nt)
How exactly do I trouble shoot this error if I cannot define or locate the needed variables that are causing b=0?
Please let me know what you think about this. Your time and energy is greatly appreciated.
I'm not the best at debugging my models but I have an idea and I have some confusion trouble shooting this. My initial confusion was to verify which variable resulted in b=0. However, upon inspection I noticed how the variable Economizer.metalTube.Nt, Economizer.metalTube.Am did not exist within my the economizer class. I knew it had to be rooted into my class through extensions and partial classes and tried to define these "missing" variables in the text view of my economizer model, but this simply resulted in an error saying:
[1] 11:46:14 Translation Error
[ThermoPower_HRSG_Econ_Evap: 68:3-92:112]: Variable Economizer: In modifier (Nt = 3), class or component Nt not found in .
If you have any advice and/or recommendations please leave a comment below!
///UPDATE: Moving forward after what I've learned from others and implementing their suggestions.///
After reading what you and others have said about my issue on OpenModelica I have come to a better understanding of the situation. However, I am still confused as to what is the best way to move forward to debug my model.
So my "Economizer" model, or a heat exchanger located in ThermoPower.Examples.RankineCycles.Models.HE, was having the error associated with the divisor "b=0".
When debugging, the error hyperlinked me to the package "thermal" which pointed me towards the line of code that is being flagged:
(L/Nw*Nt)*rhomcm*Am*der(Tvol) = int.Q + ext.Q "Energy balance";
This line of code is also being used in the Economizer HE class (ThermoPower.Examples.RankineCycles.Models.HE). Here in the HE.mo, the same flagged line of code from the thermal package that is causing the error is also located here. What's making my model cause the divider "b=0" are the variables: L, Nw, Nt, Am and Tvol. These variables are not defined/found in the model I am using when defining system parameters.
What's confusing for me as a OpenModelica user is that those variables just mentioned above (L, Nw, Nt, Am and Tvol) are coded/defined in the ThermoPower.Examples.RankineCycles.Models.HE text view of the component, but when I try to define/add them into my Economizer.mo belonging to the ThermoPower.Examples.RankineCycles.Models.HE class, errors are triggered claiming:
[ThermoPower_HRSG_Econ_Evap: 69:3-94:112]: Variable Economizer: In modifier
(Nt = 1), class or component Nt not found in
<ThermoPower.Examples.RankineCycle.Models.HE$Economizer>.
Essentially, the errors causing the divider "b=0" are located in the base class of the economizer I am using. However, due to the absence or in-ability to define these needed variables within my Economizer.mo model, the equation:
(L/Nw*Nt)*rhomcm*Am*der(Tvol) = int.Q + ext.Q "Energy balance";
Is now being violated. How do I fix this issue properly?
///UPDATE: CODE PROVIDED BELOW///
model ThermoPower_HRSG_Econ_Evap
ThermoPower.Gas.SourceMassFlow Source_FlueGas(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 331.59 + 273.15,
p0 = 101325,
w0 = 169.755) annotation(
Placement(visible = true, transformation(origin = {-92, 30}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SourceMassFlow Source_Steam(
T = 46.45 + 273.15,
h = 203.22e3,
p0 = 80e5,
use_T = true,
w0 = 21.5) annotation(
Placement(visible = true, transformation(origin = {-10, 90}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SensT sensT_WaterIn_Econ annotation(
Placement(visible = true, transformation(origin = {4, 60}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
ThermoPower.Water.SensT sensT_WaterOut_Econ annotation(
Placement(visible = true, transformation(origin = {4, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
ThermoPower.Gas.SensT sensT_ExhaustIn_Econ(
redeclare package Medium = ThermoPower.Media.FlueGas) annotation(
Placement(visible = true, transformation(origin = {-50, 34}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SensT sensT_ExhaustOut_Econ(
redeclare package Medium = ThermoPower.Media.FlueGas) annotation(
Placement(visible = true, transformation(origin = {50, 34}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
inner ThermoPower.System system annotation(
Placement(visible = true, transformation(origin = {-90, 90}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SinkPressure Sink_FlueGas(
redeclare package Medium = ThermoPower.Media.FlueGas,
p0 = 101325) annotation(
Placement(visible = true, transformation(origin = {94, -70}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SinkPressure Sink_Steam(
p0 = 80e5) annotation(
Placement(visible = true, transformation(origin = {10, -90}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Examples.HRB.Models.Evaporator Evaporator(
cm = 480,
exchSurface = 2.752,
fluidNomFlowRate = 21.5,
fluidNomPressure = 8e+06,
fluidVol = 0.01376,
gamma = 85,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
metalVol = 0.01376,
rhom(displayUnit = "kg/m3") = 8055,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {0, -50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SensT sensT_ExhaustOut_Evap(
redeclare package Medium = ThermoPower.Media.FlueGas) annotation(
Placement(visible = true, transformation(origin = {50, -66}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Continuous.FirstOrder VoidFractionSensor annotation(
Placement(visible = true, transformation(origin = {53, -43}, extent =
{{-5, -5}, {5, 5}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput VoidFraction annotation(
Placement(visible = true, transformation(origin = {110, -42}, extent =
{{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110,
-42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Examples.RankineCycle.Models.HE Economizer(
FFtype_G = ThermoPower.Choices.Flow1D.FFtypes.OpPoint,
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.Liquid,
N_F = 6,
N_G = 6,
Tstart_G = 604.74,
Tstart_M = 573.15, counterCurrent = true,
exchSurface_F = 2.752,
exchSurface_G = 2.752,
extSurfaceTub = 5.504,
fluidNomFlowRate = 21.5,
fluidNomPressure = 8e+06,
fluidVol = 0.01376,
gamma_F = 3000,
gamma_G = 30,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
lambda = 19.8,
metalVol = 0.01376,
rhomcm = 8055 * 480,
rhonom_F(displayUnit = "kg/m3") = 997,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {0, 30}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
equation
connect(Economizer.gasOut, sensT_ExhaustOut_Econ.inlet) annotation(
Line(points = {{10, 30}, {44, 30}, {44, 30}, {44, 30}}, color = {159, 159,
223}));
connect(sensT_ExhaustIn_Econ.outlet, Economizer.gasIn) annotation(
Line(points = {{-44, 30}, {-10, 30}, {-10, 30}, {-10, 30}}, color = {159,
159, 223}));
connect(Economizer.waterOut, sensT_WaterOut_Econ.inlet) annotation(
Line(points = {{0, 20}, {0, 20}, {0, 6}, {0, 6}}, color = {0, 0, 255}));
connect(sensT_WaterIn_Econ.outlet, Economizer.waterIn) annotation(
Line(points = {{0, 54}, {0, 54}, {0, 40}, {0, 40}}, color = {0, 0, 255}));
connect(VoidFractionSensor.y, VoidFraction) annotation(
Line(points = {{58, -42}, {104, -42}, {104, -42}, {110, -42}}, color = {0,
0, 127}));
connect(Evaporator.voidFraction, VoidFractionSensor.u) annotation(
Line(points = {{10, -44}, {46, -44}, {46, -42}, {46, -42}}, color = {0, 0,
127}));
connect(sensT_ExhaustOut_Evap.outlet, Sink_FlueGas.flange) annotation(
Line(points = {{56, -70}, {70, -70}, {70, -70}, {84, -70}, {84, -70}, {84,
-70}}, color = {159, 159, 223}));
connect(Evaporator.gasOut, sensT_ExhaustOut_Evap.inlet) annotation(
Line(points = {{10, -50}, {26, -50}, {26, -70}, {44, -70}}, color = {159,
159, 223}));
connect(sensT_ExhaustOut_Econ.outlet, Evaporator.gasIn) annotation(
Line(points = {{56, 30}, {68, 30}, {68, -20}, {-50, -20}, {-50, -20},
{-70, -20}, {-70, -50}, {-10, -50}, {-10, -50}}, color = {159, 159,
223}));
connect(sensT_WaterOut_Econ.outlet, Evaporator.waterIn) annotation(
Line(points = {{0, -6}, {0, -40}}, color = {0, 0, 255}));
connect(Evaporator.waterOut, Sink_Steam.flange) annotation(
Line(points = {{0, -60}, {0, -90}}, color = {0, 0, 255}));
connect(Source_FlueGas.flange, sensT_ExhaustIn_Econ.inlet) annotation(
Line(points = {{-82, 30}, {-56, 30}}, color = {159, 159, 223}));
connect(Source_Steam.flange, sensT_WaterIn_Econ.inlet) annotation(
Line(points = {{0, 90}, {0, 66}}, color = {0, 0, 255}));
annotation(
uses(ThermoPower(version = "3.1"), Modelica(version = "3.2.3")));end
ThermoPower_HRSG_Econ_Evap;

Modelica spring-pendulum

I want to model a simple "spring-pendulum" in modelica:
model Pendulum
parameter Boolean animation=true "= true, if animation shall be enabled";
inner Modelica.Mechanics.MultiBody.World world(axisLength=0.6)
Modelica.Mechanics.MultiBody.Parts.Body body1(
m=1,
animation=animation,
I_11=1,
I_22=1,
I_33=1,
r_CM={0,0,0},
cylinderDiameter=0.05,
sphereDiameter=0.2)
Modelica.Mechanics.MultiBody.Forces.Spring spring1(
coilWidth=0.01,
numberOfWindings=5,
c=20,
s_unstretched=0.2) ;
Modelica.Mechanics.MultiBody.Joints.Revolute revolute(phi(fixed=true), w(
fixed=true));
equation
connect(world.frame_b, revolute.frame_a)
connect(spring1.frame_a, revolute.frame_a)
connect(spring1.frame_b, body1.frame_a)
connect(revolute.frame_b, body1.frame_a
end Pendulum;
Trying to simulate the simulation fail - no error message.
Do i need a revolulte for a spring-pendulum? Thank you very much for your help!
Not exactly sure of what you're trying to model. If you make a drawing of your system you'll see that it won't represent what you're trying to model (I think).
Here's a pendulum with a spring:
model pendulum2
inner Modelica.Mechanics.MultiBody.World world annotation(Placement(visible = true, transformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Joints.Revolute revolute annotation(Placement(visible = true, transformation(origin = {-41.539, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Joints.Prismatic prismatic(s.start = .5) annotation(Placement(visible = true, transformation(origin = {-10, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Parts.Body body annotation(Placement(visible = true, transformation(origin = {25, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Forces.Spring spring(c = 100, s_unstretched = .5) annotation(Placement(visible = true, transformation(origin = {-10, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(spring.frame_b, prismatic.frame_b) annotation(Line(visible = true, origin = {0, 10}, points = {{0, 10}, {0, -10}}));
connect(spring.frame_a, prismatic.frame_a) annotation(Line(visible = true, origin = {-20, 10}, points = {{0, 10}, {0, -10}}));
connect(prismatic.frame_b, body.frame_a) annotation(Line(visible = true, origin = {7.5, 0}, points = {{-7.5, -0}, {7.5, 0}}));
connect(revolute.frame_b, prismatic.frame_a) annotation(Line(visible = true, origin = {-25.77, 0}, points = {{-5.77, 0}, {5.77, 0}}));
connect(world.frame_b, revolute.frame_a) annotation(Line(visible = true, origin = {-60.77, 0}, points = {{-9.23, 0}, {9.23, 0}}));
annotation(Diagram(coordinateSystem(extent = {{-148.5, -105}, {148.5, 105}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})));
end pendulum2;