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

Remove import statements #1961

Closed
jelgerjansen opened this issue Feb 4, 2025 · 5 comments · Fixed by #1963
Closed

Remove import statements #1961

jelgerjansen opened this issue Feb 4, 2025 · 5 comments · Fixed by #1963

Comments

@jelgerjansen
Copy link
Contributor

The model IBPSA/Electrical/PhaseSystems/package.mo contains two import statements:

  import      Modelica.Units.SI;
  import Modelica.Constants.pi;

I propose to remove these two import statements (as they are typically not used in the library) and provide an explicit path for the SI Units in the following models (output of "grep" command):

Electrical/PhaseSystems/ThreePhase_d.mo:8:    input SI.Voltage V "system voltage";
Electrical/PhaseSystems/ThreePhase_d.mo:9:    input SI.Angle phi = 0 "phase angle";
Electrical/PhaseSystems/ThreePhase_d.mo:10:    output SI.Voltage v[n] "phase to neutral voltages";
Electrical/PhaseSystems/ThreePhase_d.mo:19:    input SI.Voltage v[n];
Electrical/PhaseSystems/ThreePhase_d.mo:20:    output SI.Voltage V;

If desired, this issue could also be used to remove the other remaining (and undesired?) import statements:

Controls/SetPoints/OccupancySchedule.mo:98:  import Modelica;
Controls/SetPoints/OccupancySchedule.mo:110:  import Modelica;
Electrical/PhaseSystems/package.mo:5:  import Modelica.Constants.pi;
Fluid/Actuators/Dampers/MixingBox.mo:9:  import Modelica.Constants;
Fluid/BaseClasses/ActuatorFilter.mo:4:  import Modelica.Blocks.Types.Init;
Fluid/Storage/BaseClasses/PartialStratified.mo:6:  import Modelica.Fluid.Types;
Fluid/Storage/BaseClasses/PartialStratified.mo:7:  import Modelica.Fluid.Types.Dynamics;
@mwetter
Copy link
Contributor

mwetter commented Feb 4, 2025

@jelgerjansen : Removing all these import statements would be good.

@hcasperfu
Copy link
Contributor

Another instance of an import statement that jumps to the top of my mind is

import cha = IBPSA.Fluid.Movers.BaseClasses.Characteristics;

@jelgerjansen jelgerjansen changed the title Import Modelica.Units.SI in IBPSA.Electrical.PhaseSystems Remove import statements Feb 7, 2025
@jelgerjansen
Copy link
Contributor Author

I found some other import statements using the "grep" command. I removed all import statements and updated those models if necessary (see #1963)

@jelgerjansen
Copy link
Contributor Author

I had to add import Modelica; statements again to IBPSA/Control/Setpoints/OccupancySchedule.mo as this model defines two encapsulated functions, and not having the import statement results in the following (Dymola 2025x) error:

Encapsulation of IBPSA.Controls.SetPoints.OccupancySchedule.switchReal
prevented us from finding Modelica in global scope.

Missing base class Modelica.Icons.Function
the class Modelica.Icons.Function exists, but Modelica is case-sensitive and uses scoping
File: C:/Users/u0132350/Documents/GIT/modelica-ibpsa/IBPSA/Controls/SetPoints/OccupancySchedule.mo, line 106
Component context: IBPSA.Controls.SetPoints.OccupancySchedule.switchReal
Component declared as OccupancySchedule occSch in IBPSA.Controls.OBC.Utilities.Validation.OptimalStartHeating

However, the import statement is only required for extend Modelica.Icons.Function;. Therefore, removing both lines also solves the issue, but removes the function icon when opening the encapsulated functions switchReal and switchInteger.
@mwetter I'm not sure which of both options you prefer?

@mwetter
Copy link
Contributor

mwetter commented Feb 7, 2025

As these functions are protected, they are not showing anyway if a user browse the library. So not having the icon is fine with me.

@jelgerjansen jelgerjansen linked a pull request Feb 13, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants