I'm trying to simulate a steam desuperheater as a Custom UO.
How can I make the script to access Steam properties from the Property Packages (IAPW Steam Tables)?
In particular how to get the saturation temperature given the inlet stream pressure?
Thanks.
Luca
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Luca,
you don't need to do this in such a complicated way.
First you will select IAPW as your property package in simulation setup.
Then you just could use a cooler and specify vapour fraction mode with molar vapor fraction as "1". Now you have a stream at the actual dew point.
Now you go into a separate desuperheater which is modeled by a cooler again. Here you would need to select "HeatRemoved" as calculation mode now and just specify a small power to be removed, which will desuperheat your stream.
As an alternative you could select "OutletTemperature" mode and calculate this temperature in the spreadsheet table and write it back as setpoint to this second cooler object.
Sorry there is no special calculation mode for desuperheating available yet which would do the job in one single step.
Gregor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Luca,
it seems I missed the most simple solution which solves the problem in one step:
Just specify calculation mode "vapor fraction" with a value of 0.99 instead of 1.0 and you will get a little subcooling below dew temperature. Sure, there is only a temperature below dew point with at least two components. Otherwise you still end up at the dew temperature for a single component system.
But the solution you select depends on the problem you want to model.
Gregor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Gregor,
thanks for your further feedback. I was probably not clear in describing my steam desuperheater.
I want to desuperheat steam (say at 10 bar, 250'C) by mixing with liquid water (say at 15 bar, 110'C) to get as outlet saturated steam at 10bar. I tried to follow your explanation: it could work, i guess, though it requires some off-line calcualtion to backcalculate the heat exchanged in terms water flow.
Then I tried to simulate the desuperheater with a simple mixer with an Adjust to control the outlet vapor mole fraction to 0.9999 by manipulating the inlet water flowrate ... but it didn't work ... it gave me as outlet a vapor fraction of about 0.4 ...
Any other idea? Wouldn't it be easier to make a script as per my first post?
Luca
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Gregor,
thanks for the file: I made exactly the same, but mine did not converge as I left the default adjust paramaters.
I found however the model unstable and the water mass flow is almost always not corrected. E.g. from a heat balance, at the model conditions the needed water is 0.008 (kg/h)w per(kg/h)sh_steam. Initializing steam and water flow at 1 kg/h it could converge. Changing steam flow to any other value (say 3500) the model does not converge (or I could find the way to make it to converge).
I'm continuing to try to model a steam desuperhater through a UO + script.
Attached is the point where I'm now got stucked.
How can I get calculated the vapor enthalpy at saturation at fixed Pressure?
The function DW_CalcEnthalpy gives always an error in the State variable (e.g. "State is not defined").
I'm only able to get the saturated water enthalpy setting State at 0.
What am I missing?
Moreover, how can I direct the script output on the console window? (I checked in Options the ridirect to console, but I'm not able to print anything ...)
See if this works. It is better to use the CAPE-OPEN interfaces to get, set and calculate properties. Don't forget to make a copy of the stream and then do the calculations on the copy.
~~~~~~~~
~#
Steam Pressure Reducing and Desuperheating UO
Luca Sept 2015
import math
from System import Array
import sys
import DWSIM
Set the feed stream
SHin = ims3
Get temperature and pressure of the feed
Notice that the values returned are one-element vectors, not scalars
T = SHin.GetProp("temperature", "Overall", None, "", "") # K
P = SHin.GetProp("pressure", "Overall", None, "", "") # Pa
x2 = SHin.PropertyPackage.AUX_TSATi(P[0],0) # Saturation T at P
x4 = x2 - 273.16
Flowsheet.WriteMessage('{:.5f}'.format(x4))
Finally I succedeed and now the UO model is completed. I'm attaching here for your and/or others' reference.
Only a final small question.
After setting the outlet steam Pressure and Temperature at saturation conditions, the calculated and displayed enthaly and vapor fraction are referred to the saturated liquid (i.e. Vap Frac = 0)
Is in any way possible to tell that it should be saturated vapor instead (i.e. Vap Frac = 1)?
I worked around it by a small increase in the outlet T and it correctly gives the vap Frct = 1.
The problem you observed is because you specified T and P with a single-compound system. Both solutions are correct because there can be liquid or vapor at these conditions, but not both. To get the expected result, set pressure and enthalpy, DWSIM will do the rest.
You must also set the composition of the outlet stream. I like to do that by copying the data from another stream ('Assign' function) and then setting the new conditions. It will copy all data, but the conditions will be updated anyway.
You are absolutely right regarding the saturation conditions in terms of T and P for both saturated liquid and vapor. The thing is that I was not aware of the possibility to set stream's enthalpy.
Now everything is perfectly working.
Thanks again.
Luca
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Daniel,
I'm very new to IronPython script.
I'm trying to simulate a steam desuperheater as a Custom UO.
How can I make the script to access Steam properties from the Property Packages (IAPW Steam Tables)?
In particular how to get the saturation temperature given the inlet stream pressure?
Thanks.
Luca
Hi Luca,
you don't need to do this in such a complicated way.
First you will select IAPW as your property package in simulation setup.
Then you just could use a cooler and specify vapour fraction mode with molar vapor fraction as "1". Now you have a stream at the actual dew point.
Now you go into a separate desuperheater which is modeled by a cooler again. Here you would need to select "HeatRemoved" as calculation mode now and just specify a small power to be removed, which will desuperheat your stream.
As an alternative you could select "OutletTemperature" mode and calculate this temperature in the spreadsheet table and write it back as setpoint to this second cooler object.
Sorry there is no special calculation mode for desuperheating available yet which would do the job in one single step.
Gregor
Thanks a lot Gregor for your detailed explanation.
I'll try to do in this way and feedback.
Luca
Hi Luca,
it seems I missed the most simple solution which solves the problem in one step:
Just specify calculation mode "vapor fraction" with a value of 0.99 instead of 1.0 and you will get a little subcooling below dew temperature. Sure, there is only a temperature below dew point with at least two components. Otherwise you still end up at the dew temperature for a single component system.
But the solution you select depends on the problem you want to model.
Gregor
Hello Gregor,
thanks for your further feedback. I was probably not clear in describing my steam desuperheater.
I want to desuperheat steam (say at 10 bar, 250'C) by mixing with liquid water (say at 15 bar, 110'C) to get as outlet saturated steam at 10bar. I tried to follow your explanation: it could work, i guess, though it requires some off-line calcualtion to backcalculate the heat exchanged in terms water flow.
Then I tried to simulate the desuperheater with a simple mixer with an Adjust to control the outlet vapor mole fraction to 0.9999 by manipulating the inlet water flowrate ... but it didn't work ... it gave me as outlet a vapor fraction of about 0.4 ...
Any other idea? Wouldn't it be easier to make a script as per my first post?
Luca
Hi Luca,
i prepared a simple simulation for you which demonstrates the solution to your problem by utilising an adjust solver object.
Regards
Gregor
Last edit: Gregor Reichert 2015-08-26
Hello Gregor,
thanks for the file: I made exactly the same, but mine did not converge as I left the default adjust paramaters.
I found however the model unstable and the water mass flow is almost always not corrected. E.g. from a heat balance, at the model conditions the needed water is 0.008 (kg/h)w per(kg/h)sh_steam. Initializing steam and water flow at 1 kg/h it could converge. Changing steam flow to any other value (say 3500) the model does not converge (or I could find the way to make it to converge).
See attachment.
Thanks
Luca
Hello again.
I'm continuing to try to model a steam desuperhater through a UO + script.
Attached is the point where I'm now got stucked.
How can I get calculated the vapor enthalpy at saturation at fixed Pressure?
The function DW_CalcEnthalpy gives always an error in the State variable (e.g. "State is not defined").
I'm only able to get the saturated water enthalpy setting State at 0.
What am I missing?
Moreover, how can I direct the script output on the console window? (I checked in Options the ridirect to console, but I'm not able to print anything ...)
Thanks for any help.
Luca
Hi Luca,
See if this works. It is better to use the CAPE-OPEN interfaces to get, set and calculate properties. Don't forget to make a copy of the stream and then do the calculations on the copy.
~~~~~~~~
~#
Steam Pressure Reducing and Desuperheating UO
Luca Sept 2015
import math
from System import Array
import sys
import DWSIM
Set the feed stream
SHin = ims3
Get temperature and pressure of the feed
Notice that the values returned are one-element vectors, not scalars
T = SHin.GetProp("temperature", "Overall", None, "", "") # K
P = SHin.GetProp("pressure", "Overall", None, "", "") # Pa
x2 = SHin.PropertyPackage.AUX_TSATi(P[0],0) # Saturation T at P
x4 = x2 - 273.16
Flowsheet.WriteMessage('{:.5f}'.format(x4))
SHtmp = SHin.Duplicate()
SHtmp.SetProp("temperature", "Overall", None, "", "", Arrayfloat)
SHtmp.CalcProp(Arraystr
x3 = SHtmp.GetProp("enthalpy","Overall", None, "", "mass") # enthalpy of saturated Vapor, kJ/kg
Flowsheet.WriteMessage('{:.5f}'.format(x3[0]))
~~~~~~
Last edit: Daniel Medeiros 2015-09-03
Daniel,
thank for your suggestion and example.
Finally I succedeed and now the UO model is completed. I'm attaching here for your and/or others' reference.
Only a final small question.
After setting the outlet steam Pressure and Temperature at saturation conditions, the calculated and displayed enthaly and vapor fraction are referred to the saturated liquid (i.e. Vap Frac = 0)
Is in any way possible to tell that it should be saturated vapor instead (i.e. Vap Frac = 1)?
I worked around it by a small increase in the outlet T and it correctly gives the vap Frct = 1.
Thanks again to you all for the support.
Luca
Hi Luca,
The problem you observed is because you specified T and P with a single-compound system. Both solutions are correct because there can be liquid or vapor at these conditions, but not both. To get the expected result, set pressure and enthalpy, DWSIM will do the rest.
You must also set the composition of the outlet stream. I like to do that by copying the data from another stream ('Assign' function) and then setting the new conditions. It will copy all data, but the conditions will be updated anyway.
Last edit: Daniel Medeiros 2015-09-07
Hello Daniel,
thanks for your suggestions and comments.
You are absolutely right regarding the saturation conditions in terms of T and P for both saturated liquid and vapor. The thing is that I was not aware of the possibility to set stream's enthalpy.
Now everything is perfectly working.
Thanks again.
Luca
How Do I use P or T as scalar, Im struggling to use them to do simple arithmetic