idaes.surrogate.helmet package

Submodules

idaes.surrogate.helmet.AncillaryEquations module

Modeling for saturated densities and vapor pressure

idaes.surrogate.helmet.AncillaryEquations.DL()[source]

ALAMO regression of Saturated Liquid Density

idaes.surrogate.helmet.AncillaryEquations.DV()[source]

ALAMO regression of saturated vapor density

idaes.surrogate.helmet.AncillaryEquations.PV()[source]

ALAMO regression of vapor pressure

idaes.surrogate.helmet.AncillaryEquations.getDL()[source]

Imports the regressed saturated liquid density function

idaes.surrogate.helmet.AncillaryEquations.getDV()[source]

Imports the regressed saturated vapor density function

idaes.surrogate.helmet.AncillaryEquations.getPV()[source]

Imports the regressed vapor pressure function

idaes.surrogate.helmet.BasisFunctions module

Basis functions for generating the multiparameter equation of state

idaes.surrogate.helmet.BasisFunctions.arBY(D, T, Y, Beta)[source]

Residual Helmholtz contribution

idaes.surrogate.helmet.BasisFunctions.d2rd(D, T)[source]

Partial derivative with respect to density twice

idaes.surrogate.helmet.BasisFunctions.d2rdRes(D, T, Y, Beta)[source]

Residual helmholtz contribution second partial derivative with respect to density

idaes.surrogate.helmet.BasisFunctions.d2rdrtRes(D, T, Y, Beta)[source]

Residual helmholtz contribution third partial derivative with respect to density(2) and temperature(1)

idaes.surrogate.helmet.BasisFunctions.d2rdt(D, T)[source]

Partial derivative with respect to density twice and temperature

idaes.surrogate.helmet.BasisFunctions.d3rd(D, T)[source]

Third partial derivative with respect to density

idaes.surrogate.helmet.BasisFunctions.d3rdRes(D, T, Y, Beta)[source]

Third partial derivative with respect to density

idaes.surrogate.helmet.BasisFunctions.d4rd(D, T)[source]

Fourth partial derivative with respect to density

idaes.surrogate.helmet.BasisFunctions.d5rd(D, T)[source]

Fifth partial derivative with respect to density

idaes.surrogate.helmet.BasisFunctions.drd(D, T)[source]

Partial derivative with respect to density

idaes.surrogate.helmet.BasisFunctions.drdRes(D, T, Y, Beta)[source]

Calculates the partial derivaties w.r.t. density Inputs:

D - Delta T - Tau Y - index of basis Function (int or array) Beta - weighting (float or array)
idaes.surrogate.helmet.BasisFunctions.dtrdt(D, T)[source]

Second partial derivative with respect to density and temperature

idaes.surrogate.helmet.BasisFunctions.dtrdtRes(D, T, Y, Beta)[source]

Residual helmholtz contribution second partial derivative with respect to density and temperature

idaes.surrogate.helmet.BasisFunctions.formCustomBasis(LemJac=False)[source]

Basis Functions developed a bank of terms based on literature (Lemmon, Span, Wagner)

idaes.surrogate.helmet.BasisFunctions.getTerm(Y)[source]

Prints index and basis function based on Y index

idaes.surrogate.helmet.BasisFunctions.iTT(D, T)[source]

Ideal helmholtz contribution second partial derivative with respect to temperature

idaes.surrogate.helmet.BasisFunctions.idealBY(D, T, Y, Beta)[source]

Ideal Helmholtz contribution

idaes.surrogate.helmet.BasisFunctions.molData(fluidData, Dmolecule, RVal)[source]

Passing of the Data from the main module ::module:: MPEOSDeveloperModule

Parameters:
  • fluidData (array) – (critT, critP, critD, M, triple, acc).
  • Dmolecule (str.) – Name of the molecule of interest.
  • RVal (int.) – Gas Constant.
idaes.surrogate.helmet.BasisFunctions.rTT(D, T)[source]

Second partial derivative with respect to temperature

idaes.surrogate.helmet.BasisFunctions.rTTRes(D, T, Y, Beta)[source]

Residual helmholtz contribution second partial derivative with respect to temperature

idaes.surrogate.helmet.DataImport module

Importing thermodynamic data, specific structures for text files

idaes.surrogate.helmet.DataImport.CP(molecule, sample=False, ratio=5)[source]

Import isobaric heat capacity data

idaes.surrogate.helmet.DataImport.CP0(molecule)[source]

Import ideal isobaric heat capacity

idaes.surrogate.helmet.DataImport.CV(molecule, sample=False, ratio=5)[source]

