From 4874f159a21cca7235a5f2fbee03b1f5eafc9152 Mon Sep 17 00:00:00 2001 From: Michael Wetter Date: Fri, 30 Aug 2024 13:56:18 -0700 Subject: [PATCH] Corrected Modelica syntax for Dymola 2025x beta1 --- .../BaseClasses/surfaceTemperature.mo | 36 +++++++++++++------ .../Transmission/BaseClasses/BaseCable.mo | 30 ++++++++++++++-- .../BaseClasses/der_temperature_u.mo | 11 ++++-- Buildings/Utilities/Math/Functions/round.mo | 13 +++++-- 4 files changed, 71 insertions(+), 19 deletions(-) diff --git a/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/surfaceTemperature.mo b/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/surfaceTemperature.mo index 1c0a735d29a..80a997192bd 100644 --- a/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/surfaceTemperature.mo +++ b/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/surfaceTemperature.mo @@ -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, @@ -46,6 +53,13 @@ algorithm annotation (Documentation(revisions="