From 318e03f3f5a81f5448aaf4cfd2ae752183753304 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Mon, 5 Oct 2026 11:04:31 +0200 Subject: [PATCH 1/2] Make the units of a few examples and components consistent - Thyristor: the control voltage ramps from 0 to 10*vAK over 1 mA of gate current, now written 10*vAK*(iGK-0.95*IGT)/1e-3'A'. - DCPM_Drive: the battery resistance gives a 5 % voltage drop at 1000 A, now written 0.05*dcpmData.VaNominal/1000'A'. - ShowTransferFunction: the logarithm is taken of the frequency in rad/s, now written log10(logFrequencySweep.y/1'rad/s'). - Surfaces: the temperature oscillates at 0.5 Hz, now written cos(2*Modelica.Constants.pi*0.5'Hz'*time). - GasForce2: the fitted pressure curve is in bar, scaled with 1e5'Pa'. - WaterIF97: the pressure and temperature ramps are written 1e5'Pa'*(1 + time/1's') and 300'K' + 200'K/s' * time. - ElectroMagneticConverterWithLeakageInductance: eps is a minimum current, so that L_stat has the same unit in both branches. The values are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) --- Modelica/ComplexBlocks/Examples/ShowTransferFunction.mo | 2 +- Modelica/Electrical/Analog/Semiconductors/Thyristor.mo | 2 +- Modelica/Electrical/Machines/Examples/DCMachines/DCPM_Drive.mo | 2 +- .../Basic/ElectroMagneticConverterWithLeakageInductance.mo | 2 +- Modelica/Mechanics/MultiBody/Examples/Elementary/Surfaces.mo | 2 +- .../Mechanics/MultiBody/Examples/Loops/Utilities/GasForce2.mo | 2 +- Modelica/Media/package.mo | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Modelica/ComplexBlocks/Examples/ShowTransferFunction.mo b/Modelica/ComplexBlocks/Examples/ShowTransferFunction.mo index 7e5651da84..f3d819fd45 100644 --- a/Modelica/ComplexBlocks/Examples/ShowTransferFunction.mo +++ b/Modelica/ComplexBlocks/Examples/ShowTransferFunction.mo @@ -17,7 +17,7 @@ public "Unitless denominator polynomial coefficients {m,d,c} of the transfer function"; parameter Real wMin=0.01 "Lower bound for frequency sweep"; parameter Real wMax=100 "Upper bound for frequency sweep"; - Real lg_w=log10(logFrequencySweep.y) "Logarithm of frequency"; + Real lg_w=log10(logFrequencySweep.y/1'rad/s') "Logarithm of frequency"; Real dB=20*log10(complexToPolar.len) "Magnitude of the transfer function in decibel"; Modelica.Units.SI.Angle phi(displayUnit="deg")=complexToPolar.phi "Argument of the transfer function"; Modelica.Blocks.Sources.LogFrequencySweep logFrequencySweep( diff --git a/Modelica/Electrical/Analog/Semiconductors/Thyristor.mo b/Modelica/Electrical/Analog/Semiconductors/Thyristor.mo index 9870bebd24..8f1f603401 100644 --- a/Modelica/Electrical/Analog/Semiconductors/Thyristor.mo +++ b/Modelica/Electrical/Analog/Semiconductors/Thyristor.mo @@ -50,7 +50,7 @@ equation iGK = Gate.i; vGK = smooth(0,(if vGK < vRef then VGT/IGT*iGK else vRef^2/VGT+iGK*(VGT-vRef)/IGT)); - vContot = vConmain + smooth(0, if iGK < 0.95 * IGT then 0 else if iGK < 0.95*IGT + 1e-3 then 10000*(iGK-0.95*IGT)*vAK else 10* vAK); + vContot = vConmain + smooth(0, if iGK < 0.95 * IGT then 0 else if iGK < 0.95*IGT + 1e-3 then 10*vAK*(iGK-0.95*IGT)/1e-3'A' else 10* vAK); der(vControl)= (vContot - vControl) / (if (vContot - vControl) > 0 then 1.87*TON else 0.638*TOFF); // Anode-Cathode characteristics diff --git a/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_Drive.mo b/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_Drive.mo index 6a4b61fd05..031b92b02e 100644 --- a/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_Drive.mo +++ b/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_Drive.mo @@ -78,7 +78,7 @@ model DCPM_Drive origin={10,70}))); Analog.Sources.ConstantVoltage constantVoltage(V=dcpmData.VaNominal) annotation (Placement(transformation(extent={{-10,30},{-30,50}}))); - Analog.Basic.Resistor resistor(R=0.05*dcpmData.VaNominal/1000) + Analog.Basic.Resistor resistor(R=0.05*dcpmData.VaNominal/1000'A') annotation (Placement( transformation( extent={{10,10},{-10,-10}}, diff --git a/Modelica/Magnetic/FluxTubes/Basic/ElectroMagneticConverterWithLeakageInductance.mo b/Modelica/Magnetic/FluxTubes/Basic/ElectroMagneticConverterWithLeakageInductance.mo index 51fd7c7b25..3c4fbe723c 100644 --- a/Modelica/Magnetic/FluxTubes/Basic/ElectroMagneticConverterWithLeakageInductance.mo +++ b/Modelica/Magnetic/FluxTubes/Basic/ElectroMagneticConverterWithLeakageInductance.mo @@ -38,7 +38,7 @@ model ElectroMagneticConverterWithLeakageInductance SI.Inductance L_stat "Static inductance (valid if this coil is the only source)"; protected - constant Real eps=100*Modelica.Constants.eps; + constant SI.Current eps=100*Modelica.Constants.eps; equation v = p.v - n.v; 0 = p.i + n.i; diff --git a/Modelica/Mechanics/MultiBody/Examples/Elementary/Surfaces.mo b/Modelica/Mechanics/MultiBody/Examples/Elementary/Surfaces.mo index 6275f355e0..6032a2a429 100644 --- a/Modelica/Mechanics/MultiBody/Examples/Elementary/Surfaces.mo +++ b/Modelica/Mechanics/MultiBody/Examples/Elementary/Surfaces.mo @@ -53,7 +53,7 @@ model Surfaces T_min=0, T_max=2, T=Modelica.Math.sin(Modelica.Constants.pi*pipeWithScalarField.xsi)* - Modelica.Math.cos(Modelica.Constants.pi*time) .+ 1, + Modelica.Math.cos(2*Modelica.Constants.pi*0.5'Hz'*time) .+ 1, n_colors=32) annotation (Placement(transformation(extent={{14,-30},{34,-10}}))); Parts.FixedTranslation fixedTranslation3( diff --git a/Modelica/Mechanics/MultiBody/Examples/Loops/Utilities/GasForce2.mo b/Modelica/Mechanics/MultiBody/Examples/Loops/Utilities/GasForce2.mo index bbe9fd72db..e0ed1406a8 100644 --- a/Modelica/Mechanics/MultiBody/Examples/Loops/Utilities/GasForce2.mo +++ b/Modelica/Mechanics/MultiBody/Examples/Loops/Utilities/GasForce2.mo @@ -26,7 +26,7 @@ equation x = 1 - s_rel/L; v_rel = der(s_rel); - press = 1e5 * ( + press = 1e5'Pa' * ( if v_rel < 0 then ( if x < 0.986061 then 177.4132*x^4 - 287.2189*x^3 + 151.8252*x^2 - 24.9973*x + 2.4 else 2836360*x^4 - 10569296*x^3 + 14761814*x^2 - 9158505*x + 2129670) diff --git a/Modelica/Media/package.mo b/Modelica/Media/package.mo index 727e616df3..e1ac6a3787 100644 --- a/Modelica/Media/package.mo +++ b/Modelica/Media/package.mo @@ -2293,7 +2293,7 @@ is given to compare the approximation. // smooth states m_flow_ext2 = time - 0.5; - state2 = Medium.setState_pT(1e5*(1 + time), 300 + 200*time); + state2 = Medium.setState_pT(1e5'Pa'*(1 + time/1's'), 300'K' + 200'K/s' * time); state = Medium.setSmoothState( m_flow_ext2, medium.state, From 04017ff32a8f81c9076ca397b192bf5bd276f5f7 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Mon, 5 Oct 2026 12:07:52 +0200 Subject: [PATCH 2/2] Give the zero frequencies of the Cauer low-pass filters their unit The capacitances c2 and c4 resonate with l1 and l2 at the normalized angular frequencies of the filter's transmission zeros, now written 1.704992'rad/s' and 1.179945'rad/s'. In CauerLowPassOPV and CauerLowPassSC, l1 and l2 are capacitances standing for the inductances l1*R^2 with R = 1 Ohm, so the factor 1'Ohm2' is included. The values are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) --- Modelica/Electrical/Analog/Examples/CauerLowPassAnalog.mo | 4 ++-- Modelica/Electrical/Analog/Examples/CauerLowPassOPV.mo | 4 ++-- Modelica/Electrical/Analog/Examples/CauerLowPassSC.mo | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modelica/Electrical/Analog/Examples/CauerLowPassAnalog.mo b/Modelica/Electrical/Analog/Examples/CauerLowPassAnalog.mo index 3fc05f3bdc..80fa05e305 100644 --- a/Modelica/Electrical/Analog/Examples/CauerLowPassAnalog.mo +++ b/Modelica/Electrical/Analog/Examples/CauerLowPassAnalog.mo @@ -5,10 +5,10 @@ model CauerLowPassAnalog "Cauer low pass filter with analog components" parameter SI.Inductance l1=1.304 "Filter coefficient I1"; parameter SI.Inductance l2=0.8586 "Filter coefficient I2"; parameter SI.Capacitance c1=1.072 "Filter coefficient c1"; - parameter SI.Capacitance c2=1/(1.704992^2*l1) + parameter SI.Capacitance c2=1/((1.704992'rad/s')^2*l1) "Filter coefficient c2"; parameter SI.Capacitance c3=1.682 "Filter coefficient c3"; - parameter SI.Capacitance c4=1/(1.179945^2*l2) + parameter SI.Capacitance c4=1/((1.179945'rad/s')^2*l2) "Filter coefficient c4"; parameter SI.Capacitance c5=0.7262 "Filter coefficient c5"; Modelica.Electrical.Analog.Basic.Ground G diff --git a/Modelica/Electrical/Analog/Examples/CauerLowPassOPV.mo b/Modelica/Electrical/Analog/Examples/CauerLowPassOPV.mo index 178168a6ef..a4b655266c 100644 --- a/Modelica/Electrical/Analog/Examples/CauerLowPassOPV.mo +++ b/Modelica/Electrical/Analog/Examples/CauerLowPassOPV.mo @@ -5,10 +5,10 @@ model CauerLowPassOPV "Cauer low pass filter with operational amplifiers" parameter SI.Capacitance l1=1.304 "Filter coefficient i1"; parameter SI.Capacitance l2=0.8586 "Filter coefficient i2"; parameter SI.Capacitance c1=1.072 "Filter coefficient c1"; - parameter SI.Capacitance c2=1/(1.704992^2*l1) + parameter SI.Capacitance c2=1/((1.704992'rad/s')^2*l1*1'Ohm2') "Filter coefficient c2"; parameter SI.Capacitance c3=1.682 "Filter coefficient c3"; - parameter SI.Capacitance c4=1/(1.179945^2*l2) + parameter SI.Capacitance c4=1/((1.179945'rad/s')^2*l2*1'Ohm2') "Filter coefficient c4"; parameter SI.Capacitance c5=0.7262 "Filter coefficient c5"; Modelica.Electrical.Analog.Basic.Capacitor C1(C=c1 + c2, v(start=0, fixed=true)) diff --git a/Modelica/Electrical/Analog/Examples/CauerLowPassSC.mo b/Modelica/Electrical/Analog/Examples/CauerLowPassSC.mo index a398db8941..27ce428ff7 100644 --- a/Modelica/Electrical/Analog/Examples/CauerLowPassSC.mo +++ b/Modelica/Electrical/Analog/Examples/CauerLowPassSC.mo @@ -5,10 +5,10 @@ model CauerLowPassSC "Cauer low-pass filter with operational amplifiers and swit parameter SI.Capacitance l1=1.304 "Filter coefficient i1"; parameter SI.Capacitance l2=0.8586 "Filter coefficient i2"; parameter SI.Capacitance c1=1.072 "Filter coefficient c1"; - parameter SI.Capacitance c2=1/(1.704992^2*l1) + parameter SI.Capacitance c2=1/((1.704992'rad/s')^2*l1*1'Ohm2') "Filter coefficient c2"; parameter SI.Capacitance c3=1.682 "Filter coefficient c3"; - parameter SI.Capacitance c4=1/(1.179945^2*l2) + parameter SI.Capacitance c4=1/((1.179945'rad/s')^2*l2*1'Ohm2') "Filter coefficient c4"; parameter SI.Capacitance c5=0.7262 "Filter coefficient c5"; Modelica.Electrical.Analog.Basic.Capacitor C1(C=c1 + c2,v(start=0, fixed=true))