When the stream contains a single compound, the material stream calculation routine will force a PH flash. You'll need to set the enthalpy instead of the temperature.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2016-09-30
Last edit: Anonymous 2021-12-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2016-10-03
Last edit: Anonymous 2021-12-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Reposting the answer incorrectly posted on another thread:
You're right, my mistake. At least you should know by now to set the PH specs correctly...
The reason why DWSIM switches to a PH flash when there's a single compound is because of the degrees of freedom. If you specify P and T with T being equal to the boiling point at P, how do we know if the state is liquid or vapor, or even worse, if there is any partial vaporization? The only way to know it is specifying enthalpy and finding the correct temperature and vapor fraction.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Calculate() has two bool parameters, the first one is to calculate equilibrium and the second one is to calculate stream phase properties. If you want to force a TP flash while still calculating the stream properties, call
I strongly believe that this should not be the standard calculation. DWSIM did this during its initial days and I ran into serious trouble with partial vaporization issues. There is no way to guarantee the state specification of a single compound with only T and P for simulation purposes. I believe that the correct way for you to do your procedure would be:
1 - Define P, T and your desired state (V, L or S)
2 - Calculate (or define) the enthalpy (H) with P, T and the desired state
3 - Calculate equilibrium with P and H.
Last edit: Daniel Medeiros 2016-10-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2016-10-06
Last edit: Anonymous 2021-12-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The DW_CalcEquilibrium is a routine from the Property Package class. It does an equilibrium calculation on the material stream currently associated with the property package instance, storing calculated phase amounts and composition on the respective Material Stream Phase instances.
Why don't you download the full source code from GitHub and open it on Visual Studio? It would be much easier to navigate and understand the code and the relations between the classes...
Last edit: SourceForge Support 2021-12-20
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2016-10-13
Last edit: Anonymous 2021-12-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your command tells the property package to perform a PV flash on the current material stream. First you'll need to set the vapor mole fraction, of course:
vapphase = mystream.GetPhase("Vapor")
vapphase.Properties.molarfraction = 0.5 # replace with the desired saturation value
mystream.PropertyPackage.DW_CalcEquilibrium(PropertyPackages.FlashSpec.P, PropertyPackages.FlashSpec.VAP)
After that you can check the calculated temperature for the desired saturation..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Last edit: Anonymous 2021-12-15
Last edit: Anonymous 2021-12-15
This is the same issue that I helped you with before: https://sourceforge.net/p/dwsim/discussion/scripting/thread/f8c48d5c/?limit=25#48f0
When the stream contains a single compound, the material stream calculation routine will force a PH flash. You'll need to set the enthalpy instead of the temperature.
Last edit: Anonymous 2021-12-15
Last edit: Anonymous 2021-12-15
Reposting the answer incorrectly posted on another thread:
You're right, my mistake. At least you should know by now to set the PH specs correctly...
The reason why DWSIM switches to a PH flash when there's a single compound is because of the degrees of freedom. If you specify P and T with T being equal to the boiling point at P, how do we know if the state is liquid or vapor, or even worse, if there is any partial vaporization? The only way to know it is specifying enthalpy and finding the correct temperature and vapor fraction.
If you really want do to it your way, check the Calculate() routine: https://github.com/DanWBR/dwsim4/blob/master/DWSIM.Thermodynamics/Material%20Stream/MaterialStream.vb#L316
Here is the logic for forcing a PH flash: https://github.com/DanWBR/dwsim4/blob/master/DWSIM.Thermodynamics/Material%20Stream/MaterialStream.vb#L383
Calculate() has two bool parameters, the first one is to calculate equilibrium and the second one is to calculate stream phase properties. If you want to force a TP flash while still calculating the stream properties, call
then
I strongly believe that this should not be the standard calculation. DWSIM did this during its initial days and I ran into serious trouble with partial vaporization issues. There is no way to guarantee the state specification of a single compound with only T and P for simulation purposes. I believe that the correct way for you to do your procedure would be:
1 - Define P, T and your desired state (V, L or S)
2 - Calculate (or define) the enthalpy (H) with P, T and the desired state
3 - Calculate equilibrium with P and H.
Last edit: Daniel Medeiros 2016-10-03
Last edit: Anonymous 2021-12-15
Sorry,
<redacted>
.The DW_CalcEquilibrium is a routine from the Property Package class. It does an equilibrium calculation on the material stream currently associated with the property package instance, storing calculated phase amounts and composition on the respective Material Stream Phase instances.
http://dwsim.inforside.com.br/api_help/html/M_DWSIM_Thermodynamics_PropertyPackages_PropertyPackage_DW_CalcEquilibrium.htm
Here's how it is called from the Material Stream's Calculate routine (the property package is accessed through the PropertyPackage variable:
https://github.com/DanWBR/dwsim4/blob/master/DWSIM.Thermodynamics/Material%20Stream/MaterialStream.vb#L353
Your call would be something like:
Why don't you download the full source code from GitHub and open it on Visual Studio? It would be much easier to navigate and understand the code and the relations between the classes...
Last edit: SourceForge Support 2021-12-20
Last edit: Anonymous 2021-12-15
The following snippet worked here:
I forgot to add a reference to DWSIM.Thermodynamics, where all thermo calculations are located now.
Last edit: Anonymous 2021-12-15
Last edit: Anonymous 2021-12-15
Your command tells the property package to perform a PV flash on the current material stream. First you'll need to set the vapor mole fraction, of course:
After that you can check the calculated temperature for the desired saturation..