diff --git a/compounds/Compound.py b/compounds/Compound.py index d3daccc..97af86d 100644 --- a/compounds/Compound.py +++ b/compounds/Compound.py @@ -1,9 +1,7 @@ -from pprint import pprint import xml.etree.ElementTree as ET +from pydantic import BaseModel from typing import Dict import os -import json -from pydantic import BaseModel def convert_string_to_float(string: str) -> float | str: try: diff --git a/property_packages/modular/builder/common_parsers.py b/property_packages/modular/builder/common_parsers.py index ef1cf74..f4d3a81 100644 --- a/property_packages/modular/builder/common_parsers.py +++ b/property_packages/modular/builder/common_parsers.py @@ -1,3 +1,4 @@ +from math import floor from typing import Any, Dict, List from .base_parser import BuildBase from compounds.Compound import Compound @@ -10,14 +11,8 @@ from idaes.models.properties.modular_properties.eos.ceos import Cubic, CubicType from idaes.models.properties.modular_properties.pure import RPP4, RPP3, Perrys from property_packages.modular.builder.data.chem_sep import ChemSep - -""" - - TODO: Need to double check all equation numbers - to throw errors if mis-matched or not found - -""" - +from pyomo.common.fileutils import this_file_dir +import csv class base_units_parser(BuildBase): @staticmethod @@ -188,7 +183,7 @@ def serialise_component(compound: Compound) -> Dict[str, Any]: class phase_equilibrium_state_parser(BuildBase): @staticmethod def serialise(compounds: List[Compound]) -> Dict[str, Any]: - return {("Vap", "Liq"): SmoothVLE} # TODO: Update to Smooth VLE_v2 https://github.com/IDAES/idaes-pse/blob/main/idaes/models/properties/modular_properties/phase_equil/smooth_VLE_2.py + return {("Vap", "Liq"): SmoothVLE} class phases_parser(BuildBase): @staticmethod @@ -217,13 +212,27 @@ def serialise(compounds: List[Compound]) -> Dict[str, Any]: return (101325, pyunits.Pa) class state_bounds_parser(BuildBase): + """ + State bounds are used to find optimal solution + TODO: need to find a way to dynamically determine these + """ @staticmethod def serialise(compounds: List[Compound]) -> Dict[str, Any]: - return { - "flow_mol": (0, 100, 1000, pyunits.mol / pyunits.s), - "temperature": (273.15, 300, 500, pyunits.K), - "pressure": (5e4, 1e5, 1e6, pyunits.Pa), - } + min_melting_point = min([compound["NormalMeltingPointTemperature"].value for compound in compounds]) + min_critical_temperature = min([compound["CriticalTemperature"].value for compound in compounds]) + + if(min_critical_temperature > 500): + return { + "flow_mol": (0, 100, 1000, pyunits.mol / pyunits.s), + "temperature": (min_melting_point, 300, 500, pyunits.K), + "pressure": (5e4, 1e5, 1e6, pyunits.Pa), + } + else: + return { + "flow_mol": (0, 100, 1000, pyunits.mol / pyunits.s), + "temperature": (min_melting_point, 150, 350, pyunits.K), + "pressure": (5e4, 1e5, 1e6, pyunits.Pa), + } class state_definition_parser(BuildBase): @staticmethod @@ -239,9 +248,37 @@ class pr_kappa_parser(BuildBase): @staticmethod def serialise(compounds: List[Compound]) -> Dict[str, Any]: kappa_parameters = {} + compound_id_map = {} + for i, compound1 in enumerate(compounds): + compound_id_map[str(floor(compound1["LibraryIndex"].value))] = compound1 for j, compound2 in enumerate(compounds): kappa_parameters[(compound1["CompoundID"].value, compound2["CompoundID"].value)] = 0.000 # Setting all interactions initially to zero - # TODO: Pass over the correct values + + # TODO: Adjust method so the multiple kappa values for single pair are supported + # Open and read the interaction data file + file = open(this_file_dir() + "/data/pr.dat", 'r') + reader = csv.reader(file, delimiter=';') + for row in reader: + + # Skip invalid rows + if len(row) < 4: + continue + + # Extract ID1, ID2, kappa (k12) and comment + id1, id2, kappa, _ = row + + try: + kappa_value = float(kappa) + except ValueError: + continue + + # Check if the compound IDs exist in the compound list + if id1 in compound_id_map and id2 in compound_id_map: + compound1 = compound_id_map[id1] + compound2 = compound_id_map[id2] + kappa_parameters[(compound1["CompoundID"].value, compound2["CompoundID"].value)] = kappa_value + kappa_parameters[(compound2["CompoundID"].value, compound1["CompoundID"].value)] = kappa_value + return {"PR_kappa": kappa_parameters} diff --git a/property_packages/modular/builder/data/chem_sep.py b/property_packages/modular/builder/data/chem_sep.py index 79682ae..5eba6b9 100644 --- a/property_packages/modular/builder/data/chem_sep.py +++ b/property_packages/modular/builder/data/chem_sep.py @@ -165,10 +165,6 @@ def build_parameters(cobj): @staticmethod def return_expression(b, cobj, T, dT=False): - - print("Calculating pressure saturation pressure") - print("at the specified temperature", value(T), u.get_units(T)) - psat = ( exp( cobj.pressure_sat_comp_coeff_A - cobj.pressure_sat_comp_coeff_B / diff --git a/property_packages/modular/builder/data/interaction_params.dat b/property_packages/modular/builder/data/interaction_params.dat deleted file mode 100644 index 5d2097b..0000000 --- a/property_packages/modular/builder/data/interaction_params.dat +++ /dev/null @@ -1,307 +0,0 @@ -=== CHEMSEP 3 === Copyright 1992 Harry Kooijman and Ross Taylor / Interaction Parameters Data (IPD) / DECHEMA Peng-Robinson Parameters / This library created by Amy L. Dill / Spring 1996 / Data: ID1. ID2. k12. comments -913;908;0.5463;Helium-4/CarbonMonoxide p203 -902;905;0.0711;Hydrogen/Nitrogen T=90-113K p210 -902;905;0.1196;Hydrogen/Nitrogen T=90-94.99K p212 -902;905;0.12;Hydrogen/Nitrogen T=77.35K p213 -902;908;0.0919;Hydrogen/CarbonMonoxide T=68.2-88.2K p215 -902;908;0.1;Hydrogen/CarbonMonoxide T=83.3-122.2K p217 -902;1;0.0263;Hydrogen/C1 T=90.3-127K p219 -902;1;0.0151;Hydrogen/C1 T=116.48-172.04K p221 -902;1;0.0596;Hydrogen/C1 T=90.65K p223 -902;1;-0.0044;Hydrogen/C1 T=103.15-173.65K p225 -902;1;-0.0144;Hydrogen/C1 T=103.15-163.15K p227 -902;201;0.0633;Hydrogen/Ethylene T=123.15-248.15K p229 -902;201;-0.0122;Hydrogen/Ethylene T=158.15-255.35K p231 -902;2;-0.0756;Hydrogen/C2 T=149.61-189.57K p233 -902;2;-0.0781;Hydrogen/C2 T=144.25-283.15K p235 -902;2;0.1896;Hydrogen/C2 T=158.15-188.15K p237 -902;2;-0.1104;Hydrogen/C2 T=144.21-199.65K p239 -902;2;-0.0022;Hydrogen/C2 T=148.15-223.15K p240 -902;909;-0.1622;Hydrogen/CarbonDioxide p242 -902;202;-0.1037;Hydrogen/Propylene p244 -902;3;-0.1311;Hydrogen/C3 T=173.15-348.15K p245 -902;3;-0.05;Hydrogen/C3 T=172.05-297.05K p246 -902;5;-0.397;Hydrogen/nC4 T=327.65-394.25K p247 -902;5;-0.3759;Hydrogen/nC4 T=355.37.388.71K p249 -902;11;-0.03;Hydrogen/nC6 p250 -902;17;-0.1167;Hydrogen/nC7 p253 -902;502;-0.51;Hydrogen/Toluene p255 -902;1748;-0.51;Hydrogen/Quinoline p259 -902;155;-0.51;Hydrogen/Bicyclohexyl p261 -902;702;0;Hydrogen/1-Methylnaphthalene p263 -905;908;0.033;Nitrogen//CarbonMonoxide T=83.82K p265 -905;908;0.03;Nitrogen/CarbonMonoxide T=70.00-122.00K p267 -905;914;-0.0026;Nitrogen/Argon T=83.82K p268 -905;914;-0.0004;Nitrogen/Argon T=80.92-115.21K p271 -905;914;-0.0052;Nitrogen/Argon T=90.50-120.00K p272 -905;914;0.0004;Nitrogen/Argon T=84.50K p273 -905;914;0.0056;Nitrogen/Argon T=89.89-113.00K p274 -905;914;-0.01;Nitrogen/Argon T=112.00K p275 -905;901;-0.0159;Nitrogen/Oxygen T=90.53-124.96K P=1.189-29.72bar p277 -905;901;-0.0093;Nitrogen/Oxygen T=81.07-91.00K P=1.218-1.350bar p278 -905;901;-0.0144;Nitrogen/Oxygen T=79-116K P=1.141-8.967bar p279 -905;901;-0.0133;Nitrogen/Oxygen T=75-125K p281 -905;901;-0.01;Nitrogen/Oxygen T=64.83-77.94K P=0.029-0.966bar p284 -905;1;0.0289;Nitrogen/C1 T=88.71-188.71K p285 -905;1;0.033;Nitrogen/C1 T=95-120K p287 -905;1;0.03;Nitrogen/C1 T=112-180K p289 -905;1;0.0363;Nitrogen/C1 T=90.68K p292 -905;1;0.0263;Nitrogen/C1 T=113.71-183.15K p294 -905;1;0.0316;Nitrogen/C1 T=112K p296 -905;201;0.0856;Nitrogen/Ethylene p298 -905;2;0.0344;Nitrogen/C2 T=200-290K p300 -905;2;0.0533;Nitrogen/C2 T=138.71-194.26K p302 -905;899;0.0044;Nitrogen/NitrousOxide p304 -905;909;-0.0222;Nitrogen/CarbonDioxide T=223.15-273.15K p306 -905;909;-0.0119;Nitrogen/CarbonDioxide T=273.15K p308 -905;909;-0.017;Nitrogen/CarbonDioxide T=273.15K p309 -905;909;-0.0193;Nitrogen/CarbonDioxide T=218.15-273.15K p310 -905;909;-0.0122;Nitrogen/CarbonDioxide T=233.15-293.15K p312 -905;909;-0.01;Nitrogen/CarbonDioxide T=270K p314 -905;1922;0.1789;Nitrogen/HydrogenSulfide T=227.98.200.15K p316 -905;1922;0.1652;Nitrogen/HydrogenSulfide T=256.43-344.26K p318 -905;202;0.09;Nitrogen/Propylene p320 -905;3;0.0878;Nitrogen/C3 T=143.15-353.15K p322 -905;3;0.0678;Nitrogen/C3 T=230-290K p324 -905;1911;0.2193;Nitrogen/Ammonia p326 -905;1601;0.0107;Nitrogen/DiChloroDiFlouroMethane p328 -905;4;0.1033;Nitrogen/Iso-C4 p330 -905;910;0.08;Nitrogen/SulfurDioxide p332 -905;5;0.0711;Nitrogen/nC4 T=310.93-422.04K p333 -905;5;0.0867;Nitrogen/nC4 T=310.93-410.93K p334 -905;8;0.0922;Nitrogen/Iso-C5 p336 -905;7;0.1;Nitrogen/nC5 p338 -905;1101;-0.2141;Nitrogen/Methanol p340 -905;11;0.1496;Nitrogen/nC6 p341 -905;501;0.1641;Nitrogen/Benzene p343 -905;17;0.1441;Nitrogen/nC7 p344 -905;27;-0.4;Nitrogen/nC8 p347 -905;56;0.1122;Nitrogen/nC10 T=310.93-410.93K p349 -908;1;0.03;CarbonMonoxide/C1 p353 -908;2;-0.0226;CarbonMonoxide/C2 p354 -908;1922;0.0544;CarbonMonoxide/HydrogenSulfide p356 -908;3;0.0259;CarbonMonoxide/C3 p358 -914;901;0.0107;Argon/Oxygen T=89.95-109.95K P=1.045-6.618bar p360 -914;901;0.0089;Argon/Oxygen T=90.5-120K P=1.043-12.092bar p362 -914;1;0.023;Argon/C1 T=91.6-123.9K p363 -914;1;0.0152;Argon/C1 T=123.4-164K P=10.132-35.434bar p364 -914;1;0.0078;Argon/C1 T=150.72-178K p365 -914;1;0.0241;Argon/C1 T=115.77K p367 -914;1;0.0311;Argon/C1 T=112.55-132.97K p369 -914;1911;-0.18;Argon/Ammonia p371 -901;920;0.0256;Oxygen/Krypton T=90.15-100.15K P=0.688-2.486bar p373 -901;920;0.0185;Oxygen/Krypton T=94.15-150.9K P=1.504-6.893bar p375 -901;899;0.0478;Oxygen/NitrousOxide p376 -1;201;0.0378;C1/Ethylene T=198.15-248.15K p378 -1;201;0.0204;C1/Ethylene T=148-169K p380 -1;201;0.0244;C1/Ethylene T=150-190K p383 -1;2;-0.0033;C1/C2 T=130.37-199.93K p385 -1;2;-0.0037;C1/C2 T=158.15-213.7K p388 -1;2;-0.0059;C1/C2 T=144.26-283.15 p390 -1;2;-0.0004;C1/C2 T=160-180K p392 -1;2;0.007;C1/C2 T=250K p394 -1;899;0.0256;C1/NitrousOxide p396 -1;909;0.0793;C1/CarbonDioxide T=173-220K P=26-66bar p398 -1;909;0.0978;C1/CarbonDioxide T=199.82-271.48K p399 -1;909;0.0889;C1/CarbonDioxide T=230-270K p401 -1;909;0.107;C1/CarbonDioxide T=270K p403 -1;909;0.0885;C1/CarbonDioxide T=153-219K p405 -1;909;0.0889;C1/CarbonDioxide T=153-219 p406 -1;1893;0.0289;C1/CarbonylSulfide p410 -1;202;0.033;C1/Propylene p412 -1;3;0.0119;C1/C3 T=130.37-213.71K p413 -1;3;0.021;C1/C3 T=277.59-360.93K p416 -1;4;0.0256;C1/Iso-C4 p419 -1;910;0.1356;C1/SulfurDioxide p421 -1;5;0.0244;C1/nC4 T=294-394K p422 -1;5;0.0185;C1/nC4 T=178-411K p425 -1;5;0.0148;C1/nC4 T=166-283K p428 -1;5;0.0085;C1/nC4 T=144-278K p430 -1;8;-0.0056;C1/Iso-C5 p436 -1;7;0.023;C1/nC5 T=278-461K p438 -1;7;0.0241;C1/nC5 T=311-444K p445 -1;7;0.026;C1/nC5 T=176-273K p447 -1;7;0.0281;C1/nC5 T=178-283K p449 -1;11;0.04;C1/nC6 T=183-423K p453 -1;11;0.0244;C1/nC6 T=310-410K p456 -1;11;0.0444;C1/nC6 T=182-273K p458 -1;501;0.0807;C1/Benzene T=421-501K p463 -1;501;0.0304;C1/Benzene T=338.71K p465 -1;137;0.0389;C1/CycloHexane p466 -1;17;0.0401;C1/nC7 T=200-255K p469 -1;17;0.03;C1/nC7 T=277-511K p471 -1;502;0.097;C1/Toluene p474 -1;27;0.0496;C1/nC8 p477 -1;506;0.0844;C1/M-Xylene p479 -1;46;0.0474;C1/nC9 p481 -1;56;0.0489;C1/nC10 T=244-277K p485 -1;56;0.0411;C1/nC10 T=311-511K p486 -1;56;0.0644;C1/nC10 T=423-583K p489 -1;1183;0.1285;C1/M-Cresol p492 -1;706;0.1452;C1/Tetralin p494 -1;702;0.1244;C1/1-MethylNaphthalene p497 -1;563;0.0874;C1/DiPhenylMethane p499 -201;2;0.0119;Ethylene/C2 T=200-255K P=2.2-26.7bar p503 -201;2;0.0278;Ethylene/C2 T=277-288K P=32-49bar p505 -201;2;0.0078;Ethylene/C2 T=169-273K P=0.4-41.1bar p507 -201;2;0.0089;Ethylene/C2 T=263-293K P=18.5-48.5bar p510 -201;401;0.0652;Ethylene/Acetylene p512 -201;909;0.0578;Ethylene/CarbonDioxide T=232-252K P=9.5-26.2bar p514 -201;909;0.0541;Ethylene/CarbonDioxide T=223-293K P=6.8-64.9bar p516 -201;5;0.0922;Ethylene/nC4 p518 -201;501;0.0311;Ethylene/Benzene p520 -201;17;0.0144;Ethylene/nC7 p522 -201;56;0.0253;Ethylene/nC10 p524 -909;2;0.1326;CarbonDioxide/C2 T=250K p525 -909;2;0.13;CarbonDioxide/C2 T=223-292K P=5.5-63bar p527 -909;2;0.1344;CarbonDioxide/C2 T=222-289K P=7-57bar p528 -909;2;0;CarbonDioxide/C2 T=283-298K P=30.4-66.3bar p529 -909;2;0.13;CarbonDioxide/C2 T=252.95K p530 -909;2;0.1278;CarbonDioxide/C2 T=241-283K P=10-49.5bar p532 -2;1922;0.0822;C2/HydrogenSulfide T=200-283 P=0.65-30.5bar p533 -2;1922;0.0952;C2/HydrogenSulfide T=251.5-368.5K p535 -2;1922;0.0863;C2/HydrogenSulfide T=283.15K p536 -2;202;0.0089;C2/Propylene p537 -2;3;0.0011;C2/C3 p539 -2;4;-0.0067;C2/Iso-C4 p542 -2;5;0.0089;C2/nC4 T=229-361K P=6.9-57.9bar p544 -2;5;0.0374;C2/nC4 T=338.7-394.3K p546 -2;1402;0.0181;C2/EthylEther p548 -2;7;0.0078;C2/nC5 p550 -2;1051;0.1307;C2/Acetone p552 -2;1312;0.1211;C2/MethylAcetate p554 -2;1101;0.027;C2/Methanol p555 -2;11;-0.04;C2/nC6 T=338.7-449.8K p557 -2;11;0.0041;C2/nC6 T=298.15K p559 -2;501;0.0322;C2/Benzene T=273-553K p561 -2;501;0.0493;C2/Benzene T=298.15K p563 -2;137;0.0178;C2/CycloHexane p565 -2;17;0.0074;C2/nC7 P=6.89-86.186bar p567 -2;17;0.0033;C2/nC7 T=338.71-449.82K p568 -2;27;0.0185;C2/nC8 p570 -2;56;0.0144;C2/nC10 p572 -909;899;0.0048;CarbonDioxide/NitrousOxide p575 -401;202;-0.43;Acetylene/Propylene p576 -1615;1606;0.1;TriFluoroMethane/TriFlouroChloroMethane p577 -1606;1601;0.0337;TriFluoroChloroMethane/DiChloroFluoroMethane p579 -909;1922;0.0978;CarbonDioxide/HydrogenSulfide T=225-363K p581 -909;1922;0.0967;CarbonDioxide/HydrogenSulfide T=254-366K p583 -909;1614;0.017;CarbonDioxide/DiFluoroMethane p585 -909;202;0.0933;CarbonDioxide/Propylene p587 -909;3;0.1315;CarbonDioxide/C3 T=277.59-344.26K p589 -909;3;0.0744;CarbonDioxide/C3 T=233.15-273.15K p591 -909;3;0.0978;CarbonDioxide/C3 T=272-366K P=33.3-53.3bar p593 -909;3;0.1281;CarbonDioxide/C3 T=244.26-266.48K p594 -909;3;0.1241;CarbonDioxide/C3 T=252.95-273.15K p596 -909;1601;0.0474;CarbonDioxide/C3 p598 -909;4;0.13;CarbonDioxide/Iso-C4 T=310.93-394.26K p601 -909;4;0.1174;CarbonDioxide/Iso-C4 P=273.15K p603 -909;204;0.0593;CarbonDioxide/1-Butene p605 -909;5;0.1352;CarbonDioxide/nC4 T=310.93-410.93K p607 -909;5;0.1415;CarbonDioxide/nC4 T=227.98-283.15K p609 -909;5;0.1122;CarbonDioxide/nC4 T=273.15K p610 -909;8;0.1219;CarbonDioxide/Iso-C5 p612 -909;1402;0.047;CarbonDioxide/EthylEther p614 -909;7;-0.01;CarbonDioxide/nC5 P=41.33-82.79bar p616 -909;7;0.1252;CarbonDioxide/nC5 T=277.65-377.59K p617 -909;1312;-0.0493;CarbonDioxide/MethylAcetate p619 -909;1101;0.022;CarbonDioxide/Methanol T=213-247K p621 -909;1101;0.0583;CarbonDioxide/Methanol T=298-313K p623 -909;11;0.11;CarbonDioxide/nC6 p625 -909;501;0.0774;CarbonDioxide/Benzene p627 -909;137;0.1052;CarbonDioxide/CycloHexane p629 -909;17;0.1;CarbonDioxide/nC7 p631 -909;502;0.1056;CarbonDioxide/Toluene p636 -909;56;0.1141;CarbonDioxide/nC10 p638 -909;518;0.1144;CarbonDioxide/nButylBenzene p641 -1922;3;0.06;HydrogenSulfide/C3 P=27.58-41.44bar p643 -1922;3;0.0878;HydrogenSulfide/C3 T=217-344K p644 -1922;4;0.0474;HydrogenSulfide/Iso-C4 p645 -1922;7;0.063;HydrogenSulfide/nC5 p647 -1922;1921;0.0394;HydrogenSulfide/Water T=303-443K p648 -1922;1921;0.0096;HydrogenSulfide/Water T=311-444K p650 -1922;56;0.0333;HydrogenSulfide/nC10 p652 -1922;3;-0.0189;HydrogenSulfide/C3 p653 -202;3;0.0096;Propylene/C3 T=223.75-239.35K P=0.724-1.833bar p654 -202;3;0.0078;Propylene/C3 T=269.54-333.93K P=4.385-23.594bar p656 -202;3;0.0074;Propylene/C3 T=260.93-360.93K P=3.416-41.613bar p657 -202;3;0.0063;Propylene/C3 T=310.93-344.26K P=13-31.356bar p658 -202;4;-0.0144;Propylene/Iso-C4 p660 -202;204;0.0004;Propylene/1-C4 p661 -3;4;-0.0078;C3/Iso-C4 p663 -3;5;0.0033;C3/nC4 p666 -3;8;0.0111;C3/Iso-C5 p668 -3;7;0.0267;C3/nC5 p671 -3;11;0.0007;C3/nC6 p674 -3;1102;0.0315;C3/Ethanol p676 -3;501;0.0233;C3/Benzene p679 -3;17;0.0056;C3/nC7 p681 -3;27;0;C3/nC8 p683 -3;56;0;C3/nC10 p686 -2692;1604;0.0874;PentaFlouroChloroEthane/DiFluoroChloroMethane p688 -1604;1601;0.0522;DiFluoroChloroMethane/DiChloroDiFluoroMethane p689 -4;5;-0.0004;Iso-C4/nC4 p694 -910;501;0.0015;SulfurDioxide/Benzene p696 -204;303;0.0022;1-Butene/1.3-Butadiene p697 -204;5;0.0007;1-Butene/nC4 T=311-411K P=3.55-34.89bar p699 -204;5;0.0041;1-Butene/nC4 T=311-339K P=3.55-8.69bar p700 -303;5;0.0141;1.3-Butadiene/nC4 p702 -5;7;0.0174;nC4/nC5 p704 -5;11;-0.0056;nC4/nC6 p706 -5;17;0.0033;nC4/nC7 p707 -5;27;0.0074;nC4/nC8 p708 -5;56;0.0078;nC4/nC10 p710 -8;7;0.06;Iso-C5/nC5 p715 -7;501;0.0189;nC5/Benzene T=255-289K P=0.069-0.469bar p716 -7;501;0.0167;nC5/Benzene P=1.014bar p718 -7;137;0.0037;nC5/CycleHexane p719 -7;17;0.0074;nC5/nC7 p720 -7;27;0;nC5/nC8 p721 -14;1109;0.0452;2.2-DiMethylButane/1-Pentanol p722 -15;1109;0.0467;2.3-DiMethylButane/1-Pentanol p724 -12;1109;0.0467;2-MethylPentane/1-Pentanol p726 -1109;13;0.0478;1-Pentanol/3-MethylPentane p728 -1101;1921;-0.0778;Methanol/Water p730 -11;501;0.0089;nC6/Benzene T=298.15K p732 -11;501;0.0096;nC6/Benzene T=333.15K p734 -11;501;0.0122;nC6/Benzene P=980bar p737 -11;501;0.1;nC6/Benzene T=341.75-351.05K P=1.014bar p738 -11;501;0.0078;nC6/Benzene T=341.50-353.30K P=1.014bar p739 -11;501;0.0037;nC6/Benzene T=278-298K P=0.053-0.205bar p740 -11;137;-0.003;nC6/CycloHexane P=1.014bar p742 -11;137;-0.0049;nC6/CycloHexane T=273-298K P=0.041-0.203bar p743 -11;1104;0.0844;nC6/2-Propanol p744 -11;17;-0.0078;nC6/nC7 p745 -11;1123;0.0485;nC6/I-Pentanol p747 -11;1109;0.0456;nC6/1-Pentanol p749 -137;501;0.0126;CycloHexane/Benzene p752 -501;17;0.0011;Benzene/nC7 T=333.15K P=0.316-0.518bar p753 -501;17;0.0022;Benzene/nC7 T=353-371K P=1.014bar p755 -501;17;0.0011;Benzene/nC7 T=353.3-371.6K P=1.014bar p756 -501;41;0.0004;Benzene/I-Octane p757 -501;27;0.003;Benzene/nC8 p758 -270;137;0.0011;CycloHexene/CycloHexane p761 -137;1523;0.073;CycloHexane/1.2-DiChloroEthane p762 -137;1080;0.0659;CycloHexane/CycloHexanone p763 -1523;270;0.043;1.2-DiChloroEthane/CycloHexene p765 -17;41;0.0004;nC7/I-Octane p766 -17;1060;0.0693;nC7/2-Pentanone p767 -1921;909;-0.12155;Water/CO2 -1921;1911;-0.2533;Water/Ammonia -1921;1922;0.0819;Water/H2S -1922;909;0.1000;H2S/CO2 -1921;1;0.500;Water/HC -1921;2;0.500;Water/HC -1921;3;0.500;Water/HC -1921;4;0.500;Water/HC -1921;5;0.500;Water/HC -1921;6;0.500;Water/HC -1921;7;0.500;Water/HC -1921;8;0.500;Water/HC -1921;9;0.500;Water/HC -1921;10;0.500;Water/HC -1921;11;0.500;Water/HC -1921;17;0.500;Water/HC -1921;27;0.500;Water/HC -1921;46;0.500;Water/HC -1921;56;0.500;Water/HC \ No newline at end of file diff --git a/property_packages/modular/template_builder.py b/property_packages/modular/template_builder.py index 34ebdcd..7359e9a 100644 --- a/property_packages/modular/template_builder.py +++ b/property_packages/modular/template_builder.py @@ -1,5 +1,4 @@ -from pprint import pprint from idaes.models.properties.modular_properties.base.generic_property import GenericParameterBlock from compounds.CompoundDB import get_compound from .templates.templates import PropertyPackage diff --git a/property_packages/tests/test_asu_pr.py b/property_packages/tests/test_asu_pr.py new file mode 100644 index 0000000..85a35ea --- /dev/null +++ b/property_packages/tests/test_asu_pr.py @@ -0,0 +1,224 @@ +import pytest +from pyomo.environ import ( + check_optimal_termination, + ConcreteModel, + Set, + value, + Var, + units as pyunits, +) +from pyomo.util.check_units import assert_units_consistent +from pyomo.common.unittest import assertStructuredAlmostEqual + +from idaes.core import Component +from idaes.core.util.model_statistics import ( + degrees_of_freedom, + fixed_variables_set, + activated_constraints_set, +) +from idaes.core.solvers import get_solver + +from idaes.models.properties.modular_properties.state_definitions import FTPx +from idaes.models.properties.modular_properties.phase_equil import SmoothVLE +from idaes.models.properties.modular_properties.examples.ASU_PR import configuration +from idaes.models.properties.modular_properties.eos.ceos import cubic_roots_available +from idaes.models.properties.modular_properties.base.generic_property import GenericParameterBlock +from ..build_package import build_package + +solver = get_solver("ipopt") + +def assert_approx(value, expected_value, error_margin): + percent_error = error_margin / 100 + tolerance = abs(percent_error * expected_value) + assert pytest.approx(value, abs=tolerance) == expected_value + + +def _as_quantity(x): + unit = pyunits.get_units(x) + if unit is None: + unit = pyunits.dimensionless + return value(x) * unit._get_pint_unit() + + +class TestParamBlock(object): + def test_build(self): + model = ConcreteModel() + model.params = build_package("peng-robinson", ["nitrogen", "argon", "oxygen"]) + + assert isinstance(model.params.phase_list, Set) + assert len(model.params.phase_list) == 2 + for i in model.params.phase_list: + assert i in ["Liq", "Vap"] + assert model.params.Liq.is_liquid_phase() + assert model.params.Vap.is_vapor_phase() + + assert isinstance(model.params.component_list, Set) + assert len(model.params.component_list) == 3 + for i in model.params.component_list: + assert i in ["nitrogen", "argon", "oxygen"] + assert isinstance(model.params.get_component(i), Component) + + assert isinstance(model.params._phase_component_set, Set) + assert len(model.params._phase_component_set) == 6 + for i in model.params._phase_component_set: + assert i in [ + ("Liq", "nitrogen"), + ("Liq", "argon"), + ("Liq", "oxygen"), + ("Vap", "nitrogen"), + ("Vap", "argon"), + ("Vap", "oxygen"), + ] + + assert model.params.config.state_definition == FTPx + + assertStructuredAlmostEqual( + model.params.config.state_bounds, + { + "flow_mol": (0, 100, 1000, pyunits.mol / pyunits.s), + "temperature": (54.361, 150, 350, pyunits.K), + "pressure": (5e4, 1e5, 1e6, pyunits.Pa), + }, + item_callback=_as_quantity, + ) + + assert model.params.config.phase_equilibrium_state == { + ("Vap", "Liq"): SmoothVLE + } + + assert isinstance(model.params.phase_equilibrium_idx, Set) + assert len(model.params.phase_equilibrium_idx) == 3 + for i in model.params.phase_equilibrium_idx: + assert i in ["PE1", "PE2", "PE3"] + + assert model.params.phase_equilibrium_list == { + "PE1": {"nitrogen": ("Vap", "Liq")}, + "PE2": {"argon": ("Vap", "Liq")}, + "PE3": {"oxygen": ("Vap", "Liq")}, + } + + assert_approx(model.params.pressure_ref.value, 101325, 0.2) + assert_approx(model.params.temperature_ref.value, 298.15, 0.2) + + assert_approx(model.params.nitrogen.mw.value, 28.0135e-3, 0.2) + assert_approx(model.params.nitrogen.pressure_crit.value, 34e5, 0.2) + assert_approx(model.params.nitrogen.temperature_crit.value, 126.2, 0.2) + + assert_approx(model.params.argon.mw.value, 39.948e-3, 0.2) + assert_approx(model.params.argon.pressure_crit.value, 48.98e5, 0.2) + assert_approx(model.params.argon.temperature_crit.value, 150.86, 0.2) + + assert_approx(model.params.oxygen.mw.value, 31.999e-3, 0.2) + assert_approx(model.params.oxygen.pressure_crit.value, 50.43e5, 0.2) + assert_approx(model.params.oxygen.temperature_crit.value, 154.58, 0.2) + + assert_units_consistent(model) + + +@pytest.mark.skipif(not cubic_roots_available(), reason="Cubic functions not available") +class TestStateBlock(object): + + @pytest.fixture(scope="class") + def model(self): + model = ConcreteModel() + model.params = build_package("peng-robinson", ["nitrogen", "argon", "oxygen"]) + model.props = model.params.build_state_block([1], defined_state=True) + return model + + def test_build(self, model): + # Check state variable values and bounds + assert isinstance(model.props[1].flow_mol, Var) + assert value(model.props[1].flow_mol) == 100 + assert model.props[1].flow_mol.ub == 1000 + assert model.props[1].flow_mol.lb == 0 + + assert isinstance(model.props[1].pressure, Var) + assert value(model.props[1].pressure) == 1e5 + assert model.props[1].pressure.ub == 1e6 + assert model.props[1].pressure.lb == 5e4 + + assert isinstance(model.props[1].temperature, Var) + assert value(model.props[1].temperature) == 150 + assert model.props[1].temperature.ub == 350 + assert model.props[1].temperature.lb == 54.361 + + assert isinstance(model.props[1].mole_frac_comp, Var) + assert len(model.props[1].mole_frac_comp) == 3 + for i in model.props[1].mole_frac_comp: + assert value(model.props[1].mole_frac_comp[i]) == 1 / 3 + + assert_units_consistent(model) + + def test_define_state_vars(self, model): + sv = model.props[1].define_state_vars() + + assert len(sv) == 4 + for i in sv: + assert i in ["flow_mol", "mole_frac_comp", "temperature", "pressure"] + + def test_define_port_members(self, model): + sv = model.props[1].define_state_vars() + + assert len(sv) == 4 + for i in sv: + assert i in ["flow_mol", "mole_frac_comp", "temperature", "pressure"] + + def test_define_display_vars(self, model): + sv = model.props[1].define_display_vars() + + assert len(sv) == 4 + for i in sv: + assert i in [ + "Total Molar Flowrate", + "Total Mole Fraction", + "Temperature", + "Pressure", + ] + + def test_initialize(self, model): + # Fix state + model.props[1].flow_mol.fix(1) + model.props[1].temperature.fix(85.00) + model.props[1].pressure.fix(101325) + model.props[1].mole_frac_comp["nitrogen"].fix(1 / 3) + model.props[1].mole_frac_comp["argon"].fix(1 / 3) + model.props[1].mole_frac_comp["oxygen"].fix(1 / 3) + + assert degrees_of_freedom(model.props[1]) == 0 + + orig_fixed_vars = fixed_variables_set(model) + orig_act_consts = activated_constraints_set(model) + + model.props.initialize(optarg={"tol": 1e-6}) + + assert degrees_of_freedom(model) == 0 + + fin_fixed_vars = fixed_variables_set(model) + fin_act_consts = activated_constraints_set(model) + + assert len(fin_act_consts) == len(orig_act_consts) + assert len(fin_fixed_vars) == len(orig_fixed_vars) + + for c in fin_act_consts: + assert c in orig_act_consts + for v in fin_fixed_vars: + assert v in orig_fixed_vars + + def test_solve(self, model): + results = solver.solve(model) + + # Check for optimal solution + assert check_optimal_termination(results) + + def test_solution(self, model): + # Check phase equilibrium results + assert_approx(model.props[1].mole_frac_phase_comp[ + "Liq", "nitrogen" + ].value, 0.1739, 2) + assert_approx(model.props[1].mole_frac_phase_comp[ + "Vap", "nitrogen" + ].value, 0.4221, 2) + assert_approx(model.props[1].phase_frac["Vap"].value, 0.6422, 2) + + def test_report(self, model): + model.props[1].report() \ No newline at end of file diff --git a/property_packages/tests/test_bt_pr.py b/property_packages/tests/test_bt_pr.py index e770993..5259aba 100644 --- a/property_packages/tests/test_bt_pr.py +++ b/property_packages/tests/test_bt_pr.py @@ -1,5 +1,4 @@ # Build and solve a state block. -from pprint import pprint from ..build_package import build_package from pytest import approx @@ -94,7 +93,7 @@ def test_P_sweep(): m.fs.state[1].mole_frac_comp["toluene"].fix(0.5) m.fs.state[1].temperature.fix(T) m.fs.state[1].pressure.fix(1e5) - + print(T) m.fs.state.initialize() results = solver.solve(m) diff --git a/property_packages/tests/test_config.py b/property_packages/tests/test_config.py deleted file mode 100644 index 4dbb452..0000000 --- a/property_packages/tests/test_config.py +++ /dev/null @@ -1,877 +0,0 @@ -################################################################################# -# The Institute for the Design of Advanced Energy Systems Integrated Platform -# Framework (IDAES IP) was produced under the DOE Institute for the -# Design of Advanced Energy Systems (IDAES). -# -# Copyright (c) 2018-2024 by the software owners: The Regents of the -# University of California, through Lawrence Berkeley National Laboratory, -# National Technology & Engineering Solutions of Sandia, LLC, Carnegie Mellon -# University, West Virginia University Research Corporation, et al. -# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md -# for full copyright and license information. -################################################################################# -""" -Hydrocarbon processing phase equilibrium package using Peng-Robinson EoS. - -Example property package using the Generic Property Package Framework. -This example shows how to set up a property package to do hydrocarbon -processing phase equilibrium in the generic framework using Peng-Robinson -equation along with methods drawn from the pre-built IDAES property libraries. - -The example includes the dictionary named configuration contains parameters -for calculating VLE phase equilibrium and properties for hydrocarbon processing. -""" - -# Import Python libraries -import logging - -# Import Pyomo units -from pyomo.environ import units as pyunits - -# Import IDAES cores -from idaes.core import LiquidPhase, VaporPhase, Component, PhaseType as PT -from idaes.models.properties.modular_properties.state_definitions import FTPx -from idaes.models.properties.modular_properties.eos.ceos import Cubic, CubicType -from idaes.models.properties.modular_properties.phase_equil import SmoothVLE -from idaes.models.properties.modular_properties.phase_equil.bubble_dew import ( - LogBubbleDew, -) -from idaes.models.properties.modular_properties.phase_equil.forms import log_fugacity - -from idaes.models.properties.modular_properties.pure import Perrys -from idaes.models.properties.modular_properties.pure import RPP4 -from idaes.models.properties.modular_properties.pure import RPP5 - -from ..modular.builder.data.chem_sep import ChemSep - -# Set up logger -_log = logging.getLogger(__name__) - - -# --------------------------------------------------------------------- -# Configuration dictionary for a Prng Robinson alkene system - -# Data Sources: -# [1] The Properties of Gases and Liquids (1987) -# 4th edition, Chemical Engineering Series - Robert C. Reid -# [2] Perry's Chemical Engineers' Handbook 7th Ed. -# Converted to J/mol.K, mol/m^3 -# [3] Engineering Toolbox, https://www.engineeringtoolbox.com -# Retrieved 15th september, 2020 -# [4] The Properties of Gases and Liquids (2001) -# 5th edition, Chemical Engineering Series - Robert C. Reid - -configuration = { - # Specifying components - - 'components': { - '1-butene': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (36492.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (66.383, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.51076, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.00068154, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (2.6315e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (100270.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (86.345, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (7.7333, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (0.00096546, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (2.0281e-05, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (0.98, pyunits.kmol / pyunits.m**3), - '2': (0.25169, None), - '3': (419.54, pyunits.K), - '4': (0.26645, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-500000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-307400.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (56.10632, pyunits.kg / pyunits.kmol), - 'omega': 0.194, - 'pressure_crit': (4020000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (21.09, None), - 'B': (2368.5, pyunits.K), - 'C': (-19.25, pyunits.K), - }, - 'temperature_crit': (419.5, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - '1-heptene': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (62525.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (106.62, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (1.0534, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.0014615, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (5.8492e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (58419.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (89.259, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (10.549, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (0.0039271, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (-8.6181e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (0.26107, pyunits.kmol / pyunits.m**3), - '2': (0.16952, None), - '3': (537.3, pyunits.K), - '4': (0.1874, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-62890000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-425200.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (98.18607, pyunits.kg / pyunits.kmol), - 'omega': 0.343, - 'pressure_crit': (2920000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (20.78, None), - 'B': (2900.8, pyunits.K), - 'C': (-53.334, pyunits.K) - }, - 'temperature_crit': (537.3, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - '1-hexene': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (52406.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (102.7, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.8529, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.0011866, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (4.7459e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (120740.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (197.35, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (7.4671, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (0.012038, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (-7.6352e-06, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (0.42588, pyunits.kmol / pyunits.m**3), - '2': (0.20073, None), - '3': (504.0, pyunits.K), - '4': (0.21659, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-41670000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-386300.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (84.15948, pyunits.kg / pyunits.kmol), - 'omega': 0.281, - 'pressure_crit': (3143000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (21.306, None), - 'B': (2992.5, pyunits.K), - 'C': (-30.644, pyunits.K) - }, - 'temperature_crit': (504.0, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - '1-octene': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (72710.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (110.08, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (1.2552, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.0017373, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (6.9559e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (-24253.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (87.834, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (11.35, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (0.0032002, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (-1.2467e-06, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (0.44684, pyunits.kmol / pyunits.m**3), - '2': (0.23463, None), - '3': (567.0, pyunits.K), - '4': (0.24846, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-81940000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-463700.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (112.2126, pyunits.kg / pyunits.kmol), - 'omega': 0.393, - 'pressure_crit': (2680000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (20.716, None), - 'B': (3032.4, pyunits.K), - 'C': (-64.529, pyunits.K) - }, - 'temperature_crit': (567.0, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - '1-pentene': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (42229.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (99.1, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.65169, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.00091143, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (3.6426e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (92753.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (117.21, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (8.6537, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (0.007447, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (-2.6759e-06, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (0.44335, pyunits.kmol / pyunits.m**3), - '2': (0.18566, None), - '3': (473.43, pyunits.K), - '4': (0.23587, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-21620000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-346200.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (70.1329, pyunits.kg / pyunits.kmol), - 'omega': 0.237, - 'pressure_crit': (3560000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (21.064, None), - 'B': (2629.6, pyunits.K), - 'C': (-27.471, pyunits.K) - }, - 'temperature_crit': (464.8, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - 'ethane': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (34738.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-36.808, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.4706, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.000553, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (2.0678e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (68726.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-1953.6, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (31.772, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.10571, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (0.00019673, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (1.3749, pyunits.kmol / pyunits.m**3), - '2': (0.23949, None), - '3': (305.43, pyunits.K), - '4': (0.22875, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-83820000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-229120.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (30.06904, pyunits.kg / pyunits.kmol), - 'omega': 0.099, - 'pressure_crit': (4872000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (20.962, None), - 'B': (1665.8, pyunits.K), - 'C': (-7.8809, pyunits.K) - }, - 'temperature_crit': (305.32, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - 'ethylene': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (35095.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-73.018, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.48182, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.00055948, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (2.0878e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (68016.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-22414.0, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (286.75, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-1.1802, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (0.0017304, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (2.3782, pyunits.kmol / pyunits.m**3), - '2': (0.29542, None), - '3': (282.36, pyunits.K), - '4': (0.32456, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (52510000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-219200.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (28.05316, pyunits.kg / pyunits.kmol), - 'omega': 0.087, - 'pressure_crit': (5041000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (20.89, None), - 'B': (1502.3, pyunits.K), - 'C': (-8.9148, pyunits.K) - }, - 'temperature_crit': (282.34, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - 'hydrogen': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - "valid_phase_types": PT.vaporPhase, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (23052.64, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (33.74914, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (-0.0639907, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (5.1023e-05, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (-1.37699e-08, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (14510.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-1191.1, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (156.51, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-6.1773, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (0.087907, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (2.9613, pyunits.kmol / pyunits.m**3), - '2': (0.25981, None), - '3': (33.19, pyunits.K), - '4': (0.19104, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (0.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-130571.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (2.01588, pyunits.kg / pyunits.kmol), - 'omega': -0.215993, - 'pressure_crit': (1313000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (18.072, None), - 'B': (137.26, pyunits.K), - 'C': (0.53751, pyunits.K) - }, - 'temperature_crit': (33.19, pyunits.K) - }, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - 'isobutane': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (27862.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (148.69, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.45538, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.00067339, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (2.6964e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (89466.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-323.61, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (12.827, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.010476, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (2.5037e-05, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (0.89934, pyunits.kmol / pyunits.m**3), - '2': (0.25371, None), - '3': (407.85, pyunits.K), - '4': (0.25125, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-134990000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-295500.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (58.1222, pyunits.kg / pyunits.kmol), - 'omega': 0.186, - 'pressure_crit': (3640000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (20.913, None), - 'B': (2269.9, pyunits.K), - 'C': (-19.458, pyunits.K) - }, - 'temperature_crit': (407.85, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - 'methane': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - "valid_phase_types": PT.vaporPhase, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (37981.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-74.622, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.3019, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.00028327, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (9.0711e-08, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (61157.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (5034.1, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (-48.913, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.22998, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (0.0022243, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (1.894, pyunits.kmol / pyunits.m**3), - '2': (0.23603, None), - '3': (191.05, pyunits.K), - '4': (0.21974, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-74520000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-186270.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (16.04246, pyunits.kg / pyunits.kmol), - 'omega': 0.011, - 'pressure_crit': (4599000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (20.701, None), - 'B': (1035.0, pyunits.K), - 'C': (1.2704, pyunits.K) - }, - 'temperature_crit': (190.56, pyunits.K) - }, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - 'n-butane': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (46120.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (46.029, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.6699, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.00087892, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (3.4372e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (115150.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-3564.7, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (41.067, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.098803, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (0.0001183, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (1.0023, pyunits.kmol / pyunits.m**3), - '2': (0.26457, None), - '3': (425.17, pyunits.K), - '4': (0.27138, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-125790000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-309910.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (58.1222, pyunits.kg / pyunits.kmol), - 'omega': 0.199, - 'pressure_crit': (3796000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (20.958, None), - 'B': (2350.4, pyunits.K), - 'C': (-23.412, pyunits.K) - }, - 'temperature_crit': (425.12, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - 'propane': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': ChemSep, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': ChemSep, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (31986.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (42.662, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (0.49978, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.00065626, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (2.56e-07, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (87486.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (-13371.0, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (156.92, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (-0.5459, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (0.00068504, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (1.3186, pyunits.kmol / pyunits.m**3), - '2': (0.27005, None), - '3': (369.86, pyunits.K), - '4': (0.27852, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (-104680000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-270200.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (44.09562, pyunits.kg / pyunits.kmol), - 'omega': 0.152, - 'pressure_crit': (4248000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (21.04, None), - 'B': (2072.9, pyunits.K), - 'C': (-13.18, pyunits.K) - }, - 'temperature_crit': (369.83, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - }, - 'propylene': { - 'dens_mol_liq_comp': Perrys, - 'enth_mol_ig_comp': RPP4, - 'enth_mol_liq_comp': ChemSep, - 'entr_mol_ig_comp': RPP4, - 'entr_mol_liq_comp': ChemSep, - 'parameter_data': { - 'cp_mol_ig_comp_coeff': { - 'A': (5083.56, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (225.639, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (-0.0999265, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (1.33106e-05, pyunits.J / pyunits.kmol / pyunits.K**4) - }, - 'cp_mol_liq_comp_coeff': { - 'A': (79790.0, pyunits.J / pyunits.kmol / pyunits.K), - 'B': (300.8, pyunits.J / pyunits.kmol / pyunits.K**2), - 'C': (5.1342, pyunits.J / pyunits.kmol / pyunits.K**3), - 'D': (0.0095615, pyunits.J / pyunits.kmol / pyunits.K**4), - 'E': (1.2777e-05, pyunits.J / pyunits.kmol / pyunits.K**5) - }, - 'dens_mol_liq_comp_coeff': { - '1': (0.98129, pyunits.kmol / pyunits.m**3), - '2': (0.22226, None), - '3': (365.58, pyunits.K), - '4': (0.24039, None), - 'eqn_type': 1 - }, - 'enth_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol), - 'enth_mol_form_vap_comp_ref': (20230000.0, pyunits.J / pyunits.kmol), - 'entr_mol_form_liq_comp_ref': (0, pyunits.J / pyunits.kmol / pyunits.K), - 'entr_mol_form_vap_comp_ref': (-267000.0, pyunits.J / pyunits.kmol / pyunits.K), - 'mw': (42.07974, pyunits.kg / pyunits.kmol), - 'omega': 0.137588, - 'pressure_crit': (4600000.0, pyunits.Pa), - 'pressure_sat_comp_coeff': { - 'A': (20.886, None), - 'B': (1932.7, pyunits.K), - 'C': (-18.939, pyunits.K) - }, - 'temperature_crit': (364.85, pyunits.K) - }, - 'phase_equilibrium_form': {('Vap', 'Liq'): log_fugacity}, - 'pressure_sat_comp': ChemSep, - 'type': Component - } - }, - - # Specifying phases - "phases": { - "Liq": { - "type": LiquidPhase, - "equation_of_state": Cubic, - "equation_of_state_options": {"type": CubicType.PR}, - }, - "Vap": { - "type": VaporPhase, - "equation_of_state": Cubic, - "equation_of_state_options": {"type": CubicType.PR}, - }, - }, - - # Set base units of measurement - "base_units": { - "time": pyunits.s, - "length": pyunits.m, - "mass": pyunits.kg, - "amount": pyunits.mol, - "temperature": pyunits.K, - }, - - # Specifying state definition - "state_definition": FTPx, - "state_bounds": { - "flow_mol": (0, 100, 1000, pyunits.mol / pyunits.s), - "temperature": (273.15, 300, 1500, pyunits.K), - "pressure": (5e4, 1e5, 1e7, pyunits.Pa), - }, - - "pressure_ref": (101325, pyunits.Pa), - "temperature_ref": (298.15, pyunits.K), - # Defining phase equilibria - "phases_in_equilibrium": [("Vap", "Liq")], - "phase_equilibrium_state": {("Vap", "Liq"): SmoothVLE}, - "bubble_dew_method": LogBubbleDew, - "parameter_data": { - "PR_kappa": { - ("hydrogen", "hydrogen"): 0.000, - ("hydrogen", "methane"): 0.000, - ("hydrogen", "ethane"): 0.000, - ("hydrogen", "propane"): 0.000, - ("hydrogen", "n-butane"): 0.000, - ("hydrogen", "isobutane"): 0.000, - ("hydrogen", "ethylene"): 0.000, - ("hydrogen", "propylene"): 0.000, - ("hydrogen", "1-butene"): 0.000, - ("hydrogen", "1-pentene"): 0.000, - ("hydrogen", "1-hexene"): 0.000, - ("hydrogen", "1-heptene"): 0.000, - ("hydrogen", "1-octene"): 0.000, - ("methane", "hydrogen"): 0.000, - ("methane", "methane"): 0.000, - ("methane", "ethane"): 0.000, - ("methane", "propane"): 0.000, - ("methane", "n-butane"): 0.000, - ("methane", "isobutane"): 0.000, - ("methane", "ethylene"): 0.000, - ("methane", "propylene"): 0.000, - ("methane", "1-butene"): 0.000, - ("methane", "1-pentene"): 0.000, - ("methane", "1-hexene"): 0.000, - ("methane", "1-heptene"): 0.000, - ("methane", "1-octene"): 0.000, - ("ethane", "hydrogen"): 0.000, - ("ethane", "methane"): 0.000, - ("ethane", "ethane"): 0.000, - ("ethane", "propane"): 0.000, - ("ethane", "n-butane"): 0.000, - ("ethane", "isobutane"): 0.000, - ("ethane", "ethylene"): 0.000, - ("ethane", "propylene"): 0.000, - ("ethane", "1-butene"): 0.000, - ("ethane", "1-pentene"): 0.000, - ("ethane", "1-hexene"): 0.000, - ("ethane", "1-heptene"): 0.000, - ("ethane", "1-octene"): 0.000, - ("propane", "hydrogen"): 0.000, - ("propane", "methane"): 0.000, - ("propane", "ethane"): 0.000, - ("propane", "propane"): 0.000, - ("propane", "n-butane"): 0.000, - ("propane", "isobutane"): 0.000, - ("propane", "ethylene"): 0.000, - ("propane", "propylene"): 0.000, - ("propane", "1-butene"): 0.000, - ("propane", "1-pentene"): 0.000, - ("propane", "1-hexene"): 0.000, - ("propane", "1-heptene"): 0.000, - ("propane", "1-octene"): 0.000, - ("n-butane", "hydrogen"): 0.000, - ("n-butane", "methane"): 0.000, - ("n-butane", "ethane"): 0.000, - ("n-butane", "propane"): 0.000, - ("n-butane", "n-butane"): 0.000, - ("n-butane", "isobutane"): 0.000, - ("n-butane", "ethylene"): 0.000, - ("n-butane", "propylene"): 0.000, - ("n-butane", "1-butene"): 0.000, - ("n-butane", "1-pentene"): 0.000, - ("n-butane", "1-hexene"): 0.000, - ("n-butane", "1-heptene"): 0.000, - ("n-butane", "1-octene"): 0.000, - ("isobutane", "hydrogen"): 0.000, - ("isobutane", "methane"): 0.000, - ("isobutane", "ethane"): 0.000, - ("isobutane", "propane"): 0.000, - ("isobutane", "n-butane"): 0.000, - ("isobutane", "isobutane"): 0.000, - ("isobutane", "ethylene"): 0.000, - ("isobutane", "propylene"): 0.000, - ("isobutane", "1-butene"): 0.000, - ("isobutane", "1-pentene"): 0.000, - ("isobutane", "1-hexene"): 0.000, - ("isobutane", "1-heptene"): 0.000, - ("isobutane", "1-octene"): 0.000, - ("ethylene", "hydrogen"): 0.000, - ("ethylene", "methane"): 0.000, - ("ethylene", "ethane"): 0.000, - ("ethylene", "propane"): 0.000, - ("ethylene", "n-butane"): 0.000, - ("ethylene", "isobutane"): 0.000, - ("ethylene", "ethylene"): 0.000, - ("ethylene", "propylene"): 0.000, - ("ethylene", "1-butene"): 0.000, - ("ethylene", "1-pentene"): 0.000, - ("ethylene", "1-hexene"): 0.000, - ("ethylene", "1-heptene"): 0.000, - ("ethylene", "1-octene"): 0.000, - ("propylene", "hydrogen"): 0.000, - ("propylene", "methane"): 0.000, - ("propylene", "ethane"): 0.000, - ("propylene", "propane"): 0.000, - ("propylene", "n-butane"): 0.000, - ("propylene", "isobutane"): 0.000, - ("propylene", "ethylene"): 0.000, - ("propylene", "propylene"): 0.000, - ("propylene", "1-butene"): 0.000, - ("propylene", "1-pentene"): 0.000, - ("propylene", "1-hexene"): 0.000, - ("propylene", "1-heptene"): 0.000, - ("propylene", "1-octene"): 0.000, - ("1-butene", "hydrogen"): 0.000, - ("1-butene", "methane"): 0.000, - ("1-butene", "ethane"): 0.000, - ("1-butene", "propane"): 0.000, - ("1-butene", "n-butane"): 0.000, - ("1-butene", "isobutane"): 0.000, - ("1-butene", "ethylene"): 0.000, - ("1-butene", "propylene"): 0.000, - ("1-butene", "1-butene"): 0.000, - ("1-butene", "1-pentene"): 0.000, - ("1-butene", "1-hexene"): 0.000, - ("1-butene", "1-heptene"): 0.000, - ("1-butene", "1-octene"): 0.000, - ("1-pentene", "hydrogen"): 0.000, - ("1-pentene", "methane"): 0.000, - ("1-pentene", "ethane"): 0.000, - ("1-pentene", "propane"): 0.000, - ("1-pentene", "n-butane"): 0.000, - ("1-pentene", "isobutane"): 0.000, - ("1-pentene", "ethylene"): 0.000, - ("1-pentene", "propylene"): 0.000, - ("1-pentene", "1-butene"): 0.000, - ("1-pentene", "1-pentene"): 0.000, - ("1-pentene", "1-hexene"): 0.000, - ("1-pentene", "1-heptene"): 0.000, - ("1-pentene", "1-octene"): 0.000, - ("1-hexene", "hydrogen"): 0.000, - ("1-hexene", "methane"): 0.000, - ("1-hexene", "ethane"): 0.000, - ("1-hexene", "propane"): 0.000, - ("1-hexene", "n-butane"): 0.000, - ("1-hexene", "isobutane"): 0.000, - ("1-hexene", "ethylene"): 0.000, - ("1-hexene", "propylene"): 0.000, - ("1-hexene", "1-butene"): 0.000, - ("1-hexene", "1-pentene"): 0.000, - ("1-hexene", "1-hexene"): 0.000, - ("1-hexene", "1-heptene"): 0.000, - ("1-hexene", "1-octene"): 0.000, - ("1-heptene", "hydrogen"): 0.000, - ("1-heptene", "methane"): 0.000, - ("1-heptene", "ethane"): 0.000, - ("1-heptene", "propane"): 0.000, - ("1-heptene", "n-butane"): 0.000, - ("1-heptene", "isobutane"): 0.000, - ("1-heptene", "ethylene"): 0.000, - ("1-heptene", "propylene"): 0.000, - ("1-heptene", "1-butene"): 0.000, - ("1-heptene", "1-pentene"): 0.000, - ("1-heptene", "1-hexene"): 0.000, - ("1-heptene", "1-heptene"): 0.000, - ("1-heptene", "1-octene"): 0.000, - ("1-octene", "hydrogen"): 0.000, - ("1-octene", "methane"): 0.000, - ("1-octene", "ethane"): 0.000, - ("1-octene", "propane"): 0.000, - ("1-octene", "n-butane"): 0.000, - ("1-octene", "isobutane"): 0.000, - ("1-octene", "ethylene"): 0.000, - ("1-octene", "propylene"): 0.000, - ("1-octene", "1-butene"): 0.000, - ("1-octene", "1-pentene"): 0.000, - ("1-octene", "1-hexene"): 0.000, - ("1-octene", "1-heptene"): 0.000, - ("1-octene", "1-octene"): 0.000, - } - }, -} diff --git a/property_packages/tests/test_hc_pr.py b/property_packages/tests/test_hc_pr.py index 0391948..640b240 100644 --- a/property_packages/tests/test_hc_pr.py +++ b/property_packages/tests/test_hc_pr.py @@ -11,8 +11,6 @@ # for full copyright and license information. ################################################################################# -from math import exp -from pprint import pprint import pytest from pyomo.environ import ( assert_optimal_termination, @@ -38,15 +36,11 @@ from idaes.models.properties.modular_properties.state_definitions import FTPx from idaes.models.properties.modular_properties.phase_equil import SmoothVLE from idaes.models.properties.modular_properties.eos.ceos import cubic_roots_available -from idaes.models.properties.modular_properties.base.generic_property import GenericParameterBlock from ..build_package import build_package from idaes.core import FlowsheetBlock import idaes.core.util.scaling as iscale -from .test_config import configuration -# ----------------------------------------------------------------------------- -# Get default solver for testing solver = get_solver("ipopt") @@ -184,7 +178,7 @@ def test_params(): model.params.config.state_bounds, { "flow_mol": (0, 100, 1000, pyunits.mol / pyunits.s), - "temperature": (273.15, 300, 500, pyunits.K), + "temperature": (13.95, 150, 350, pyunits.K), "pressure": (5e4, 1e5, 1e6, pyunits.Pa), }, item_callback=_as_quantity, @@ -294,13 +288,13 @@ def test_build(): assert isinstance(model.fs.state[1].pressure, Var) assert value(model.fs.state[1].pressure) == 1e5 - assert model.fs.state[1].pressure.ub == 1e6 # changed from 1e7 (different bounds) TODO: check this + assert model.fs.state[1].pressure.ub == 1e6 assert model.fs.state[1].pressure.lb == 5e4 assert isinstance(model.fs.state[1].temperature, Var) assert value(model.fs.state[1].temperature) == 295 - assert model.fs.state[1].temperature.ub == 500 # changed from 1500 (different bounds) TODO: check this - assert model.fs.state[1].temperature.lb == 273.15 + assert model.fs.state[1].temperature.ub == 350 + assert model.fs.state[1].temperature.lb == 13.95 assert isinstance(model.fs.state[1].mole_frac_comp, Var) assert len(model.fs.state[1].mole_frac_comp) == 13