Import isochoric heat capacity

idaes.surrogate.helmet.DataImport.DL(molecule)[source]

Import saturated liquid density

idaes.surrogate.helmet.DataImport.DV(molecule)[source]

Import of saturated vapor density

idaes.surrogate.helmet.DataImport.PV(molecule)[source]

Import saturated vapor pressure

idaes.surrogate.helmet.DataImport.PVT(molecule, sample=False, ratio=5)[source]

Import pressure-volume-temperature data

idaes.surrogate.helmet.DataImport.SND(molecule, sample=False, ratio=5)[source]

Import speed of sound data

idaes.surrogate.helmet.DataImport.molData(fluidData, RVal)[source]

Molecular data passed to the module

idaes.surrogate.helmet.DataImport.regionsOfData(molecule, DataValues, PVT=False, CV=False)[source]

Organization of data into regions

idaes.surrogate.helmet.DataImport.sampleData(Regions, ratio)[source]

Sampling of the data regions

idaes.surrogate.helmet.DataManipulation module

Calculates dimensionless data

idaes.surrogate.helmet.DataManipulation.CP(x)[source]

Calculate dimensionless isobaric heat capacity Inputs:

X = [Density, Temperature, Isobaric Heat Capacity]
Outputs:
X = [Delta, Tau, CP]
idaes.surrogate.helmet.DataManipulation.CP0(x)[source]

Calculate dimensionless ideal isobaric heat capacity

idaes.surrogate.helmet.DataManipulation.CV(x)[source]

Calculate dimensionless isochoric heat capacity Inputs:

X = [Density, Temperature, Isochoric Heat Capacity]
Outputs:
X = [Delta, Tau, CV]
idaes.surrogate.helmet.DataManipulation.DL(x)[source]

Calculate Theta and Delta for saturated liquid density Inputs:

X = [Density, Temperature]
idaes.surrogate.helmet.DataManipulation.DV(x)[source]

Calculate Theta and Delta for saturated vapor density Inputs:

X = [Density, Temperature]
idaes.surrogate.helmet.DataManipulation.Dsat(x)[source]

Calculate dimensionless terms

idaes.surrogate.helmet.DataManipulation.P(x)[source]

Calculate reduced density and inverse reduced temperature Return array of Delta, Tau, Pressure

idaes.surrogate.helmet.DataManipulation.PV(x)[source]

Calculate Theta, Tau, and Psi for saturated liquid density Inputs:

X = [Pressure, Temperature]
idaes.surrogate.helmet.DataManipulation.PVT(x)[source]

Calculate dimensionless compressibility Inputs:

X = [Pressure, Density, Temperature]
OutputS:
X = [Delta, Tau, Compressibility]
idaes.surrogate.helmet.DataManipulation.SND(x)[source]

Calculate dimensionless speed of sound Inputs:

X = [Density, Temperature, Speed of Sound]
Outputs:
X = [Delta, Tau, W]
idaes.surrogate.helmet.DataManipulation.molData(fluidData, mol, RVal)[source]

Sets up important global values

idaes.surrogate.helmet.GAMSDataWrite module

Writer of the data into the GAMS file

idaes.surrogate.helmet.GAMSDataWrite.CPdt(textFile, DataToWrite, Combination=False, PlotData=False)[source]

Imports Isobaric Heat Capacity(CP) data into the GAMS document

Parameters:
  • textFile (str.) – Gams File written to.
  • DataToWrite (array.) – Data prepared for the GAMS file.
Returns:

void.

idaes.surrogate.helmet.GAMSDataWrite.CVdt(textFile, DataToWrite, Combination=False, PlotData=False)[source]

Imports Isochoric Heat Capacity (CV) data into the GAMS document

Parameters:
  • textFile (str.) – Gams File written to.
  • DataToWrite (array.) – Data prepared for the GAMS file.
Returns:

void.

idaes.surrogate.helmet.GAMSDataWrite.Crit(textFile, DataToWrite, Combination=False)[source]

Import Critical data points

idaes.surrogate.helmet.GAMSDataWrite.InSat(textFile, DataToWrite, Combination=False)[source]

Import saturation density values

idaes.surrogate.helmet.GAMSDataWrite.PVTdt(textFile, DataToWrite, Combination=False, PlotData=False)[source]

Imports P-V-T data into the GAMS document, to be written in :func:’GamsWrite’

Parameters:
  • textFile (str.) – Gams File written to.
  • DataToWrite (array.) – Data prepared for the GAMS file.
Returns:

void.

idaes.surrogate.helmet.GAMSDataWrite.SNDdt(textFile, DataToWrite, Combination=False, PlotData=False)[source]

