Skip to content

Commit

Permalink
Corrected compliance with MSL (master) (#3982)
Browse files Browse the repository at this point in the history
* Removed wrong parameter keyword

For #3978
  • Loading branch information
mwetter authored Sep 2, 2024
1 parent e76d634 commit cbe1013
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,29 @@ protected
cliCon.TSurAmp/freq*(cos(freq*(cliCon.sinPha/secInDay - day)) - cos(freq*
(cliCon.sinPha/secInDay - (day + 1)))) for day in 1:Year}
"Daily mean air temperature (surface = 0 from uncorrected climatic constants)";
parameter Modelica.Units.SI.Temperature TSurDayMea[Year]={if TAirDayMea[day]
> TFre then (TFre + (TAirDayMea[day] - TFre)*nFacTha) else (TFre + (
TAirDayMea[day] - TFre)*nFacFre) for day in 1:Year}
"Daily mean corrected surface temperature";
parameter Real C1 = sum({TSurDayMea[day] * cos(freq * day) for day in 1:Year});
parameter Real C2 = sum({TSurDayMea[day] * sin(freq * day) for day in 1:Year});

parameter Modelica.Units.SI.Temperature corTSurMea=sum(TSurDayMea)/Year
Modelica.Units.SI.TemperatureDifference corTSurAmp
"Surface temperature amplitude";

Modelica.Units.SI.Temperature TSurDayMea[Year]
"Daily mean corrected surface temperature";
Modelica.Units.SI.Temperature corTSurMea
"Mean annual surface temperature";
parameter Modelica.Units.SI.TemperatureDifference corTSurAmp=2/Year .* (C1^2
+ C2^2)^0.5 "Surface temperature amplitude";
parameter Modelica.Units.SI.Duration corSinPha(displayUnit="d") = (
Modelica.Math.atan(C2/C1) + pi/2)*secInDay/freq

Real C1 "Coefficient for phase lag of soil surface temperature";
Real C2 "Coefficient for phase lag of soil surface temperature";
Modelica.Units.SI.Duration corSinPha(displayUnit="d")
"Phase lag of soil surface temperature";

algorithm
TSurDayMea[:]:={if TAirDayMea[day] > TFre then (TFre + (TAirDayMea[day] -
TFre)*nFacTha) else (TFre + (TAirDayMea[day] - TFre)*nFacFre) for day in 1:
Year};
corTSurMea:=sum(TSurDayMea)/Year;
C1 :=sum({TSurDayMea[day]*cos(freq*day) for day in 1:Year});
C2 :=sum({TSurDayMea[day]*sin(freq*day) for day in 1:Year});
corSinPha :=(Modelica.Math.atan(C2/C1) + pi/2)*secInDay/freq;
corTSurAmp:=2/Year .* (C1^2 + C2^2)^0.5;
// Analytical mean by integrating undisturbed soil temperature formula
corCliCon := ClimaticConstants.Generic(
TSurMea = corTSurMea,
Expand All @@ -46,6 +53,13 @@ algorithm
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong <code>parameter</code> declaration on a protected variable which causes an error in
Dymola 2025x beta1.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3978\">#3978</a>.
</li>
<li>
October 17, 2021, by Baptiste Ravache:<br/>
Declare record parameters to avoid translation error in OpenModelica.<br/>
This is for
Expand Down
30 changes: 27 additions & 3 deletions Buildings/Electrical/Transmission/BaseClasses/BaseCable.mo
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ record BaseCable "Record that contains the properties of a generic cable"
"Frequency considered in the definition of cables properties";
output Modelica.Units.SI.Resistance R "Resistance of the cable";
protected
parameter Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong parameter keyword on protected variable, which is needed for Dymola 2025x.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1930\">IBPSA, #1930</a>.
</li>
<li>
September 23, 2014, by Marco Bonvini:<br/>
Added function and documentation
</li>
Expand All @@ -36,10 +42,16 @@ Added function and documentation
"Frequency considered in the definition of cables properties";
output Modelica.Units.SI.Inductance L "Inductance of the cable";
protected
parameter Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong parameter keyword on protected variable, which is needed for Dymola 2025x.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1930\">IBPSA, #1930</a>.
</li>
<li>
September 23, 2014, by Marco Bonvini:<br/>
Added function and documentation
</li>
Expand All @@ -55,10 +67,16 @@ Added function and documentation
"Frequency considered in the definition of cables properties";
output Modelica.Units.SI.Capacitance C "Capacitance of the cable";
protected
parameter Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong parameter keyword on protected variable, which is needed for Dymola 2025x.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1930\">IBPSA, #1930</a>.
</li>
<li>
September 23, 2014, by Marco Bonvini:<br/>
Added function and documentation
</li>
Expand All @@ -69,6 +87,12 @@ Added function and documentation
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong parameter keyword on protected variable, which is needed for Dymola 2025x.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1930\">IBPSA, #1930</a>.
</li>
<li>
September 24, 2014, by Marco Bonvini:<br/>
Revised structure of the record, now the temperature constant <code>M</code>
is directly specified in the record.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ function der_temperature_u
"Derivatives dT/du at the support points";
protected
parameter Real scale=0.999 "Used to place points on the phase transition";
parameter Modelica.Units.SI.Temperature Tm1=TSol + (1 - scale)*(TLiq - TSol)
Modelica.Units.SI.Temperature Tm1=TSol + (1 - scale)*(TLiq - TSol)
"Support point";
parameter Modelica.Units.SI.Temperature Tm2=TSol + scale*(TLiq - TSol)
Modelica.Units.SI.Temperature Tm2=TSol + scale*(TLiq - TSol)
"Support point";
algorithm
assert(Buildings.HeatTransfer.Conduction.nSupPCM == 6,
Expand Down Expand Up @@ -61,6 +61,13 @@ to compute for a given specific internal energy the temperature.
revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong <code>parameter</code> declaration on a protected variable which causes an error in
Dymola 2025x beta1.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3978\">#3978</a>.
</li>
<li>
October 17, 2014, by Michael Wetter:<br/>
Changed the input argument from type
<code>Buildings.HeatTransfer.Data.BaseClasses.Material</code>
Expand Down
9 changes: 8 additions & 1 deletion Buildings/Utilities/Math/Functions/round.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function round "Round real number to specified digits"
output Real y "Connector of Real output signal";

protected
parameter Real fac = 10^n "Factor used for rounding";
Real fac = 10^n "Factor used for rounding";

algorithm
y := if (x>0) then floor(x*fac + 0.5)/fac else ceil(x*fac - 0.5)/fac;
Expand Down Expand Up @@ -46,6 +46,13 @@ Buildings.Controls.OBC.CDL.Reals.Round</a>.
</html>", revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong <code>parameter</code> declaration on a protected variable which causes an error in
Dymola 2025x beta1.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3978\">#3978</a>.
</li>
<li>
March 2, 2020, by Michael Wetter:<br/>
First implementation.<br/>
This is for
Expand Down

0 comments on commit cbe1013

Please sign in to comment.