From bb9aa107b8c4425a666ba233398a17fab75acf27 Mon Sep 17 00:00:00 2001 From: "fabian.wuellhorst" Date: Thu, 27 Jan 2022 11:29:56 +0100 Subject: [PATCH 1/2] [skip-ci] #1218 Remove final parameters and put them into an advanced tab --- AixLib/Fluid/Storage/BufferStorage.mo | 52 +++++++++++++++++---------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/AixLib/Fluid/Storage/BufferStorage.mo b/AixLib/Fluid/Storage/BufferStorage.mo index 36fd01940b..7f60044e75 100644 --- a/AixLib/Fluid/Storage/BufferStorage.mo +++ b/AixLib/Fluid/Storage/BufferStorage.mo @@ -36,7 +36,7 @@ model BufferStorage parameter SI.Temperature TStart=298.15 "Start Temperature of fluid" annotation (Dialog(tab="Initialization", group="Storage specific")); - replaceable parameter DataBase.Storage.BufferStorageBaseDataDefinition data constrainedby DataBase.Storage.BufferStorageBaseDataDefinition "Data record for Storage" + replaceable parameter DataBase.Storage.BufferStorageBaseDataDefinition data constrainedby DataBase.Storage.BufferStorageBaseDataDefinition "Data record for Storage" annotation (choicesAllMatching); parameter Integer n(min=3)=5 " Model assumptions Number of Layers"; @@ -65,29 +65,42 @@ model BufferStorage parameter Modelica.SIunits.Temperature TStartIns=293.15 "Starting Temperature of insulation in K" annotation(Dialog(tab="Initialization", group="Storage specific")); +//////////////////////////////////////////////////////////////////////////////////////////////////// +////////////Advanced parameters///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + parameter Integer nLowerPortSupply=integer(max(AixLib.Utilities.Math.Functions.round(data.hLowerPortSupply/(data.hTank/n) + 0.5,0),1)) "Layer number lower end of supply is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nUpperPortSupply=integer(min(AixLib.Utilities.Math.Functions.round(data.hUpperPortSupply/(data.hTank/n) + 0.5,0),n)) "Layer number upper end of supply is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nLowerPortDemand=integer(max(AixLib.Utilities.Math.Functions.round(data.hLowerPortDemand/(data.hTank/n) + 0.5,0),1)) "Layer number lower end of demand is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nUpperPortDemand=integer(min(AixLib.Utilities.Math.Functions.round(data.hUpperPortDemand/(data.hTank/n) + 0.5,0),n)) "Layer number upper end of demand is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nTS1=integer(AixLib.Utilities.Math.Functions.round(data.hTS1/(data.hTank/n) + 0.5,0)) "Layer number lower temperature sensor is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nTS2=integer(AixLib.Utilities.Math.Functions.round(data.hTS2/(data.hTank/n) + 0.5,0)) "Layer number upper temperature sensor is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + + parameter Integer nHC1Up=integer(ceil(data.hHC1Up/(data.hTank/n))) "Layer number upper end of heating coil 1 is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nHC1Low=integer(floor(data.hHC1Low/(data.hTank/n))+1) "Layer number lower end of heating coil 1 is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nHC2Up=integer(ceil(data.hHC2Up/(data.hTank/n))) "Layer number upper end of heating coil 2 is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nHC2Low=integer(floor(data.hHC2Low/(data.hTank/n))+1) "Layer number lower end of heating coil 2 is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + parameter Integer nHR=integer(AixLib.Utilities.Math.Functions.round(data.hHR/(data.hTank/n) + 0.5,0)) "Layer number heating rod is connected to" + annotation (Dialog(tab="Advanced", group="Connection Layers: !Any modification will overwrite the data record behaviour!", descriptionLabel = true)); + //////////////////////////////////////////////////////////////////////////////////////////////////// ////////////final parameters//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// - final parameter Integer nHC1Up=integer(ceil(data.hHC1Up/(data.hTank/n))); - final parameter Integer nHC1Low=integer(floor(data.hHC1Low/(data.hTank/n))+1); final parameter Integer disHC1 = nHC1Up-nHC1Low+1; - - final parameter Integer nHC2Up=integer(ceil(data.hHC2Up/(data.hTank/n))); - final parameter Integer nHC2Low=integer(floor(data.hHC2Low/(data.hTank/n))+1); final parameter Integer disHC2 = nHC2Up-nHC2Low+1; - final parameter Integer nHR=integer(AixLib.Utilities.Math.Functions.round(data.hHR/(data.hTank/n) + 0.5,0)); - - final parameter Integer nTS1=integer(AixLib.Utilities.Math.Functions.round(data.hTS1/(data.hTank/n) + 0.5,0)); - final parameter Integer nTS2=integer(AixLib.Utilities.Math.Functions.round(data.hTS2/(data.hTank/n) + 0.5,0)); - - final parameter Integer nLowerPortDemand=integer(max(AixLib.Utilities.Math.Functions.round(data.hLowerPortDemand/(data.hTank/n) + 0.5,0),1)); - final parameter Integer nUpperPortDemand=integer(min(AixLib.Utilities.Math.Functions.round(data.hUpperPortDemand/(data.hTank/n) + 0.5,0),n)); final parameter Boolean inpLowLayDemand=(nLowerPortDemand == 1); //if there is an input at the lowest layer final parameter Boolean inpHigLayDemand=(nUpperPortDemand == n); - final parameter Integer nLowerPortSupply=integer(max(AixLib.Utilities.Math.Functions.round(data.hLowerPortSupply/(data.hTank/n) + 0.5,0),1)); - final parameter Integer nUpperPortSupply=integer(min(AixLib.Utilities.Math.Functions.round(data.hUpperPortSupply/(data.hTank/n) + 0.5,0),n)); final parameter Boolean inpLowLaySupply=(nLowerPortSupply == 1); //if there is an input at the lowest layer final parameter Boolean inpHigLaySupply=(nUpperPortSupply == n); @@ -126,17 +139,20 @@ model BufferStorage extent={{-5,5},{5,-5}}, rotation=0, origin={-80,-80}))); - Modelica.Fluid.Interfaces.FluidPort_a fluidportTop1( redeclare final package Medium = + Modelica.Fluid.Interfaces.FluidPort_a fluidportTop1( redeclare final package + Medium = Medium) "Fluid connector a (positive design flow direction is from port_a to port_b)" annotation (Placement(transformation(extent={{-38,92},{-18,110}},rotation= 0), iconTransformation(extent={{-38,92},{-18,110}}))); - Modelica.Fluid.Interfaces.FluidPort_a fluidportBottom2(redeclare final package Medium = + Modelica.Fluid.Interfaces.FluidPort_a fluidportBottom2(redeclare final + package Medium = Medium) "Fluid connector a (positive design flow direction is from port_a to port_b)" annotation (Placement(transformation(extent={{14,-110},{32,-92}},rotation= 0), iconTransformation(extent={{14,-110},{32,-92}}))); - Modelica.Fluid.Interfaces.FluidPort_b fluidportBottom1( redeclare final package Medium = + Modelica.Fluid.Interfaces.FluidPort_b fluidportBottom1( redeclare final + package Medium = Medium) "Fluid connector b (positive design flow direction is from port_a to port_b)" annotation (Placement(transformation(extent={{-36,-112},{-18,-92}}, From 69a7a3b0c15e4846027fbd7cbd06bb0bc4fd4b22 Mon Sep 17 00:00:00 2001 From: "fabian.wuellhorst" Date: Thu, 27 Jan 2022 11:56:26 +0100 Subject: [PATCH 2/2] [skip-ci] #1218 fix linebreaks --- AixLib/Fluid/Storage/BufferStorage.mo | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/AixLib/Fluid/Storage/BufferStorage.mo b/AixLib/Fluid/Storage/BufferStorage.mo index 7f60044e75..05ea5c01b0 100644 --- a/AixLib/Fluid/Storage/BufferStorage.mo +++ b/AixLib/Fluid/Storage/BufferStorage.mo @@ -36,7 +36,7 @@ model BufferStorage parameter SI.Temperature TStart=298.15 "Start Temperature of fluid" annotation (Dialog(tab="Initialization", group="Storage specific")); - replaceable parameter DataBase.Storage.BufferStorageBaseDataDefinition data constrainedby DataBase.Storage.BufferStorageBaseDataDefinition "Data record for Storage" + replaceable parameter DataBase.Storage.BufferStorageBaseDataDefinition data constrainedby DataBase.Storage.BufferStorageBaseDataDefinition "Data record for Storage" annotation (choicesAllMatching); parameter Integer n(min=3)=5 " Model assumptions Number of Layers"; @@ -139,20 +139,17 @@ model BufferStorage extent={{-5,5},{5,-5}}, rotation=0, origin={-80,-80}))); - Modelica.Fluid.Interfaces.FluidPort_a fluidportTop1( redeclare final package - Medium = + Modelica.Fluid.Interfaces.FluidPort_a fluidportTop1(redeclare final package Medium = Medium) "Fluid connector a (positive design flow direction is from port_a to port_b)" annotation (Placement(transformation(extent={{-38,92},{-18,110}},rotation= 0), iconTransformation(extent={{-38,92},{-18,110}}))); - Modelica.Fluid.Interfaces.FluidPort_a fluidportBottom2(redeclare final - package Medium = + Modelica.Fluid.Interfaces.FluidPort_a fluidportBottom2(redeclare final package Medium = Medium) "Fluid connector a (positive design flow direction is from port_a to port_b)" annotation (Placement(transformation(extent={{14,-110},{32,-92}},rotation= 0), iconTransformation(extent={{14,-110},{32,-92}}))); - Modelica.Fluid.Interfaces.FluidPort_b fluidportBottom1( redeclare final - package Medium = + Modelica.Fluid.Interfaces.FluidPort_b fluidportBottom1(redeclare final package Medium = Medium) "Fluid connector b (positive design flow direction is from port_a to port_b)" annotation (Placement(transformation(extent={{-36,-112},{-18,-92}},