Imports Speed of Sound (SND) data into the GAMS document

Parameters:
  • textFile (str.) – Gams File written to.
  • DataToWrite (array.) – Data prepared for the GAMS file.
Returns:

void.

idaes.surrogate.helmet.GAMSDataWrite.writeExp(textFile, Combination=False)[source]

Writes into the GDX file the basis function parameters

idaes.surrogate.helmet.GAMSWrite module

GAMS writer for the regression

idaes.surrogate.helmet.GAMSWrite.GenerateGDXGamsFiledtlmv()[source]

Generates a gams file that creates a data .gdx file Creates Combination of PVT, CV, CP, and SND GAMS file. (Titles precoded in).

idaes.surrogate.helmet.GAMSWrite.GenerateGamsShell()[source]

Generates the multiparameter equation of state regression through gams. Imports the molecule data.gdx file Creates Combination of PVT, CV, CP, and SND GAMS file. (Title precoded in).

idaes.surrogate.helmet.GAMSWrite.closeFile()[source]

Closes the GAMS file

idaes.surrogate.helmet.GAMSWrite.getRunFile()[source]

Returns the gams file name

idaes.surrogate.helmet.GAMSWrite.getTextFile()[source]

Returns name of the current textFile

idaes.surrogate.helmet.GAMSWrite.molData(Dfluids, Dmolecule, Ddata_name, Dterms, Dmax_time)[source]

Passing of the Data from the main module ::module:: MPEOSDeveloperModule

Parameters:
  • Dmolecule (str) – Name of molecule of interest
  • Ddata_name (str.) – Name of Data files
  • Dmax_time (int.) – Running time limit for the GAMS file.
idaes.surrogate.helmet.GAMSWrite.openFile(data_name, ending='.gms')[source]

Opens the GAMS file based on the data set

Parameters:data_name (str) – name of the molecule
idaes.surrogate.helmet.GAMSWrite.setCombination(isCombination)[source]

Sets the regression as multiple properties

idaes.surrogate.helmet.GAMSWrite.setNumberTerms(numterms)[source]

Set number of basis functions allowed in regression

idaes.surrogate.helmet.GAMSWrite.writeBasisFunctions()[source]

Write the values of the basis function terms

idaes.surrogate.helmet.GAMSWrite.writeBoundsB(props)[source]

Writes bounds on the variables

idaes.surrogate.helmet.GAMSWrite.writeCalculateIntermediates(props)[source]

Calculate intermediate values of properties not in the regression

idaes.surrogate.helmet.GAMSWrite.writeConstants(terms)[source]

Writes down the ranges of the fitting Beta value and sets regular to one. param terms: number of basis functions param terms: int

idaes.surrogate.helmet.GAMSWrite.writeDerivatives(props)[source]

Calculate and write the important derivatives of the basis functions

idaes.surrogate.helmet.GAMSWrite.writeEquationsAndVariablesB(props)[source]

Writes multiple thermodynamic parameter equations and constants. :param props: Array containing the available properties. :type props: array

idaes.surrogate.helmet.GAMSWrite.writeGamsHeaderdtl(num_points, terms, kset, pset, regions=None)[source]

Writes the GAMS file Header including the number of terms and data points as well as different thermodynamic properties.

Parameters:
  • num_points (int) – number of data points
  • terms (int) – number of basis functions
  • kset – what is this
  • pset – what is this
idaes.surrogate.helmet.GAMSWrite.writeGamsShellFooterB(data_name, load_in=False)[source]

Writes the Gam Footer options, model, and display.

idaes.surrogate.helmet.GAMSWrite.writeGamsShellHeaderB(pset, regions=None)[source]

Writes the GAMS file Header including the number of terms and data points as well as different thermodynamic properties.

Parameters:
  • pset – list of thermodynamic properties
  • regions – regions of thermodynamic property data
idaes.surrogate.helmet.GAMSWrite.writeModelB(reslim, props)[source]

Writes the GAMS model definition

idaes.surrogate.helmet.GAMSWrite.writeModelPostEvaluations(props)[source]

Calculates thermodynamic values after the regression

idaes.surrogate.helmet.GAMSWrite.writeObjectivesB(props)[source]

Writes the objective equations for the different combination of properites and constraints

idaes.surrogate.helmet.Helmet module

HELMholtz Energy Thermodynamics (HELMET)

Main capabilities of HELMET default HELMET use

idaes.surrogate.helmet.Helmet.deletefile(*fname)[source]

Deletes files

idaes.surrogate.helmet.Helmet.getFlag()[source]

