Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Modelica/Electrical/Analog/Examples/ParallelResonance.mo
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
extent={{-10,-10},{10,10}},
rotation=270,
origin={-10,70})));
Basic.Inductor inductor1(i(fixed=true), L=0.1/(2*pi)) annotation (Placement(
Basic.Inductor inductor1(i(fixed=true), L=0.1'H'/(2*pi)) annotation (Placement(

Check failure on line 17 in Modelica/Electrical/Analog/Examples/ParallelResonance.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected `)` but received `'H'`

@beutlich beutlich Oct 5, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those changes disclose another dilemma that moparser fron deprecated repository https://github.com/modelica-tools/ModelicaSyntaxChecker is still used here while no adequate replacement is in sight or in-place. Therefore we need to address this CI issue beforehand -> #4821.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #4774 (comment) for a better alternative for this model

transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-10,40})));
Basic.Capacitor capacitor1(v(fixed=true), C=0.001/(2*pi)) annotation (
Basic.Capacitor capacitor1(v(fixed=true), C=0.001'F'/(2*pi)) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
Expand All @@ -46,12 +46,12 @@
extent={{-10,-10},{10,10}},
rotation=270,
origin={-10,-30})));
Basic.Inductor inductor2(i(fixed=true), L=0.1/(2*pi)) annotation (Placement(
Basic.Inductor inductor2(i(fixed=true), L=0.1'H'/(2*pi)) annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-10,-60})));
Basic.Capacitor capacitor2(v(fixed=true), C=0.001/(2*pi)) annotation (
Basic.Capacitor capacitor2(v(fixed=true), C=0.001'F'/(2*pi)) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
Expand Down
8 changes: 4 additions & 4 deletions Modelica/Electrical/Analog/Examples/SeriesResonance.mo
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
extent={{-10,-10},{10,10}},
rotation=270,
origin={40,50})));
Basic.Inductor inductor1(i(fixed=true), L=0.1/(2*pi))
Basic.Inductor inductor1(i(fixed=true), L=0.1'H'/(2*pi))

Check failure on line 17 in Modelica/Electrical/Analog/Examples/SeriesResonance.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected `)` but received `'H'`
annotation (Placement(transformation(extent={{-30,60},{-10,80}})));
Basic.Capacitor capacitor1(v(fixed=true), C=0.001/(2*pi))
Basic.Capacitor capacitor1(v(fixed=true), C=0.001'F'/(2*pi))
annotation (Placement(transformation(extent={{10,60},{30,80}})));
Sensors.CurrentSensor currentSensor1
annotation (Placement(transformation(extent={{10,20},{-10,40}})));
Expand All @@ -38,9 +38,9 @@
extent={{-10,-10},{10,10}},
rotation=270,
origin={40,-50})));
Basic.Inductor inductor2(i(fixed=true), L=0.1/(2*pi))
Basic.Inductor inductor2(i(fixed=true), L=0.1'H'/(2*pi))
annotation (Placement(transformation(extent={{-30,-40},{-10,-20}})));
Basic.Capacitor capacitor2(v(fixed=true), C=0.001/(2*pi))
Basic.Capacitor capacitor2(v(fixed=true), C=0.001'F'/(2*pi))
annotation (Placement(transformation(extent={{10,-40},{30,-20}})));
Sensors.CurrentSensor currentSensor2
annotation (Placement(transformation(extent={{10,-80},{-10,-60}})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
parameter SI.Current Inom=1 "Nominal current";
parameter SI.Inductance Linf=0.5 "Inductance at large currents";
parameter SI.Voltage U=1.25 "Source voltage (peak)";
parameter SI.Frequency f=1/(2*Modelica.Constants.pi)
parameter SI.Frequency f=1'Hz'/(2*Modelica.Constants.pi)

Check failure on line 11 in Modelica/Electrical/Analog/Examples/ShowSaturatingInductor.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected `;` but received `'Hz'`
"Source frequency";
parameter SI.Angle phase=Modelica.Constants.pi/2
"Source voltage phase shift";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
origin={-10,20},
extent={{-10,-10},{10,10}},
rotation=270)));
QuasiStatic.SinglePhase.Basic.Inductor inductor(L=1/(2*Modelica.Constants.pi))
QuasiStatic.SinglePhase.Basic.Inductor inductor(L=1'H'/(2*Modelica.Constants.pi))

