pub(crate) struct SaltWaterPropertyPackage {Show 28 fields
name: String,
description: String,
material: Option<CapeThermoMaterial>,
constant_property_map: CapeOpenMap<[CapeValueContent; 2]>,
material_compound_indices: Vec<usize>,
material_nacl_index: Option<usize>,
mat_comp_ids: CapeArrayStringVec,
mat_formulae: CapeArrayStringVec,
mat_comp_names: CapeArrayStringVec,
mat_boil_temps: CapeArrayRealVec,
mat_molecular_weights: CapeArrayRealVec,
mat_cas_registry_numbers: CapeArrayStringVec,
phase_list: CapeArrayStringVec,
phase_status: CapeArrayEnumerationVec<CapePhaseStatus>,
property_value: CapeArrayRealVec,
scalar_property_value: CapeArrayRealScalar,
fraction: CapeStringImpl,
temperature: CapeStringImpl,
pressure: CapeStringImpl,
phase_fraction: CapeStringImpl,
mole: CapeStringImpl,
enthalpy: CapeStringImpl,
entropy: CapeStringImpl,
empty_string: CapeStringImpl,
h2o: CapeStringConstNoCase,
nacl: CapeStringConstNoCase,
liquid: CapeStringConstNoCase,
cobia_object_data: SaltWaterPropertyPackageCobiaObjectData,
}Expand description
The SaltWaterPropertyPackage is an example of a property package that implements the CAPE-OPEN 1.2 standard.
The salt water calculations are implemented in salt_water_calculator.rs.
The package defines a single liquid phase, and two compounds: water and sodium chloride.
A CAPE-OPEN 1.2 property package must implemented the following interfaces:
- ICapeIdentification
- ICapeUtilities
- ICapeThermoMaterialContext
- ICapeThermoCompounds
- ICapeThermoPhases
- ICapeThermoPropertyRoutine
- ICapeThermoEquilibriumRoutine
- ICapeThermoUniversalConstant (optional)
The package is creatable; the public CAPE-OPEN class factory is implemented in lib.rs; to facilitate the registration of this object into the COBIA registry, the object implements the PMCRegisterationInfo trait.
Once registered, the package can be instantiated and created in all CAPE-OPEN compliant simulators.
Fields§
§name: StringThe name of the components, which for a primary CAPE-OPEN PMC object must be modifiable
description: StringThe description of the component, which for a primary CAPE-OPEN PMC object should be modifiable
material: Option<CapeThermoMaterial>The interface to the active material which contains calculation properties, and on which calculation results are stored
constant_property_map: CapeOpenMap<[CapeValueContent; 2]>Map of the constant properties by identifier, to the values for the two compounds. Filled on first use.
material_compound_indices: Vec<usize>The indices of the compounds in the active material object. Water has index 0, NaCl has index 1.
material_nacl_index: Option<usize>The index of the NaCl compound in the active material object. If not present, pure water is assumed.
mat_comp_ids: CapeArrayStringVecCompound IDs on the active material object
mat_formulae: CapeArrayStringVecCompound formulae on the active material object
mat_comp_names: CapeArrayStringVecCompound names on the active material object
mat_boil_temps: CapeArrayRealVecCompound boiling points on the active material object
mat_molecular_weights: CapeArrayRealVecCompound molecular weights on the active material object
mat_cas_registry_numbers: CapeArrayStringVecCompound CAS registry numbers on the active material object
phase_list: CapeArrayStringVecList of phases resulting from a flash calculation (contains only liquid)
phase_status: CapeArrayEnumerationVec<CapePhaseStatus>Phase status of the phases resulting from a flash calculation (at equilibrium)
property_value: CapeArrayRealVecBuffer for obtaining property values from the active material object
scalar_property_value: CapeArrayRealScalarBuffer for scalar properties for obtaining property values from the active material object
fraction: CapeStringImplThe string “fraction” used for the mole fraction property
temperature: CapeStringImplThe string “temperature” used for the temperature property
pressure: CapeStringImplThe string “pressure” used for the pressure property
phase_fraction: CapeStringImplThe string “phaseFraction” used for the phase fraction property
mole: CapeStringImplThe string “mole” used for the basis of getting and setting properties
enthalpy: CapeStringImplThe string “enthalpy” used for the enthalpy property
entropy: CapeStringImplThe string “entropy” used for the entropy property
empty_string: CapeStringImplThe empty string used for the basis of getting and setting properties
h2o: CapeStringConstNoCaseThe string “H2O” used to check against the active material object compound list
nacl: CapeStringConstNoCaseThe string “NaCl” used to check against the active material object compound list
liquid: CapeStringConstNoCaseThe string “Liquid” used to check against the specified phase in property calculations
cobia_object_data: SaltWaterPropertyPackageCobiaObjectDataCobia object data for this object, which contains generated code to provide the native COBIA interfaces
Implementations§
Source§impl SaltWaterPropertyPackage
impl SaltWaterPropertyPackage
Sourcepub(crate) fn create<T: CapeSmartPointer>() -> T
pub(crate) fn create<T: CapeSmartPointer>() -> T
Create a new instance of the object and return a smart pointer to it
This function panics if the created object does not implement the interface corresponding to the smart pointer to be returned. For a non-panic version, use the try_create() function.
Sourcepub(crate) fn try_create<T: CapeSmartPointer>() -> Result<T, COBIAError>
pub(crate) fn try_create<T: CapeSmartPointer>() -> Result<T, COBIAError>
Create a new instance of the object and return a smart pointer to it
This function returns an error if the created object does not implement the interface corresponding to the smart pointer to be returned.
Sourcepub(crate) unsafe fn borrow<T: CapeSmartPointer>(smart_pointer: &T) -> &Self
pub(crate) unsafe fn borrow<T: CapeSmartPointer>(smart_pointer: &T) -> &Self
Get a reference to the object
Note that as the reference is created from a smart pointer, the reference is valid only as long as the smart pointer is valid. The reference is not checked for multiple borrows
§Safety
The user must ensure that the smart pointer contains a valid object, and that the object is of the type that is being borrowed. It is not possible for the compiler to check this, as the borrow is done through the native object pointer in the interface.
Sourcepub(crate) unsafe fn borrow_mut<T: CapeSmartPointer>(
smart_pointer: &mut T,
) -> &mut Self
pub(crate) unsafe fn borrow_mut<T: CapeSmartPointer>( smart_pointer: &mut T, ) -> &mut Self
Get a mutable reference to the object
Note that as the reference is created from a smart pointer, the reference is valid only as long as the smart pointer is valid. The reference is not checked for multiple borrows
§Safety
This function is unsafe because it allows mutable access to the object. Also the user must ensure that the smart pointer contains a valid object, and that the object is of the type that is being borrowed. It is not possible for the compiler to check this, as the borrow is done through the native object pointer in the interface.
Source§impl SaltWaterPropertyPackage
impl SaltWaterPropertyPackage
Sourceconst NAME: &'static str = "Salt Water"
const NAME: &'static str = "Salt Water"
The default name for new packages, and the object name as it appears in the COBIA registy
Sourceconst DESCRIPTION: &'static str = "Salt water property package"
const DESCRIPTION: &'static str = "Salt water property package"
The default description for new packages, and the object description as it appears in the COBIA registy
Sourceconst PROGID: &'static str = "SaltWater.SaltWater"
const PROGID: &'static str = "SaltWater.SaltWater"
The ProgID of the package, as it appears in the COBIA registry
Sourceconst COMP_FORMULAS: [&'static str; 2]
const COMP_FORMULAS: [&'static str; 2]
The list of compound IDs for the two compounds in the package
Sourceconst COMP_NAMES: [&'static str; 2]
const COMP_NAMES: [&'static str; 2]
The list of compound names for the two compounds in the package
Sourceconst COMP_BOIL_TEMPS: [f64; 2]
const COMP_BOIL_TEMPS: [f64; 2]
The list of compound boiling points for the two compounds in the package
Sourceconst COMP_MELT_TEMPS: [f64; 2]
const COMP_MELT_TEMPS: [f64; 2]
The list of compound melting points for the two compounds in the package
Sourcepub(crate) const COMP_MOLWTS: [f64; 2]
pub(crate) const COMP_MOLWTS: [f64; 2]
The list of compound molecular weights for the two compounds in the package
Sourceconst COMP_CASNOS: [&'static str; 2]
const COMP_CASNOS: [&'static str; 2]
The list of compound CAS registry numbers for the two compounds in the package
Sourceconst COMP_SMILES: [&'static str; 2]
const COMP_SMILES: [&'static str; 2]
The list of compound SMILES strings for the two compounds in the package
Sourceconst COMP_IUPAC_NAMES: [&'static str; 2]
const COMP_IUPAC_NAMES: [&'static str; 2]
The list of compound IUPAC names for the two compounds in the package
Sourcefn check_context_material(&mut self) -> Result<(), COBIAError>
fn check_context_material(&mut self) -> Result<(), COBIAError>
This function is called at the start of any function that requires the context material to be set. It checks whether a active material object is present, and if so, it check which compounds are present on the active material object
It is possible for the PME to select a subset of the compounds supported by the package. For this particular package, not having NaCl is acceptable, as this allows for calculations at zero salinity. Not having water is not acceptable, and returns and error.
Some other common errors, such as an empty list, multiple appearances of the same compound in the list, or unknown compounds, are also checked here
Trait Implementations§
Source§impl CapeCreateInstance for SaltWaterPropertyPackage
impl CapeCreateInstance for SaltWaterPropertyPackage
fn create_instance( _salt_water_property_package_boxed_ptr: *mut *mut ICapeInterface, ) -> CapeResult
Source§impl Default for SaltWaterPropertyPackage
Implementation of the Default trait is required for creatable CAPE-OPEN objects
as the class factory does not allow for constructor parameters.
impl Default for SaltWaterPropertyPackage
Implementation of the Default trait is required for creatable CAPE-OPEN objects as the class factory does not allow for constructor parameters.
Source§impl Display for SaltWaterPropertyPackage
The Display trait is required; it is used by the COBIA package to format the
object that is the source of an error, when a CAPE-OPEN error is returned.
impl Display for SaltWaterPropertyPackage
The Display trait is required; it is used by the COBIA package to format the object that is the source of an error, when a CAPE-OPEN error is returned.
The returned string should include the name and the type of the object so that it can be identified in the environment by which the error is processed.
Source§impl ICapeIdentification for SaltWaterPropertyPackage
The ICapeIdentification interface is used to identify any CAPE-OPEN object. It consists of a name
and description. For primary PMC objects (creatable objects), the name must be read/write and the
description should be read/write. Also, for primary PMC objects, the initial name and description
should match the information in the COBIA registry.
impl ICapeIdentification for SaltWaterPropertyPackage
The ICapeIdentification interface is used to identify any CAPE-OPEN object. It consists of a name and description. For primary PMC objects (creatable objects), the name must be read/write and the description should be read/write. Also, for primary PMC objects, the initial name and description should match the information in the COBIA registry.
Source§fn get_component_name(
&mut self,
name: &mut CapeStringOut<'_>,
) -> Result<(), COBIAError>
fn get_component_name( &mut self, name: &mut CapeStringOut<'_>, ) -> Result<(), COBIAError>
Source§fn get_component_description(
&mut self,
description: &mut CapeStringOut<'_>,
) -> Result<(), COBIAError>
fn get_component_description( &mut self, description: &mut CapeStringOut<'_>, ) -> Result<(), COBIAError>
Source§fn set_component_name(
&mut self,
name: &CapeStringIn<'_>,
) -> Result<(), COBIAError>
fn set_component_name( &mut self, name: &CapeStringIn<'_>, ) -> Result<(), COBIAError>
Source§fn set_component_description(
&mut self,
desc: &CapeStringIn<'_>,
) -> Result<(), COBIAError>
fn set_component_description( &mut self, desc: &CapeStringIn<'_>, ) -> Result<(), COBIAError>
Source§impl ICapeIdentificationImpl for SaltWaterPropertyPackage
impl ICapeIdentificationImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeIdentificationImpl + ICapeInterfaceImpl,
extern "C" fn raw_get_component_name( me: *mut c_void, name: *mut _ICapeString, ) -> u32
extern "C" fn raw_set_component_name( me: *mut c_void, name: *mut _ICapeString, ) -> u32
extern "C" fn raw_get_component_description( me: *mut c_void, desc: *mut _ICapeString, ) -> u32
extern "C" fn raw_set_component_description( me: *mut c_void, desc: *mut _ICapeString, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeIdentification_VTable = _
Source§impl ICapeInterfaceImpl for SaltWaterPropertyPackage
impl ICapeInterfaceImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
Source§fn get_object_data(&mut self) -> &mut CapeObjectData
fn get_object_data(&mut self) -> &mut CapeObjectData
CapeObjectData structure.Source§fn get_self(&mut self) -> *mut SaltWaterPropertyPackage
fn get_self(&mut self) -> *mut SaltWaterPropertyPackage
§const CAPEINTERFACE_VTABLE: ICapeInterface_VTable = _
const CAPEINTERFACE_VTABLE: ICapeInterface_VTable = _
§fn init(&mut self) -> *mut _ICapeInterface
fn init(&mut self) -> *mut _ICapeInterface
§fn create_object_data<Timpl>() -> CapeObjectDatawhere
Timpl: ICapeInterfaceImpl,
fn create_object_data<Timpl>() -> CapeObjectDatawhere
Timpl: ICapeInterfaceImpl,
extern "C" fn raw_add_reference(me: *mut c_void)
extern "C" fn raw_release(me: *mut c_void)
extern "C" fn raw_query_interface( me: *mut c_void, uuid: *const _CapeUUID, interface: *mut *mut _ICapeInterface, ) -> u32
extern "C" fn raw_get_last_error( me: *mut c_void, error: *mut *mut _ICapeError, ) -> u32
§fn add_interface(
&mut self,
uuid: *const _CapeUUID,
interface: *mut _ICapeInterface,
)
fn add_interface( &mut self, uuid: *const _CapeUUID, interface: *mut _ICapeInterface, )
§fn set_last_error(&mut self, error: COBIAError, scope: &str) -> u32
fn set_last_error(&mut self, error: COBIAError, scope: &str) -> u32
§fn clear_last_error(&mut self)
fn clear_last_error(&mut self)
§fn as_icapeinterface(&mut self) -> *mut _ICapeInterface
fn as_icapeinterface(&mut self) -> *mut _ICapeInterface
Source§impl ICapeThermoCompounds for SaltWaterPropertyPackage
The ICapeThermoCompounds interface must be implemented by a property package to expose
the supported list of compounds. The active list of compounds is that on the active
material object
impl ICapeThermoCompounds for SaltWaterPropertyPackage
The ICapeThermoCompounds interface must be implemented by a property package to expose the supported list of compounds. The active list of compounds is that on the active material object
Source§fn get_compound_constant(
&mut self,
props: &CapeArrayStringIn<'_>,
comp_ids: &CapeArrayStringIn<'_>,
contains_missing_values: &mut CapeBoolean,
prop_vals: &mut CapeArrayValueOut<'_>,
) -> Result<(), COBIAError>
fn get_compound_constant( &mut self, props: &CapeArrayStringIn<'_>, comp_ids: &CapeArrayStringIn<'_>, contains_missing_values: &mut CapeBoolean, prop_vals: &mut CapeArrayValueOut<'_>, ) -> Result<(), COBIAError>
Get one or more compound constant values for one or more compounds
§Arguments
props- The list of compound properties to be obtained, which is specified through a CapeArrayStringIn objectcomp_ids- The list of compound IDs, which is specified through a CapeArrayStringIn object; if empty, values are to be returned for all compoundscontains_missing_values- A boolean value that indicates whether the result contains missing values, which is returned through a CapeBoolean objectprop_vals- The list of compound property values, which is returned through a CapeArrayValueOut object; for each property, the values for all compounds are returned
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn get_compound_list(
&mut self,
comp_ids: &mut CapeArrayStringOut<'_>,
formulae: &mut CapeArrayStringOut<'_>,
names: &mut CapeArrayStringOut<'_>,
boil_temps: &mut CapeArrayRealOut<'_>,
molwts: &mut CapeArrayRealOut<'_>,
casnos: &mut CapeArrayStringOut<'_>,
) -> Result<(), COBIAError>
fn get_compound_list( &mut self, comp_ids: &mut CapeArrayStringOut<'_>, formulae: &mut CapeArrayStringOut<'_>, names: &mut CapeArrayStringOut<'_>, boil_temps: &mut CapeArrayRealOut<'_>, molwts: &mut CapeArrayRealOut<'_>, casnos: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>
Get the list of compounds supported by the package; water and sodium chloride for this package
§Arguments
comp_ids- The list of compound IDs, which is returned through a CapeArrayStringOut objectformulae- The list of compound formulae, which is returned through a CapeArrayStringOut objectnames- The list of compound names, which is returned through a CapeArrayStringOut objectboil_temps- The list of compound boiling points, which is returned through a CapeArrayRealOut objectmolwts- The list of compound molecular weights, which is returned through a CapeArrayRealOut objectcasnos- The list of compound CAS registry numbers, which is returned through a CapeArrayStringOut object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn get_const_prop_list(
&mut self,
props: &mut CapeArrayStringOut<'_>,
) -> Result<(), COBIAError>
fn get_const_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>
Source§fn get_num_compounds(&mut self) -> Result<CapeInteger, COBIAError>
fn get_num_compounds(&mut self) -> Result<CapeInteger, COBIAError>
Get the number of compounds supported by this package
§Returns
Result- A result object that indicates whether the operation was successful or not, containing the number of compounds in case of success
Source§fn get_pdependent_property(
&mut self,
_: &CapeArrayStringIn<'_>,
_: CapeReal,
_: &CapeArrayStringIn<'_>,
_: &mut CapeBoolean,
_: &mut CapeArrayRealOut<'_>,
) -> Result<(), COBIAError>
fn get_pdependent_property( &mut self, _: &CapeArrayStringIn<'_>, _: CapeReal, _: &CapeArrayStringIn<'_>, _: &mut CapeBoolean, _: &mut CapeArrayRealOut<'_>, ) -> Result<(), COBIAError>
Calculate pressure dependent properties at specified pressure
This package does not support pressure dependent properties, and the method always fails.
§Returns
Result- A result object that indicates whether the operation was successful or not, containing the number of compounds in case of success
Source§fn get_pdependent_prop_list(
&mut self,
props: &mut CapeArrayStringOut<'_>,
) -> Result<(), COBIAError>
fn get_pdependent_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>
Get the list of pressure dependent properties supported by this package
This package does not support pressure dependent properties, so returns an empty list.
§Arguments
compounds- The list of compound IDs, which is specified through a CapeArrayStringIn objectprops- The list of pressure dependent properties, which is returned through a CapeArrayStringOut object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn get_tdependent_property(
&mut self,
_: &CapeArrayStringIn<'_>,
_: CapeReal,
_: &CapeArrayStringIn<'_>,
_: &mut CapeBoolean,
_: &mut CapeArrayRealOut<'_>,
) -> Result<(), COBIAError>
fn get_tdependent_property( &mut self, _: &CapeArrayStringIn<'_>, _: CapeReal, _: &CapeArrayStringIn<'_>, _: &mut CapeBoolean, _: &mut CapeArrayRealOut<'_>, ) -> Result<(), COBIAError>
Calculate temperature dependent properties at specified temperature
This package does not support temperature dependent properties, and the method always fails.
§Returns
Result- A result object that indicates whether the operation was successful or not, containing the number of compounds in case of success
Source§fn get_tdependent_prop_list(
&mut self,
props: &mut CapeArrayStringOut<'_>,
) -> Result<(), COBIAError>
fn get_tdependent_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>
Get the list of temperature dependent properties supported by this package
This package does not support temperature dependent properties, so returns an empty list.
§Arguments
props- The list of temperature dependent properties, which is returned through a CapeArrayStringOut object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§impl ICapeThermoCompoundsImpl for SaltWaterPropertyPackage
impl ICapeThermoCompoundsImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeThermoCompoundsImpl + ICapeInterfaceImpl,
extern "C" fn raw_get_compound_constant( me: *mut c_void, props: *mut ICapeArrayString, comp_ids: *mut ICapeArrayString, contains_missing_values: *mut u32, prop_vals: *mut ICapeArrayValue, ) -> u32
extern "C" fn raw_get_compound_list( me: *mut c_void, comp_ids: *mut ICapeArrayString, formulae: *mut ICapeArrayString, names: *mut ICapeArrayString, boil_temps: *mut ICapeArrayReal, molwts: *mut ICapeArrayReal, casnos: *mut ICapeArrayString, ) -> u32
extern "C" fn raw_get_const_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32
extern "C" fn raw_get_num_compounds( me: *mut c_void, num: *mut i32, ) -> u32
extern "C" fn raw_get_p_dependent_property( me: *mut c_void, props: *mut ICapeArrayString, pressure: f64, comp_ids: *mut ICapeArrayString, contains_missing_values: *mut u32, prop_vals: *mut ICapeArrayReal, ) -> u32
extern "C" fn raw_get_p_dependent_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32
extern "C" fn raw_get_t_dependent_property( me: *mut c_void, props: *mut ICapeArrayString, temperature: f64, comp_ids: *mut ICapeArrayString, contains_missing_values: *mut u32, prop_vals: *mut ICapeArrayReal, ) -> u32
extern "C" fn raw_get_t_dependent_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeThermoCompounds_VTable = _
Source§impl ICapeThermoEquilibriumRoutine for SaltWaterPropertyPackage
The ICapeThermoPropertyRoutine interface must be implemented by a property package to allow
a client to calculate phase equilibria.
impl ICapeThermoEquilibriumRoutine for SaltWaterPropertyPackage
The ICapeThermoPropertyRoutine interface must be implemented by a property package to allow a client to calculate phase equilibria.
Source§fn calc_equilibrium(
&mut self,
specification1: &CapeArrayStringIn<'_>,
specification2: &CapeArrayStringIn<'_>,
solution_type: &CapeStringIn<'_>,
) -> Result<(), COBIAError>
fn calc_equilibrium( &mut self, specification1: &CapeArrayStringIn<'_>, specification2: &CapeArrayStringIn<'_>, solution_type: &CapeStringIn<'_>, ) -> Result<(), COBIAError>
Calculate the phase equilibrium at specified conditions.
Given the specified conditions and overall composition, return the phase equilibrium that matches those conditions. As this package only supports one phase, the resulting phase equilibrium is always a liquid phase at the specified conditions.
The underlying calculations are performed by the salt_water_calculator module.
§Arguments
specification1- The first specification for the phase equilibrium, which is specified through a CapeStringIn objectspecification2- The second specification for the phase equilibrium, which is specified through a CapeStringIn objectsolution_type- The type of solution to be used for the phase equilibrium calculation, which is specified through a CapeStringIn object; only the “Unspecified” solution type is supported.
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn check_equilibrium_spec(
&mut self,
specification1: &CapeArrayStringIn<'_>,
specification2: &CapeArrayStringIn<'_>,
solution_type: &CapeStringIn<'_>,
) -> Result<CapeBoolean, COBIAError>
fn check_equilibrium_spec( &mut self, specification1: &CapeArrayStringIn<'_>, specification2: &CapeArrayStringIn<'_>, solution_type: &CapeStringIn<'_>, ) -> Result<CapeBoolean, COBIAError>
Check whether a particular phase equilibrium calculation is supported.
§Arguments
specification1- The first specification for the phase equilibrium, which is specified through a CapeStringIn objectspecification2- The second specification for the phase equilibrium, which is specified through a CapeStringIn objectsolution_type- The type of solution to be used for the phase equilibrium calculation, which is specified through a CapeStringIn object; only the “Unspecified” solution type is supported.
§Returns
Result- A result object that indicates whether the operation was successful or not, and if successful, whether the phase equilibrium calculation is supported.
Source§impl ICapeThermoEquilibriumRoutineImpl for SaltWaterPropertyPackage
impl ICapeThermoEquilibriumRoutineImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeThermoEquilibriumRoutineImpl + ICapeInterfaceImpl,
extern "C" fn raw_calc_equilibrium( me: *mut c_void, specification1: *mut ICapeArrayString, specification2: *mut ICapeArrayString, solution_type: *mut _ICapeString, ) -> u32
extern "C" fn raw_check_equilibrium_spec( me: *mut c_void, specification1: *mut ICapeArrayString, specification2: *mut ICapeArrayString, solution_type: *mut _ICapeString, is_supported: *mut u32, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeThermoEquilibriumRoutine_VTable = _
Source§impl ICapeThermoMaterialContext for SaltWaterPropertyPackage
The ICapeThermoMaterialContext interface must be implemented by a property package to allow
setting the active material object on which all calculations are to be done. Calculation conditions
are obtained from the active material object, and calculation results are written to the
active material object.
impl ICapeThermoMaterialContext for SaltWaterPropertyPackage
The ICapeThermoMaterialContext interface must be implemented by a property package to allow setting the active material object on which all calculations are to be done. Calculation conditions are obtained from the active material object, and calculation results are written to the active material object.
Source§fn set_material(
&mut self,
material: CapeThermoMaterial,
) -> Result<(), COBIAError>
fn set_material( &mut self, material: CapeThermoMaterial, ) -> Result<(), COBIAError>
Source§impl ICapeThermoMaterialContextImpl for SaltWaterPropertyPackage
impl ICapeThermoMaterialContextImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeThermoMaterialContextImpl + ICapeInterfaceImpl,
extern "C" fn raw_set_material( me: *mut c_void, material: *mut _CAPEOPEN_1_2_ICapeThermoMaterial, ) -> u32
extern "C" fn raw_unset_material(me: *mut c_void) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeThermoMaterialContext_VTable = _
Source§impl ICapeThermoPhases for SaltWaterPropertyPackage
The ICapeThermoPhases interface must be implemented by a property package to expose
the supported list of phases.
impl ICapeThermoPhases for SaltWaterPropertyPackage
The ICapeThermoPhases interface must be implemented by a property package to expose the supported list of phases.
Source§fn get_num_phases(&mut self) -> Result<CapeInteger, COBIAError>
fn get_num_phases(&mut self) -> Result<CapeInteger, COBIAError>
Get the number of phases supported by this package.
This package supports 1 phase.
§Returns
Result- A result object that indicates whether the operation was successful or not, and in case of success returns the number of phases supported by the package.
Source§fn get_phase_info(
&mut self,
phase_label: &CapeStringIn<'_>,
phase_attribute: &CapeStringIn<'_>,
value: &mut CapeValueOut<'_>,
) -> Result<(), COBIAError>
fn get_phase_info( &mut self, phase_label: &CapeStringIn<'_>, phase_attribute: &CapeStringIn<'_>, value: &mut CapeValueOut<'_>, ) -> Result<(), COBIAError>
Get information on a phase.
§Arguments
phase_label- The label of the phase, which is specified through a CapeStringIn objectphase_attribute- The attribute of the phase, which is specified through a CapeStringIn objectvalue- The value of the phase attribute, which is returned through a CapeValueOut object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn get_phase_list(
&mut self,
phase_labels: &mut CapeArrayStringOut<'_>,
state_of_aggregation: &mut CapeArrayStringOut<'_>,
key_compound_id: &mut CapeArrayStringOut<'_>,
) -> Result<(), COBIAError>
fn get_phase_list( &mut self, phase_labels: &mut CapeArrayStringOut<'_>, state_of_aggregation: &mut CapeArrayStringOut<'_>, key_compound_id: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>
Get the list of phases supported by this package
This package supports only one phase: liquid. The liquid phase exposes water as its key compound. As there is only one liquid phase, this is not really necessary, but it is obvious in this context that the liquid phase is always and acquous phase.
§Arguments
phase_labels- The list of phase labels, which is returned through a CapeArrayStringOut objectstate_of_aggregation- The list of state of aggregation, which is returned through a CapeArrayStringOut objectkey_compound_id- The list of key compound IDs, which is returned through a CapeArrayStringOut object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§impl ICapeThermoPhasesImpl for SaltWaterPropertyPackage
impl ICapeThermoPhasesImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeThermoPhasesImpl + ICapeInterfaceImpl,
extern "C" fn raw_get_num_phases( me: *mut c_void, num: *mut i32, ) -> u32
extern "C" fn raw_get_phase_info( me: *mut c_void, phase_label: *mut _ICapeString, phase_attribute: *mut _ICapeString, value: *mut ICapeValue, ) -> u32
extern "C" fn raw_get_phase_list( me: *mut c_void, phase_labels: *mut ICapeArrayString, state_of_aggregation: *mut ICapeArrayString, key_compound_id: *mut ICapeArrayString, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeThermoPhases_VTable = _
Source§impl ICapeThermoPropertyRoutine for SaltWaterPropertyPackage
The ICapeThermoPropertyRoutine interface must be implemented by a property package to allow
a client to calculate single-phase and two-phase properties.
impl ICapeThermoPropertyRoutine for SaltWaterPropertyPackage
The ICapeThermoPropertyRoutine interface must be implemented by a property package to allow a client to calculate single-phase and two-phase properties.
Source§fn calc_and_get_ln_phi(
&mut self,
_: &CapeStringIn<'_>,
_: CapeReal,
_: CapeReal,
_: &CapeArrayRealIn<'_>,
_: CapeInteger,
_: &mut CapeArrayRealOut<'_>,
_: &mut CapeArrayRealOut<'_>,
_: &mut CapeArrayRealOut<'_>,
_: &mut CapeArrayRealOut<'_>,
) -> Result<(), COBIAError>
fn calc_and_get_ln_phi( &mut self, _: &CapeStringIn<'_>, _: CapeReal, _: CapeReal, _: &CapeArrayRealIn<'_>, _: CapeInteger, _: &mut CapeArrayRealOut<'_>, _: &mut CapeArrayRealOut<'_>, _: &mut CapeArrayRealOut<'_>, _: &mut CapeArrayRealOut<'_>, ) -> Result<(), COBIAError>
Calculate the fugacity coefficient of a compound in a phase
Not supported by this package.
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn calc_single_phase_prop(
&mut self,
props: &CapeArrayStringIn<'_>,
phase_label: &CapeStringIn<'_>,
) -> Result<(), COBIAError>
fn calc_single_phase_prop( &mut self, props: &CapeArrayStringIn<'_>, phase_label: &CapeStringIn<'_>, ) -> Result<(), COBIAError>
Calculate one or more single-phase properties for the specified phase
Obtains the calculation inputs from the active material object, and sets the calculation results on the active material object.
The underlying property calculations are performed by the salt_water_calculator module.
§Arguments
props- The list of properties to be calculated, which is specified through a CapeArrayStringIn objectphase_label- The label of the phase, which is specified through a CapeStringIn object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn calc_two_phase_prop(
&mut self,
_: &CapeArrayStringIn<'_>,
_: &CapeArrayStringIn<'_>,
) -> Result<(), COBIAError>
fn calc_two_phase_prop( &mut self, _: &CapeArrayStringIn<'_>, _: &CapeArrayStringIn<'_>, ) -> Result<(), COBIAError>
Calculate two-phase properties for the specified phase pair.
This package does not support two-phase properties, and the method always fails.
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn check_single_phase_prop_spec(
&mut self,
property: &CapeStringIn<'_>,
phase_label: &CapeStringIn<'_>,
) -> Result<CapeBoolean, COBIAError>
fn check_single_phase_prop_spec( &mut self, property: &CapeStringIn<'_>, phase_label: &CapeStringIn<'_>, ) -> Result<CapeBoolean, COBIAError>
Check whether a single-phase property calculation is supported for the specified phase.
This package supports a number of single-phase properties, which are defined in the
property_tables module.
§Arguments
property- The property to be checked, which is specified through a CapeStringIn objectphase_label- The label of the phase, which is specified through a CapeStringIn object
§Returns
Result- A result object that indicates whether the operation was successful or not, and if succesful, whether the property is supported.
Source§fn check_two_phase_prop_spec(
&mut self,
_: &CapeStringIn<'_>,
_: &CapeArrayStringIn<'_>,
) -> Result<CapeBoolean, COBIAError>
fn check_two_phase_prop_spec( &mut self, _: &CapeStringIn<'_>, _: &CapeArrayStringIn<'_>, ) -> Result<CapeBoolean, COBIAError>
Check whether a two-phase property calculation is supported for the specified phase pair.
This package does not support two-phase properties, and the method always returns false.
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn get_single_phase_prop_list(
&mut self,
props: &mut CapeArrayStringOut<'_>,
) -> Result<(), COBIAError>
fn get_single_phase_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>
Get a list of supported single-phase properties.
This package supports a number of single-phase properties, which are defined in the
property_tables module. The list of supported properties is returned through the
props argument.
§Arguments
props- The list of supported single-phase properties, which is returned through a CapeArrayStringOut object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn get_two_phase_prop_list(
&mut self,
props: &mut CapeArrayStringOut<'_>,
) -> Result<(), COBIAError>
fn get_two_phase_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>
Get a list of supported two-phase properties.
This package does not support two-phase properties, and the method always returns an empty list.
§Arguments
props- The list of supported two-phase properties, which is returned through a CapeArrayStringOut object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§impl ICapeThermoPropertyRoutineImpl for SaltWaterPropertyPackage
impl ICapeThermoPropertyRoutineImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeThermoPropertyRoutineImpl + ICapeInterfaceImpl,
extern "C" fn raw_calc_and_get_ln_phi( me: *mut c_void, phase_label: *mut _ICapeString, temperature: f64, pressure: f64, mole_fraction: *mut ICapeArrayReal, f_flags: i32, ln_phi: *mut ICapeArrayReal, ln_phi_dt: *mut ICapeArrayReal, ln_phi_dp: *mut ICapeArrayReal, ln_phi_dn: *mut ICapeArrayReal, ) -> u32
extern "C" fn raw_calc_single_phase_prop( me: *mut c_void, props: *mut ICapeArrayString, phase_label: *mut _ICapeString, ) -> u32
extern "C" fn raw_calc_two_phase_prop( me: *mut c_void, props: *mut ICapeArrayString, phase_labels: *mut ICapeArrayString, ) -> u32
extern "C" fn raw_check_single_phase_prop_spec( me: *mut c_void, property: *mut _ICapeString, phase_label: *mut _ICapeString, valid: *mut u32, ) -> u32
extern "C" fn raw_check_two_phase_prop_spec( me: *mut c_void, property: *mut _ICapeString, phase_labels: *mut ICapeArrayString, valid: *mut u32, ) -> u32
extern "C" fn raw_get_single_phase_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32
extern "C" fn raw_get_two_phase_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeThermoPropertyRoutine_VTable = _
Source§impl ICapeThermoUniversalConstant for SaltWaterPropertyPackage
The ICapeThermoPropertyRoutine interface can optionally be implemented by a property package to allow
a client to obtain values for universal constants
impl ICapeThermoUniversalConstant for SaltWaterPropertyPackage
The ICapeThermoPropertyRoutine interface can optionally be implemented by a property package to allow a client to obtain values for universal constants
Source§fn get_universal_constant(
&mut self,
constant_id: &CapeStringIn<'_>,
constant_value: &mut CapeValueOut<'_>,
) -> Result<(), COBIAError>
fn get_universal_constant( &mut self, constant_id: &CapeStringIn<'_>, constant_value: &mut CapeValueOut<'_>, ) -> Result<(), COBIAError>
Get the value of a universal constant.
for get_universal_constant, performance is not critical. If performance is critical, one should not convert to string, but compare the CapeConstString directly, which is pre-encoded, or build a HashMap using CapeConstString as key.
§Arguments
constant_id- The ID of the universal constant to be retrieved, which is specified through a CapeStringIn objectconstant_value- The value of the universal constant, which is returned through a CapeValueOut object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn get_universal_constant_list(
&mut self,
constant_id_list: &mut CapeArrayStringOut<'_>,
) -> Result<(), COBIAError>
fn get_universal_constant_list( &mut self, constant_id_list: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>
Source§impl ICapeThermoUniversalConstantImpl for SaltWaterPropertyPackage
impl ICapeThermoUniversalConstantImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeThermoUniversalConstantImpl + ICapeInterfaceImpl,
extern "C" fn raw_get_universal_constant( me: *mut c_void, constant_id: *mut _ICapeString, constant_value: *mut ICapeValue, ) -> u32
extern "C" fn raw_get_universal_constant_list( me: *mut c_void, constant_id_list: *mut ICapeArrayString, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeThermoUniversalConstant_VTable = _
Source§impl ICapeUtilities for SaltWaterPropertyPackage
The ICapeUtilities interface must be implemented by all CAPE-OPEN Primary PMC (creatable) objects.
impl ICapeUtilities for SaltWaterPropertyPackage
The ICapeUtilities interface must be implemented by all CAPE-OPEN Primary PMC (creatable) objects.
Source§fn get_parameters(
&mut self,
) -> Result<CapeCollection<CapeParameter>, COBIAError>
fn get_parameters( &mut self, ) -> Result<CapeCollection<CapeParameter>, COBIAError>
Obtain the parameter collection of the object
This object has no parameters, and the method always returns a not implemented error.
§Arguments
params- The parameter collection of the object, which is returned through a CapeCollection object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn set_simulation_context(
&mut self,
_: CapeSimulationContext,
) -> Result<(), COBIAError>
fn set_simulation_context( &mut self, _: CapeSimulationContext, ) -> Result<(), COBIAError>
Set the simulation context of the object
The Simulation Context object provides a number of services implemented by the PMC, including the ability to log messages. It is not used by this object.
§Arguments
context- The simulation context of the object, which is specified through a CapeSimulationContext object
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn initialize(&mut self) -> Result<(), COBIAError>
fn initialize(&mut self) -> Result<(), COBIAError>
Initialize the object
This object does not need any initialization, and the method always returns success. Initialization must be called by the PME on any CAPE-OPEN Primary PMC Object, after persistence (if the object is depersist) but before any other method is called (except setting the simulation context).
Any object that is successfully initialized must be terminated before it can be destroyed. If Initialize returns an error, Terminate must not be called.
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn terminate(&mut self) -> Result<(), COBIAError>
fn terminate(&mut self) -> Result<(), COBIAError>
Terminate the object
During termination, and object must release all external references. For this object, the only extenal reference is the active material object.
§Returns
Result- A result object that indicates whether the operation was successful or not
Source§fn edit(&mut self, _: CapeWindowId) -> Result<CapeEditResult, COBIAError>
fn edit(&mut self, _: CapeWindowId) -> Result<CapeEditResult, COBIAError>
Edit the object; this is the only time the object may show a modal dialog.
Editing may be invoked to alter the state of the object, or just to inspect the object. Therefore the edit function must indicate whether the object has changed so that the PME may re-obtain the information exposed by the object (supported compounds, phases, …) and invalidate any solution that involves calculations by the object
§Arguments
window_id- The window ID of the parent window
§Returns
Result- A result object that indicates whether the operation was successful or not; contains modification state for a successful operation
Source§impl ICapeUtilitiesImpl for SaltWaterPropertyPackage
impl ICapeUtilitiesImpl for SaltWaterPropertyPackage
type T = SaltWaterPropertyPackage
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeUtilitiesImpl + ICapeInterfaceImpl,
extern "C" fn raw_get_parameters( me: *mut c_void, parameters: *mut *mut _CAPEOPEN_1_2_ICapeCollection, ) -> u32
extern "C" fn raw_set_simulation_context( me: *mut c_void, context: *mut _CAPEOPEN_1_2_ICapeSimulationContext, ) -> u32
extern "C" fn raw_initialize(me: *mut c_void) -> u32
extern "C" fn raw_terminate(me: *mut c_void) -> u32
extern "C" fn raw_edit( me: *mut c_void, parent: *mut HWND__, result: *mut i32, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeUtilities_VTable = _
Source§impl PMCRegisterationInfo for SaltWaterPropertyPackage
The registration information is needed for PMC objects that can be created
by extenal applicaitons, and therefore need to be in the COBIA registry. This
defines the unique identifier for the object, but also how the object is
visible to the end-user.
impl PMCRegisterationInfo for SaltWaterPropertyPackage
The registration information is needed for PMC objects that can be created by extenal applicaitons, and therefore need to be in the COBIA registry. This defines the unique identifier for the object, but also how the object is visible to the end-user.