sunpeek.components.fluids.WPDFluidDefinition#

class sunpeek.components.fluids.WPDFluidDefinition(name, density_model, heat_capacity_model, manufacturer=None, description=None)#

Bases: FluidDefinition

Definitions of WPD fluids, for reuse by WPDFluid subclasses

Notes

  • To add to the database:

``` import onnx dens = onnx.load(‘E:/HarvestIT/tests/resources/fluids/FHW, Pekasolar/Pekasolar, pdf export, density.onnx’) hc = onnx.load(‘E:/HarvestIT/tests/resources/fluids/FHW, Pekasolar/Pekasolar, pdf export, heat capacity.onnx’) dens_m = fluids.wpd.ModelFactory(unit, onnx_model=dens) hc_m = fluids.wpd.ModelFactory(unit, onnx_model=hc) definition= WPDFluidDefinition(unique_name, dens_m, hc_m, manufacturer=, datasheet_info) with Session(module_engine) as session:

session.add(definition) session.commit()

```

Methods

__init__(name, density_model, ...[, ...])

A simple constructor that allows initialization from kwargs.

add_component_attr(name[, unit, minimum, ...])

all_subclasses([c])

define_component_attrs()

from_fluid_info(fluid_info)

get_component_attribute(name)

get_default_unit(name)

Return default unit of a class attribute defined as ComponentParam.

get_definition(fluid_string, session)

Tries to find a match for fluid_string among fluids definitions.

register_callback(callback_type, func)

set_component_attribute(name, value, array_type)

classmethod get_default_unit(name)#

Return default unit of a class attribute defined as ComponentParam.

Return type:

str

classmethod get_definition(fluid_string, session)#

Tries to find a match for fluid_string among fluids definitions. Compares lower case and neglecting whitespaces. Checks against name and description.

Parameters:
  • fluid_string (str) – User-supplied string that must uniquely define a fluid within the CoolProp incompressible fluids, or predefined wpd_fluids. See `CoolProp Incompressibles`_.

  • session (sqlalchemy.orm.session.Session) – An active database session object

Return type:

A CoolpropFluidDefinition or WPDFluidDefinition object if a unique match for `fluid string is found in the fluid_definitions table`

Raises:

ValueError – If no or more than one fluid is found.