From 01c3f90f1b0050045008122c15153008b029a03b Mon Sep 17 00:00:00 2001 From: Anton Haumer Date: Wed, 14 Sep 2022 17:02:48 +0200 Subject: [PATCH] fix #4030 --- .../SynchronousMachines/SMPM_NoLoad.mo | 23 ++++++++++++------- .../Electrical/Machines/Sensors/HallSensor.mo | 2 +- .../SMPM_NoLoad/comparisonSignals.txt | 6 ++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Modelica/Electrical/Machines/Examples/SynchronousMachines/SMPM_NoLoad.mo b/Modelica/Electrical/Machines/Examples/SynchronousMachines/SMPM_NoLoad.mo index 16df69f492..30e2be149f 100644 --- a/Modelica/Electrical/Machines/Examples/SynchronousMachines/SMPM_NoLoad.mo +++ b/Modelica/Electrical/Machines/Examples/SynchronousMachines/SMPM_NoLoad.mo @@ -55,10 +55,16 @@ model SMPM_NoLoad "SMPM at no-load" transformation( extent={{10,-10},{-10,10}}, origin={40,-30}))); - Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeed(w_fixed=2* - pi*smpmData.fsNominal/smpmData.p) - annotation (Placement(transformation(extent={{52,-10},{32,10}}))); + Mechanics.Rotational.Sources.Speed speed(exact=true, phi( + fixed=false)) + annotation (Placement(transformation(extent={{50,-10},{30,10}}))); + Blocks.Sources.Ramp ramp( + height=4*pi*smpmData.fsNominal/smpmData.p, + duration=0.16, + offset=-2*pi*smpmData.fsNominal/smpmData.p, + startTime=0.08) + annotation (Placement(transformation(extent={{90,-10},{70,10}}))); equation connect(terminalBox.plug_sn, smpm.plug_sn) annotation (Line(points={{-6,10},{-6,10}}, color={0,0,255})); @@ -70,22 +76,23 @@ equation annotation (Line(points={{0,20},{0,12}}, color={0,0,255})); connect(potentialSensor.phi, toSpacePhasor.u) annotation (Line(points={{8.88178e-16, 41},{8.88178e-16,50},{8,50}}, color={0,0,127})); - connect(constantSpeed.flange, smpm.flange) - annotation (Line(points={{32,0},{10,0}})); + connect(speed.flange, smpm.flange) annotation (Line(points={{30,0},{10,0}})); connect(smpm.flange, hallSensor.flange) annotation (Line(points={{10,0},{20,0},{20,-30},{30,-30}})); connect(toSpacePhasor.y, toPolar.u) annotation (Line(points={{31,50},{38,50}}, color={0,0,127})); connect(toPolar.y[2], toDeg.u) annotation (Line(points={{61,50},{68,50}}, color={0,0,127})); - annotation (experiment(StopTime=0.04, + connect(ramp.y, speed.w_ref) + annotation (Line(points={{69,0},{52,0}}, color={0,0,127})); + annotation (experiment(StopTime=0.32, Interval=0.0001), Documentation(info="

-Synchronous machine with permanent magnets at no-load, driven with constant nominal speed. +Synchronous machine with permanent magnets at no-load, driven with linear time dependent speed.

-You may check the terminal voltage = VsOpenCircuit (shown by the length of the space phasor) and the frequency = fsNominal. +You may check the terminal voltage (shown by the length of the space phasor) and the frequency.

Additionally, you may check the phase shift of the stator voltages with respect to the mechanical shaft angle: diff --git a/Modelica/Electrical/Machines/Sensors/HallSensor.mo b/Modelica/Electrical/Machines/Sensors/HallSensor.mo index 437e13fc3a..b264b9af59 100644 --- a/Modelica/Electrical/Machines/Sensors/HallSensor.mo +++ b/Modelica/Electrical/Machines/Sensors/HallSensor.mo @@ -12,7 +12,7 @@ model HallSensor "Hall sensor" annotation (Placement(transformation(extent={{-100,-10},{-120,10}}))); equation flange.tau=0; - y=rem((flange.phi - phi_support - phi0)*p, 2*pi); + y=mod((flange.phi - phi_support - phi0)*p, 2*pi); annotation ( Icon(coordinateSystem(preserveAspectRatio=false), graphics={ Ellipse(extent={{-70,70},{70,-70}}, lineColor={95,95,95}, diff --git a/Modelica/Resources/Reference/Modelica/Electrical/Machines/Examples/SynchronousMachines/SMPM_NoLoad/comparisonSignals.txt b/Modelica/Resources/Reference/Modelica/Electrical/Machines/Examples/SynchronousMachines/SMPM_NoLoad/comparisonSignals.txt index 42d946aefb..976ce7eb64 100644 --- a/Modelica/Resources/Reference/Modelica/Electrical/Machines/Examples/SynchronousMachines/SMPM_NoLoad/comparisonSignals.txt +++ b/Modelica/Resources/Reference/Modelica/Electrical/Machines/Examples/SynchronousMachines/SMPM_NoLoad/comparisonSignals.txt @@ -1,4 +1,4 @@ time -smpm.is[1] -smpm.is[2] -constantSpeed.phi +toPolar.y[1] +toPolar.y[2] +hallSensor.y