Returns flag, marks a change in the construction of the model

idaes.surrogate.helmet.Helmet.initialize(**kwargs)[source]

filename - location of data gamsname - name of the gams file made molecule - name of the molecule/compound data_name - name of the data fluid data - [critT, critP, critD, M, triple, acentric factor] R - gas constant value

idaes.surrogate.helmet.Helmet.prepareAncillaryEquations(plot=False, keepFiles=False)[source]
Develops ancillary equations of state using ALAMOPY
DL - saturated liquid density DV - saturated vapor density PV - vapor pressure

Dependent on ALAMO

idaes.surrogate.helmet.Helmet.runRegression(gams=False, pyomo=False)[source]

Runs the gdx and main regression gams file

idaes.surrogate.helmet.Helmet.setupRegression(numTerms=14, gams=False, pyomo=False)[source]

setup gams regression

idaes.surrogate.helmet.Helmet.updateModelSettings()[source]

Settings of the model based on the chemical passed to the different python methods

idaes.surrogate.helmet.Helmet.viewMultResults(lstFile, numTerms=0)[source]

View mutliple results from a lst file

idaes.surrogate.helmet.Helmet.viewPropertyData()[source]

Plot imported data

idaes.surrogate.helmet.Helmet.viewResults(lstFile=None, plot=False, report=False, surface=<matplotlib.colors.LinearSegmentedColormap object>)[source]
Plot results from gams or pyomo
lstFile - gams listing file surface - colormapping color eg. cm.coolwarm

idaes.surrogate.helmet.Plotting module

HELMET Plotting capabilities

idaes.surrogate.helmet.Plotting.HelmetSurface(Y=[], Beta=[], show=True, surface=<matplotlib.colors.LinearSegmentedColormap object>)[source]

Plots Helmholtz Surface

idaes.surrogate.helmet.Plotting.molData(fluidData, Dmolecule, RVal)[source]

Shared data about the molecule and ideas gas constant R

idaes.surrogate.helmet.Plotting.plotCP()[source]

Plot isobaric heat capacity

idaes.surrogate.helmet.Plotting.plotCV()[source]

Plot isochoric heat capacity

idaes.surrogate.helmet.Plotting.plotDL()[source]

Plot saturate liquid density

idaes.surrogate.helmet.Plotting.plotDV()[source]

Plot saturated vapor density

idaes.surrogate.helmet.Plotting.plotPV()[source]

Plot vapor pressure

idaes.surrogate.helmet.Plotting.plotPVT()[source]

Plot Pressure-Volume-Temperature data

idaes.surrogate.helmet.Plotting.plotSND()[source]

Plot speed of sound data

idaes.surrogate.helmet.Plotting.sseCP(CP1=[], CP1Vals=[], saveFig=False, show=True, report=False)[source]

Plots and calculates metrics for isobaric heat capacity

idaes.surrogate.helmet.Plotting.sseCV(Y=[], Beta=[], saveFig=False, show=True, report=False)[source]

Plots and metrics for isochoric heat capacity

idaes.surrogate.helmet.Plotting.sseCombo(lstFile=None, plot=False, report=False, surface=<matplotlib.colors.LinearSegmentedColormap object>)[source]

Plot regressed equation and data. Calculates statistical anlaysis metrics

idaes.surrogate.helmet.Plotting.ssePVT(PVT1=[], PVT1Vals=[], saveFig=False, show=True, report=False)[source]

Plots and metrics for Pressure-volume-temperature data

idaes.surrogate.helmet.Plotting.sseSND(SND1=[], SND1Vals=[], saveFig=False, show=True, report=False)[source]

Plots and calculates metrics for speed of sound

idaes.surrogate.helmet.Plotting.viewAnc()[source]

Plots all the ancillary equations for saturated density and vapor pressure

idaes.surrogate.helmet.Plotting.viewData()[source]

View imported data

idaes.surrogate.helmet.parseGAMS module

Parses and prints the solutions of the multiparameter equation of state solution

idaes.surrogate.helmet.parseGAMS.getBetas()[source]

Returns the weights of the basis functions

idaes.surrogate.helmet.parseGAMS.getIndexes()[source]

Returns indexes of the basis function terms

idaes.surrogate.helmet.parseGAMS.parser(filename, num=2)[source]

Parse solution files for the muliparameter equation of state

idaes.surrogate.helmet.parseGAMS.writeEquation(Y, Beta=None)[source]

Write full multiparameter equation

idaes.surrogate.helmet.parseGAMS.writeTerm(index)[source]

Writes the basis function term with the given index