Check failure on line 35 in Modelica/Electrical/QuasiStatic/SinglePhase/Examples/ParallelResonance.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected `)` but received `'H'`
annotation (Placement(transformation(
origin={10,20},
extent={{-10,-10},{10,10}},
rotation=270)));
QuasiStatic.SinglePhase.Basic.Capacitor capacitor(C=1/(2*Modelica.Constants.pi))
QuasiStatic.SinglePhase.Basic.Capacitor capacitor(C=1'F'/(2*Modelica.Constants.pi))
annotation (Placement(transformation(
origin={30,20},
extent={{-10,-10},{10,10}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
annotation (Placement(transformation(extent={{-40,-60},{-20,-40}})));
QuasiStatic.SinglePhase.Basic.Resistor resistor(R_ref=1)
annotation (Placement(transformation(extent={{20,-10},{40,10}})));
QuasiStatic.SinglePhase.Basic.Inductor inductor(L=1/(2*Modelica.Constants.pi))
QuasiStatic.SinglePhase.Basic.Inductor inductor(L=1'H'/(2*Modelica.Constants.pi))

Check failure on line 21 in Modelica/Electrical/QuasiStatic/SinglePhase/Examples/SeriesBode.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected `)` but received `'H'`
annotation (Placement(transformation(extent={{50,-10},{70,10}})));
Modelica.ComplexBlocks.Sources.ComplexConstant complexConst(k=Complex(1, 0))
annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
annotation (Placement(transformation(extent={{-40,-60},{-20,-40}})));
QuasiStatic.SinglePhase.Basic.Resistor resistor(R_ref=0.1)
annotation (Placement(transformation(extent={{10,-10},{30,10}})));
QuasiStatic.SinglePhase.Basic.Inductor inductor(L=1/(2*Modelica.Constants.pi))
QuasiStatic.SinglePhase.Basic.Inductor inductor(L=1'H'/(2*Modelica.Constants.pi))

Check failure on line 32 in Modelica/Electrical/QuasiStatic/SinglePhase/Examples/SeriesResonance.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected `)` but received `'H'`
annotation (Placement(transformation(extent={{40,-10},{60,10}})));
QuasiStatic.SinglePhase.Basic.Capacitor capacitor(C=1/(2*Modelica.Constants.pi))
QuasiStatic.SinglePhase.Basic.Capacitor capacitor(C=1'F'/(2*Modelica.Constants.pi))
annotation (Placement(transformation(extent={{70,-10},{90,10}})));
QuasiStatic.SinglePhase.Sensors.CurrentSensor currentSensor
annotation (Placement(transformation(extent={{-20,10},{0,-10}})));
Expand Down
34 changes: 17 additions & 17 deletions Modelica/Fluid/Dissipation.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4484,7 +4484,7 @@
extends Modelica.Icons.Record;

//generic variables
SI.Area A_cross=Modelica.Constants.pi*0.1^2/4 "Cross sectional area"
SI.Area A_cross=Modelica.Constants.pi*(0.1'm')^2/4 "Cross sectional area"

Check failure on line 4487 in Modelica/Fluid/Dissipation.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected an expression, `)`, or `,` but received `'m'`
annotation (Dialog(group="Generic variables"));

//linearisation
Expand Down Expand Up @@ -10049,9 +10049,9 @@
annotation (Dialog(group="Choices"));

//geometry
input SI.Area A_cross(min=Modelica.Constants.eps) = PI*0.1^2/4
input SI.Area A_cross(min=Modelica.Constants.eps) = PI*(0.1'm')^2/4
"Cross sectional area" annotation (Dialog(group="Geometry"));
input SI.Length perimeter(min=Modelica.Constants.eps) = PI*0.1
input SI.Length perimeter(min=Modelica.Constants.eps) = PI*0.1'm'
Comment on lines -10052 to +10054

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also indicates that the classes aren't well-designed.

Both the cross area and perimeter have defaults based on the diameter being 0.1'm', but instead of having one default depending on the other input (or on a common diameter input), the default diameter is duplicated in this function and related ones (it can only be a default as the goal is to support non-circular cross-sections). That makes it more error-prone.

It would be possible to introduce a backwards compatible change for that by having a new trailing diameter-input that only impacts the defaults. The down-side is that existing calls wouldn't modify the default-diameter and that value would be a bit confusing.

Alternatively, it would also be possible to have the default for the cross-section depend on the perimeter (A_cross=perimeter^2/(4*PI) without that down-side. Technically it would be non-backwards compatible, but any impacted model would be problematic.

(Note that it uses the general term "perimeter", not "circumference".)

"Perimeter"
annotation (Dialog(group="Geometry"));

Expand Down Expand Up @@ -12511,7 +12511,7 @@

SI.Area A_cross=A_cross_nom "Cross sectional area"
annotation (Dialog(group="Generic variables"));
SI.Area A_cross_nom=Modelica.Constants.pi*0.1^2/4
SI.Area A_cross_nom=Modelica.Constants.pi*(0.1'm')^2/4
"Nominal cross sectional area"
annotation (Dialog(group="Generic variables"));

Expand Down Expand Up @@ -12564,9 +12564,9 @@
record TwoPhaseFlow_con "Base record for two phase Flow"
extends Modelica.Icons.Record;

SI.Area A_cross=PI*0.1^2/4 "Cross sectional area"
SI.Area A_cross=PI*(0.1'm')^2/4 "Cross sectional area"
annotation (Dialog(group="Geometry"));
SI.Length perimeter=PI*0.1 "Wetted perimeter"
SI.Length perimeter=PI*0.1'm' "Wetted perimeter"
annotation (Dialog(group="Geometry"));
SI.Length length=1 "Length in fluid flow direction"
annotation (Dialog(group="Geometry"));
Expand Down Expand Up @@ -12628,7 +12628,7 @@

parameter SI.Area A_cross=A_cross_nom "Cross sectional area"
annotation (Dialog(group="Generic variables"));
parameter SI.Area A_cross_nom=Modelica.Constants.pi*0.1^2/4
parameter SI.Area A_cross_nom=Modelica.Constants.pi*(0.1'm')^2/4
"Nominal cross sectional area"
annotation (Dialog(group="Generic variables"));

Expand Down Expand Up @@ -12704,9 +12704,9 @@
"Target correlation" annotation (Dialog(group="Generic variables"));

//geometry
SI.Area A_cross=Modelica.Constants.pi*0.1^2/4 "Cross sectional area"
SI.Area A_cross=Modelica.Constants.pi*(0.1'm')^2/4 "Cross sectional area"
annotation (Dialog(group="Generic variables"));
SI.Length perimeter=Modelica.Constants.pi*0.1 "Wetted perimeter"
SI.Length perimeter=Modelica.Constants.pi*0.1'm' "Wetted perimeter"
annotation (Dialog(group="Generic variables"));
end General;

Expand Down Expand Up @@ -12749,9 +12749,9 @@
"Choice of (horizontal/vertical) boiling or (horizontal) condensation in pipe"
annotation (Dialog(group="Choices"));

SI.Area A_cross=Modelica.Constants.pi*0.1^2/4 "Cross sectional area"
SI.Area A_cross=Modelica.Constants.pi*(0.1'm')^2/4 "Cross sectional area"
annotation (Dialog(group="Geometry"));
SI.Length perimeter=Modelica.Constants.pi*0.1 "Wetted perimeter"
SI.Length perimeter=Modelica.Constants.pi*0.1'm' "Wetted perimeter"
annotation (Dialog(group="Geometry"));

Modelica.Fluid.Dissipation.Utilities.Types.MolarMass_gpmol MM=18.02
Expand Down Expand Up @@ -12884,9 +12884,9 @@
annotation (Dialog(group="Orifice"));
SI.Length C_0=0.1*C_1 "Perimeter of vena contraction"
annotation (Dialog(group="Orifice"));
SI.Area A_1=PI*0.01^2/4 "Large cross sectional area of orifice"
SI.Area A_1=PI*(0.01'm')^2/4 "Large cross sectional area of orifice"
annotation (Dialog(group="Orifice"));
SI.Length C_1=PI*0.01 "Large perimeter of orifice"
SI.Length C_1=PI*0.01'm' "Large perimeter of orifice"
annotation (Dialog(group="Orifice"));
SI.Length L=1e-3 "Length of vena contraction"
annotation (Dialog(group="Orifice"));
Expand Down Expand Up @@ -12949,13 +12949,13 @@
SI.Angle alpha=PI*45/180 "Diffuser diverging angle"
annotation (Dialog(group="Diffuser"));

SI.Area A_1=PI*0.01^2/4
SI.Area A_1=PI*(0.01'm')^2/4
"Small constant cross sectional area before diffuser section"
annotation (Dialog(group="Diffuser"));
SI.Area A_2=2*A_1
"Large constant cross sectional area after diffuser section"
annotation (Dialog(group="Diffuser"));
SI.Length C_1=PI*0.01 "Small perimeter before diffuser section"
SI.Length C_1=PI*0.01'm' "Small perimeter before diffuser section"
annotation (Dialog(group="Diffuser"));
SI.Length C_2=2*C_1 "Large perimeter after diffuser section"
annotation (Dialog(group="Diffuser"));
Expand Down Expand Up @@ -12995,11 +12995,11 @@

extends Modelica.Icons.Record;

SI.Area A_1=PI*0.01^2/4 "Small cross sectional area of orifice"
SI.Area A_1=PI*(0.01'm')^2/4 "Small cross sectional area of orifice"
annotation (Dialog(group="Orifice"));
SI.Area A_2=A_1 "Large cross sectional area of orifice"
annotation (Dialog(group="Orifice"));
SI.Length C_1=PI*0.01 "Small perimeter of orifice"
SI.Length C_1=PI*0.01'm' "Small perimeter of orifice"
annotation (Dialog(group="Orifice"));
SI.Length C_2=C_1 "Large perimeter of orifice"
annotation (Dialog(group="Orifice"));
Expand Down
6 changes: 3 additions & 3 deletions Modelica/Fluid/Examples/IncompressibleFluidNetwork.mo
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
m_flow_nominal=1,
rho_nominal=1000,
CvData=Modelica.Fluid.Types.CvTypes.Av,
Av=2.5e-2^2/4*Modelica.Constants.pi,
Av=(2.5e-2'm')^2/4*Modelica.Constants.pi,

Check failure on line 82 in Modelica/Fluid/Examples/IncompressibleFluidNetwork.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected an expression, `)`, or `,` but received `'m'`
dp_nominal=30000)
annotation (Placement(transformation(extent={{-46,30},{-26,50}})));
Valves.ValveIncompressible valve2(
redeclare package Medium = Medium,
m_flow_nominal=1,
rho_nominal=1000,
CvData=Modelica.Fluid.Types.CvTypes.Av,
Av=2.5e-2^2/4*Modelica.Constants.pi,
Av=(2.5e-2'm')^2/4*Modelica.Constants.pi,
dp_nominal=30000)
annotation (Placement(transformation(extent={{-46,-30},{-26,-50}})));
Pipes.DynamicPipe pipe7(
Expand All @@ -106,7 +106,7 @@
m_flow_nominal=1,
rho_nominal=1000,
CvData=Modelica.Fluid.Types.CvTypes.Av,
Av=2.5e-2^2/4*Modelica.Constants.pi,
Av=(2.5e-2'm')^2/4*Modelica.Constants.pi,
dp_nominal=30000)
annotation (Placement(transformation(extent={{80,0},{100,20}})));
Sources.Boundary_pT sink(nPorts=1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ model CylinderLeakage "Testing cylinder leakage models"
import Modelica.Constants.pi;
parameter SI.RelativePermeability mu_rConst = 100
"Relative permeability";
Shapes.Leakage.QuarterCylinder quarterCylinder1(l=2*pi*0.1)
Shapes.Leakage.QuarterCylinder quarterCylinder1(l=2*pi*0.1'm')
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
Shapes.FixedShape.HollowCylinderAxialFlux hollowCylinderAxialFlux1(
r_i=0,
Expand All @@ -18,7 +18,7 @@ model CylinderLeakage "Testing cylinder leakage models"
r_o=0.05,
mu_rConst=mu_rConst)
annotation (Placement(transformation(extent={{20,-10},{40,10}})));
Shapes.Leakage.QuarterCylinder quarterCylinder2(l=2*pi*0.1)
Shapes.Leakage.QuarterCylinder quarterCylinder2(l=2*pi*0.1'm')
annotation (Placement(transformation(extent={{50,-10},{70,10}})));
Sources.ConstantMagneticFlux constantSource(
gamma(fixed=true, start=0), f=50, Phi=Complex(re=5E-3, im=0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
extent={{-10,10},{10,-10}},
rotation=270,
origin={-40,40})));
Modelica.ComplexBlocks.Sources.ComplexRotatingPhasor rotSource(magnitude=100, w=2*pi) annotation (Placement(transformation(
Modelica.ComplexBlocks.Sources.ComplexRotatingPhasor rotSource(magnitude=100, w=2*pi*1'Hz') annotation (Placement(transformation(

Check failure on line 119 in Modelica/Magnetic/QuasiStatic/FundamentalWave/Examples/BasicMachines/SynchronousMachines/SMPM_MTPA.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected `)` but received `'Hz'`
extent={{-10,-10},{10,10}},
rotation=90,
origin={-70,30})));
Expand Down
2 changes: 1 addition & 1 deletion Modelica/Mechanics/Rotational/Examples/Friction.mo
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
offset=1,
startTime=startTime) annotation (Placement(transformation(extent={{-160,
-30},{-140,-10}})));
Modelica.Blocks.Sources.Sine sine(amplitude=200, f=50/pi)
Modelica.Blocks.Sources.Sine sine(amplitude=200, f=50'Hz'/pi)

Check failure on line 54 in Modelica/Mechanics/Rotational/Examples/Friction.mo

View workflow job for this annotation

GitHub Actions / syntax_checks

expected `)` but received `'Hz'`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be careful with Hertz (just a note on this, but all need to be checked).

Despite being defined as 1/s it shouldn't be used for everything with unit 1/s according to BIPM, but only periodic signals that are something/s.

In this case it seems like a complete mess and 50/pi might be intended to be 100'rad/s'/(2*pi).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit of f is "Hz", so having "Hz" in its modification seems correct to me.

annotation (Placement(transformation(extent={{-160,10},{-140,30}})));
Modelica.Blocks.Math.Product product annotation (Placement(transformation(
extent={{-120,-10},{-100,10}})));
Expand Down
4 changes: 2 additions & 2 deletions ModelicaTest/Electrical/QuasiStatic/SinglePhase.mo
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ package SinglePhase "Single-phase quasi-static package"
origin={40,-40})));
Modelica.Blocks.Sources.Constant const(k=1) annotation (Placement(transformation(extent={{-50,50},{-30,70}})));
Modelica.Blocks.Sources.Constant const1(k=1) annotation (Placement(transformation(extent={{-20,70},{0,90}})));
Modelica.Blocks.Sources.Constant const2(k=1/100/Modelica.Constants.pi) annotation (Placement(transformation(extent={{70,70},{50,90}})));
Modelica.Blocks.Sources.Constant const3(k=1/100/Modelica.Constants.pi) annotation (Placement(transformation(extent={{100,50},{80,70}})));
Modelica.Blocks.Sources.Constant const2(k=1'F'/100/Modelica.Constants.pi) annotation (Placement(transformation(extent={{70,70},{50,90}})));
Modelica.Blocks.Sources.Constant const3(k=1'H'/100/Modelica.Constants.pi) annotation (Placement(transformation(extent={{100,50},{80,70}})));
Comment on lines +32 to +33

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this needs to be considered more, the 100*pi is 50'Hz'2pi, where 50 Hertz is the normal frequency in Europe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the constants are used:

    connect(const2.y, variableCapacitor.C) annotation (Line(points={{49,80},{40,80},{40,42}}, color={0,0,127}));
    connect(const3.y, variableInductor.L) annotation (Line(points={{79,60},{70,60},{70,42}},   color={0,0,127}));

Here, variableCapacitor.C has unit "F", and variableInductor.L has unit "H".

That's as far as the units go. Regarding how to express the value, would you prefer this?

Suggested change
Modelica.Blocks.Sources.Constant const2(k=1'F'/100/Modelica.Constants.pi) annotation (Placement(transformation(extent={{70,70},{50,90}})));
Modelica.Blocks.Sources.Constant const3(k=1'H'/100/Modelica.Constants.pi) annotation (Placement(transformation(extent={{100,50},{80,70}})));
Modelica.Blocks.Sources.Constant const2(k=0.02'F'/(2*Modelica.Constants.pi)) annotation (Placement(transformation(extent={{70,70},{50,90}})));
Modelica.Blocks.Sources.Constant const3(k=0.02'H'/(2*Modelica.Constants.pi)) annotation (Placement(transformation(extent={{100,50},{80,70}})));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is one possibility, the other would be something like:

Suggested change
Modelica.Blocks.Sources.Constant const2(k=1'F'/100/Modelica.Constants.pi) annotation (Placement(transformation(extent={{70,70},{50,90}})));
Modelica.Blocks.Sources.Constant const3(k=1'H'/100/Modelica.Constants.pi) annotation (Placement(transformation(extent={{100,50},{80,70}})));
Modelica.Blocks.Sources.Constant const2(k=1'S'/(2*Modelica.Constants.pi*50'Hz')) annotation (Placement(transformation(extent={{70,70},{50,90}})));
Modelica.Blocks.Sources.Constant const3(k=1'Ohm'/(2*Modelica.Constants.pi*50'Hz')) annotation (Placement(transformation(extent={{100,50},{80,70}})));

I could see some explanation along those lines based on resonance circuits etc, but I don't have the domain knowledge to judge whether people normally write (and/or understand) formulas like that or not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4774 (comment) gave a more readable solution

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the suggestion is simply to introduce new parameters instead of the unitful literals? If this is what everyone wants, I'll do it that way. @AHaumer ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear it is new parameters revealing the logic of the model, as indicated in that comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the suggestion in "that comment" is missing some use of final. @AHaumer would you agree with this?

  parameter SI.Frequency fNom=50;
  parameter SI.Admittance Y=1;
  final parameter SI.Capacitance C=Y/(2*pi*fNom);
  parameter SI.Reactance X=1;
  final parameter SI.Inductance L=X/(2*pi*fNom);
  Modelica.Blocks.Sources.Constant const2(final k=C);
  Modelica.Blocks.Sources.Constant const3(final k=L);

Or should some of {fNom, Y, X} also be final?

(ParallelResonance and SeriesResonance would make similar use of final, I suppose.)

Modelica.ComplexBlocks.Sources.ComplexConstant const4(k(re=0.5, im=0.5)) annotation (Placement(transformation(extent={{0,-70},{20,-50}})));
Modelica.ComplexBlocks.Sources.ComplexConstant const5(k(re=1, im=1)) annotation (Placement(transformation(extent={{-30,-90},{-10,-70}})));
Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.VoltageSensor voltageSensor annotation (Placement(transformation(
Expand Down
12 changes: 6 additions & 6 deletions ModelicaTest/Fluid/Dissipation.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1015,9 +1015,9 @@ extends Modelica.Icons.ExamplesPackage;
parameter Integer n=size(cp, 1);

//generic variables
parameter SI.Area A_cross=Modelica.Constants.pi*0.1^2/4
parameter SI.Area A_cross=Modelica.Constants.pi*(0.1'm')^2/4
"Cross sectional area";
parameter SI.Length perimeter=Modelica.Constants.pi*0.1
parameter SI.Length perimeter=Modelica.Constants.pi*0.1'm'
"Wetted perimeter";
//parameter SI.Diameter d_hyd=4*A_cross/perimeter "Hydraulic diameter";

Expand Down Expand Up @@ -1164,9 +1164,9 @@ extends Modelica.Icons.ExamplesPackage;
parameter Integer n=size(cp, 1);

//generic variables
parameter SI.Area A_cross=Modelica.Constants.pi*0.1^2/4
parameter SI.Area A_cross=Modelica.Constants.pi*(0.1'm')^2/4
"Cross sectional area";
parameter SI.Length perimeter=Modelica.Constants.pi*0.1
parameter SI.Length perimeter=Modelica.Constants.pi*0.1'm'
"Wetted perimeter";
//parameter SI.Diameter d_hyd=4*A_cross/perimeter "Hydraulic diameter";

Expand Down Expand Up @@ -5228,7 +5228,7 @@ extends Modelica.Icons.ExamplesPackage;
//general variables
SI.Area A_cross=A_cross_nom "Cross sectional area"
annotation (Dialog(group="Generic variables"));
SI.Area A_cross_nom=Modelica.Constants.pi*0.1^2/4
SI.Area A_cross_nom=Modelica.Constants.pi*(0.1'm')^2/4
"Nominal cross sectional area"
annotation (Dialog(group="Generic variables"));
SI.Pressure dp_nom=50
Expand Down Expand Up @@ -5368,7 +5368,7 @@ extends Modelica.Icons.ExamplesPackage;
//general variables
parameter Integer n=3 "Number of grid points";

parameter SI.Area A_cross=Modelica.Constants.pi*0.1^2/4
parameter SI.Area A_cross=Modelica.Constants.pi*(0.1'm')^2/4
"Circular cross sectional area";
parameter
Modelica.Fluid.Dissipation.Utilities.Types.PressureLossCoefficient
Expand Down
2 changes: 1 addition & 1 deletion ModelicaTest/MultiBody.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5943,7 +5943,7 @@ and plot gasForce.press over gasForce.s_rel.
MultiBody.Joints.Revolute revolute2(
n={1,0,0},
phi(fixed=true, start=0),
w(fixed=true, start=2*Modelica.Constants.pi))
w(fixed=true, start=2*Modelica.Constants.pi*1'Hz'))
annotation (Placement(transformation(extent={{-122,40},{-102,60}})));
MultiBody.Parts.FixedRotation fixedRotation(n={0,1,0},
angle=90)
Expand Down
Loading