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

Cooling tower first model #472

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft

Cooling tower first model #472

wants to merge 34 commits into from

Conversation

phelimb-met
Copy link

Goal

Describe the big picture of your changes here (one sentence).

If it fixes an issue, mention the issue using closing key words (how to do that ?), or in development section of your PR's information.

Type of change

  • Bugfix
  • New feature
  • Refactoring change
  • Release & Version Update (don't forget to change the version number in package.mo)

Will it break anything in previous models ?

  • Breaking change (If yes, make sure to point it out in the changelog)
  • Non-Breaking change

Checklist

  • I have added the appropriate tags, reviewers, projects (and detailed the size and priority of my PR) and linked issues to this PR
  • I have performed a self-review of my own code
  • I have checked that all existing tests pass.
  • I have added/updated tests that prove my development works and does not break anything.
  • I have made corresponding changes or additions to the documentation (in Notion documentation)
  • I have added corresponding entries to the Changelog
  • I have checked for conflicts with target branch, and merged/rebased in consequence

You can also fill these out after creating the PR, but make sure to check them all before submitting your PR for review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now the heat exchange is between the water source and water sink, so the component hot_side_cooling should be replace by an IsoPHFlowModel (at the moment it is an IsoPFlowModel )

@@ -107,7 +107,7 @@ equation

// Observable for Calibration
WaterOutletTemp_sensor.T_degC = WaterOutletTemp;
AirOutletTemp_sensor.T_degC = AirOutletTemp;
AirOutletTemp_sensor.T_degC = AirOutletTemp-10*time;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful to not forget *time in your model, it should be used only for testing

@@ -32,7 +32,7 @@ model CoolingTower_reverse
output Real Q_cold(start=52552.133) "m3/s";

output Real airOutletPress(start=1) "bar";
output Real AirOutletTemp(start=35) "deg_C";
input Real AirOutletTemp(start=35) "deg_C"; //output
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the correction on the component (isoPH instead of isoP), you won't have anymore to impose this temperature

Water_outlet.T_out = Water_inlet.T_in;
Water_outlet.Q_out = Water_inlet.Q_in - Q_makeup;
//Water_outlet.T_out = Water_inlet.T_in;
Water_outlet.Q_out = Q_hot - Q_makeup;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q_out it negative (flow going out a componenet is negative by convention, so here it should be :
Water_outlet.Q_out = - (Q_hot - Q_makeup);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be a could idea to create a new variable Q_hot_out and renaming Q_hot by Q_hot_in

Copy link
Contributor

@hadrienp-met hadrienp-met left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, with a lower air temperature the Hd should be positive. But we should keep this in mind because a CT is working even if the air is warmer than the water. Maybe that's a limit of our hypothesis.

Copy link
Contributor

@hadrienp-met hadrienp-met left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, I made some small test and the results looks good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file can be deleted now, we keep only the model with supersaturated air

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename the file CoolingTowerPoppe

import MetroscopeModelingLibrary.Utilities.Media.WaterSteamMedium;
import MetroscopeModelingLibrary.Utilities.Media.MoistAirMedium.specificEnthalpy;

//Unsaturated Air
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be useful to put in comment where does the equations come from

Comment on lines 98 to 101
Inputs.InputReal hd;
Inputs.InputArea Afr;
Inputs.InputReal Lfi;
Inputs.InputFrictionCoefficient Cf;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put in comment the full name of the parameters

// Poppe Inputs
Units.Temperature deltaTw;

parameter Integer N_step = 10;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter should be at the top of the model and have a description

Lef[1] = 0.9077990913 * (((MoistAir.xsaturation_pT(Pin[1], T_cold_in)+0.622)/(w[1]+0.622))-1) / log((MoistAir.xsaturation_pT(Pin[1], T_cold_in)+0.622)/(w[1]+0.622));
cp[1] = WaterSteamMedium.specificHeatCapacityCp(water_inlet_flow.state_in);

// Drift Equation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This equation is correct only for natural draft cooling tower. I think we should also add the equation that describe the fans behaviour with an if condition to selected the configuration. Something like:

if configuration = "natural draft" then
  ...
else
 ...

This has to be done also for the Merkel model.

Real Lef[N_step];
Units.MassFlowRate Qw[N_step];
Units.MassFlowRate Qa[N_step];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be interesting to add the estimation of the rejected heat in MW

y:= cp / ((MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i + (Lef-1) * (MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i - (MoistAir.xsaturation_pT(Pin, Tw) - MoistAir.xsaturation_pT(Pin, Ta)) * MoistAir.h_pTX(Pin, Tw, {1})) + (w - MoistAir.xsaturation_pT(Pin, Ta)) * cp * Tw) + (w - MoistAir.xsaturation_pT(Pin, Tw)) * cp * Tw);
end m;

Units.Velocity V_inlet; //Wind velocity entering cooling tower
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Units.Velocity V_inlet; //Wind velocity entering cooling tower
Units.Velocity V_inlet; //Air velocity at the bottom of the cooling tower

Copy link
Contributor

@hadrienp-met hadrienp-met left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a few comments to improve the CT components (mainly to make them clearer).
Also, don't forget to change the connector for the air side

@@ -0,0 +1,314 @@
within MetroscopeModelingLibrary.MultiFluid.HeatExchangers;
model CoolingTowerPoppe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment with the reference of the article we used

parameter Integer N_step = 10; //Parameter specifies the number of sections for which the Cooling Tower thermodynamic properties are divided into in the loop.

//Unsaturated Air - Equations from Poppe Method for Cooling Tower Analysis
function f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give a description for this function with the reference of the equation, see this example:

function quadrature "Integrate function y=integrand(x) from x1 to x2"
  input  Real x1;
  input  Real x2;
  input  Integrand integrand;   // Integrand is a partial function, see below
  // With default: input Integrand integrand := Modelica.Math.sin;
  output Real integral;
algorithm
  integral :=(x2-x1)*(integrand(x1) + integrand(x2))/2;
end quadrature;

y:= (cp * (Qw / Qa) * (MoistAir.xsaturation_pT(Pin, Tw) - w)) / (((MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)})) - i + (Lef-1) * ((MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i - (MoistAir.xsaturation_pT(Pin, Tw) - w) * MoistAir.h_pTX(Pin, Tw, {1}))) - (MoistAir.xsaturation_pT(Pin, Tw) - w) * cp * Tw));
end f;

