Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have final modifier for these rescalings. #4379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HansOlsson
Copy link
Contributor

Otherwise these parameters could (as default; depending on tool) be possible to edit after translation.
Modifying the rescaling between Pascal and bar (or MW and W) clearly does not make sense.

Otherwsise these parameters could (as default; depending on tool) be possible to edit after translation.
Modifying the rescaling between Pascal and bar (or MW and W) clearly does not make sense.
@HansOlsson HansOlsson added the L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation) label Apr 8, 2024
@beutlich beutlich added the example Issue only addresses example(s) label Apr 8, 2024
annotation (Placement(transformation(extent={{-54,-75.5},{-44,-64.5}})));
Modelica.Blocks.Math.Gain Pa2bar(k=1e-5) annotation (Placement(
Modelica.Blocks.Math.Gain Pa2bar(final k=1e-5) annotation (Placement(
Copy link
Contributor

@henrikt-ma henrikt-ma Apr 25, 2024

Choose a reason for hiding this comment

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

I find it rather obscure to leave it for unit inference to figure out the unit of the gain, and I find setting displayUnit a good way to make clear that the numeric value is the correct one:

Suggested change
Modelica.Blocks.Math.Gain Pa2bar(final k=1e-5) annotation (Placement(
Modelica.Blocks.Math.Gain Pa2bar(final k(unit = "bar/Pa", displayUnit = "1") = 1e-5) annotation (Placement(

Copy link
Contributor

Choose a reason for hiding this comment

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

(If I am not mistaken about final, there is no point putting final before unit when the value modification is already made final.)

Copy link
Contributor

Choose a reason for hiding this comment

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

This too makes sense to me

@@ -70,9 +70,9 @@ package DrumBoiler
Modelica.Blocks.Interfaces.RealOutput V_l(unit="m3") "Liquid volume inside drum"
annotation (Placement(transformation(extent={{100,74},{112,86}})));
public
Modelica.Blocks.Math.Gain MW2W(k=1e6)
Modelica.Blocks.Math.Gain MW2W(final k=1e6)
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to Pa2bar but this should be combined with specifying the unit = "MW" for the table source:

  Modelica.Blocks.Sources.TimeTable q_F_Tab(table = [0, 0; 3600, 400; 7210, 400], y(unit = "MW")) if not use_inputs annotation(Placement(transformation(extent = {{-90, -80}, {-70, -60}})));
Suggested change
Modelica.Blocks.Math.Gain MW2W(final k=1e6)
Modelica.Blocks.Math.Gain MW2W(final k(unit = "W/MW", displayUnit = "1") = 1e6)

Copy link
Contributor

Choose a reason for hiding this comment

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

The proposed change by @henrikt-ma makes sense to me

Copy link
Contributor

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

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

Making final is good, but the final values make much more sense with explicitly specified units.

@HansOlsson
Copy link
Contributor Author

My intent was to not do anything regarding units in this PR, but only make the rescalings final - as they are clearly not intended to be changed.

Copy link
Contributor

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

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

As I see it, it is because the units are final that the conversion rates are final. If the intent is to use these blocks for conversion between other units I don't think it makes sense to make the rates final, so I don't see the point of proceeding without also specifying unit. Maybe you can find another reviewer who likes the changes without unit, and if you do I can make a follow-up PR to only add the missing units?

@HansOlsson
Copy link
Contributor Author

As I see it, it is because the units are final that the conversion rates are final. If the intent is to use these blocks for conversion between other units I don't think it makes sense to make the rates final, so I don't see the point of proceeding without also specifying unit. Maybe you can find another reviewer who likes the changes without unit, and if you do I can make a follow-up PR to only add the missing units?

That makes sense. So can some fluid-experts look at the changes?

Copy link
Contributor

@casella casella left a comment

Choose a reason for hiding this comment

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

LGTM, there is of course no point changing these binding equations or attributes

@casella casella self-requested a review August 9, 2024 10:09
Copy link
Contributor

@casella casella left a comment

Choose a reason for hiding this comment

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

The proposed change by @henrikt-ma makes sense to me

@@ -70,9 +70,9 @@ package DrumBoiler
Modelica.Blocks.Interfaces.RealOutput V_l(unit="m3") "Liquid volume inside drum"
annotation (Placement(transformation(extent={{100,74},{112,86}})));
public
Modelica.Blocks.Math.Gain MW2W(k=1e6)
Modelica.Blocks.Math.Gain MW2W(final k=1e6)
Copy link
Contributor

Choose a reason for hiding this comment

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

The proposed change by @henrikt-ma makes sense to me

annotation (Placement(transformation(extent={{-54,-75.5},{-44,-64.5}})));
Modelica.Blocks.Math.Gain Pa2bar(k=1e-5) annotation (Placement(
Modelica.Blocks.Math.Gain Pa2bar(final k=1e-5) annotation (Placement(
Copy link
Contributor

Choose a reason for hiding this comment

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

This too makes sense to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example Issue only addresses example(s) L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants