Skip to content

Commit

Permalink
Merge pull request #1220 from RWTH-EBC/issue1218_finalBufferParameter
Browse files Browse the repository at this point in the history
[skip-ci] #1218 Remove final parameters and put them into an advanced…
  • Loading branch information
FWuellhorst authored Jan 27, 2022
2 parents d63391d + 69a7a3b commit 26146c9
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions AixLib/Fluid/Storage/BufferStorage.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -126,7 +139,7 @@ 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=
Expand All @@ -136,7 +149,7 @@ model BufferStorage
"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}},
Expand Down

0 comments on commit 26146c9

Please sign in to comment.