function g
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a descriptions of the function

y:= ((Qw * cp) / Qa) * (1 + (((MoistAir.xsaturation_pT(Pin, Tw) - w) * (cp * Tw)) / ((MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i + ((Lef-1) * (MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i - (MoistAir.xsaturation_pT(Pin, Tw) - w) * MoistAir.h_pTX(Pin, Tw, {1}))) - (MoistAir.xsaturation_pT(Pin, Tw) - w) * cp * Tw))));
end g;

function h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a description of the function

import MetroscopeModelingLibrary.Utilities.Media.WaterSteamMedium;
import MetroscopeModelingLibrary.Utilities.Media.MoistAirMedium.specificEnthalpy;

Units.Velocity V_inlet; //Wind velocity entering cooling tower
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Units.Velocity V_inlet; //Wind velocity entering cooling tower
Units.Velocity V_inlet; //Air velocity at the bottom of the cooling tower

Inputs.InputReal efan; //Fan effiency
Units.Power W_fan; //Fan power

parameter String configuration = "natural draft";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parameter String configuration = "natural draft";
parameter String configuration = "natural";

Comment on lines 53 to 67
//Supersaturated Air - Equations from Poppe Method for Cooling Tower Analysis
function j
input Real Tw;
input Real Ta;
input Real w;
input Real i;
input Real cp;
input Real Qw;
input Real Qa;
input Real Pin;
input Real Lef;
output Real y;
algorithm
y:= (cp * (Qw / Qa) * (MoistAir.xsaturation_pT(Pin, Tw) - MoistAir.xsaturation_pT(Pin, Ta))) / (MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i + (Lef-1) * (MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i - (MoistAir.xsaturation_pT(Pin, Tw) - MoistAir.xsaturation_pT(Pin, Ta)) * (MoistAir.h_pTX(Pin, Tw, {1})) + (w - MoistAir.xsaturation_pT(Pin, Ta)) * cp * Tw) + (w - MoistAir.xsaturation_pT(Pin, Tw)) * cp * Tw);
end j;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//Supersaturated Air - Equations from Poppe Method for Cooling Tower Analysis
function j
input Real Tw;
input Real Ta;
input Real w;
input Real i;
input Real cp;
input Real Qw;
input Real Qa;
input Real Pin;
input Real Lef;
output Real y;
algorithm
y:= (cp * (Qw / Qa) * (MoistAir.xsaturation_pT(Pin, Tw) - MoistAir.xsaturation_pT(Pin, Ta))) / (MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i + (Lef-1) * (MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i - (MoistAir.xsaturation_pT(Pin, Tw) - MoistAir.xsaturation_pT(Pin, Ta)) * (MoistAir.h_pTX(Pin, Tw, {1})) + (w - MoistAir.xsaturation_pT(Pin, Ta)) * cp * Tw) + (w - MoistAir.xsaturation_pT(Pin, Tw)) * cp * Tw);
end j;
function j "Supersaturated Air - Equations from Poppe Method for Cooling Tower Analysis"
input Real Tw;
input Real Ta;
input Real w;
input Real i;
input Real cp;
input Real Qw;
input Real Qa;
input Real Pin;
input Real Lef;
output Real y;
algorithm
y:= (cp * (Qw / Qa) * (MoistAir.xsaturation_pT(Pin, Tw) - MoistAir.xsaturation_pT(Pin, Ta))) / (MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i + (Lef-1) * (MoistAir.h_pTX(Pin, Tw, {MoistAir.xsaturation_pT(Pin, Tw)}) - i - (MoistAir.xsaturation_pT(Pin, Tw) - MoistAir.xsaturation_pT(Pin, Ta)) * (MoistAir.h_pTX(Pin, Tw, {1})) + (w - MoistAir.xsaturation_pT(Pin, Ta)) * cp * Tw) + (w - MoistAir.xsaturation_pT(Pin, Tw)) * cp * Tw);
end j;

Units.Temperature T_hot_in;
Units.Temperature T_hot_out;

// Poppe Inputs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Poppe Inputs


for n in 1:N_step-1 loop

if w[n] < w_sat[n] then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a few comments to explain the loop and the if condition

rho_air_inlet = air_inlet_flow.rho_in;
rho_air_outlet = air_outlet_flow.rho_out;

//if configuration = "natural draft" then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can take the same equation of the Merkel model

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 this pull request may close these issues.

2 participants