Schema and Configuration

The OpenPinch.lib package defines the typed contract between external callers and the analysis engine. If you are building an application around OpenPinch, this is the package that tells you what inputs are accepted, what outputs are returned, and which enumerated labels and configuration flags are expected throughout the workflow.

Configuration and Numeric Conventions

OpenPinch.lib.config provides the runtime configuration object and the global constants used across multiple modules. Many option names intentionally mirror the long-standing Excel workbook so workbook and Python workflows can share the same mental model.

Typed configuration primitives and schemas for OpenPinch.

The OpenPinch.lib package exposes enumerations, configuration helpers, and the Pydantic schema models that define the wire format used by the public API. They are re-exported here for consumers that need to construct or inspect inputs programmatically.

Configuration defaults and global numerical constants for OpenPinch.

The Configuration object centralizes option flags and numerical settings used across direct integration, utility targeting, and optional advanced routines such as heat pump and cost targeting.

class OpenPinch.lib.config.Configuration(options=None, top_zone_name='Site', top_zone_identifier='Site')[source]

Bases: object

Runtime configuration defaults used throughout OpenPinch.

The attributes on this class combine global numerical settings, workbook- compatible feature flags, and advanced-analysis parameters such as heat pump or costing options. A Configuration instance is attached to each Zone so workflows can vary behaviour by hierarchy level if needed.

Initialise defaults and optionally apply user-provided options.

Parameters:
  • options (dict | None)

  • top_zone_name (str)

  • top_zone_identifier (str)

Enumerations and Labels

The enums module centralises the canonical names used for zones, targets, streams, graph series, and workbook-compatible option keys. Refer to these when you need stable identifiers instead of free-form strings.

Enumerations and lightweight typed contracts used across OpenPinch.

These enums standardize zone types, stream classifications, Problem Table column names, graph labels, and options keys used by configuration and schemas.

class OpenPinch.lib.enums.ArrowHead(*values)[source]

Bases: Enum

Position of arrow head

class OpenPinch.lib.enums.BB_Minimiser(*values)[source]

Bases: str, Enum

Supported optimisation backends for multistart black-box search.

class OpenPinch.lib.enums.CogenerationTarget(*args, **kwargs)[source]

Bases: Protocol

Compatible target surface required by cogeneration analysis helpers.

class OpenPinch.lib.enums.GraphType(*values)[source]

Bases: Enum

Graph groups available in the OpenPinch reporting payload.

OpenPinch.lib.enums.GT

alias of GraphType

class OpenPinch.lib.enums.HeatExchangerTypes(*values)[source]

Bases: Enum

Heat exchanger flow arrangements

class OpenPinch.lib.enums.HeatFlowUnits(*values)[source]

Bases: Enum

Heat flow units

class OpenPinch.lib.enums.HeatPump(*values)[source]

Bases: Enum

Heat pump components

class OpenPinch.lib.enums.HeatPumpAndRefrigerationCycle(*values)[source]

Bases: str, Enum

Supported heat pump targeting model families.

OpenPinch.lib.enums.HPRcycle

alias of HeatPumpAndRefrigerationCycle

class OpenPinch.lib.enums.LegendSeries(*values)[source]

Bases: Enum

Legend labels for multi-series graphs.

class OpenPinch.lib.enums.LineColour(*values)[source]

Bases: Enum

Line colour selection

class OpenPinch.lib.enums.ProblemTableLabel(*values)[source]

Bases: Enum

Problem table column header labels

OpenPinch.lib.enums.PT

alias of ProblemTableLabel

OpenPinch.lib.enums.ResultsType

alias of GraphType

OpenPinch.lib.enums.SID

alias of StreamID

OpenPinch.lib.enums.SD

alias of StreamDataLabel

OpenPinch.lib.enums.ST

alias of StreamType

class OpenPinch.lib.enums.StreamDataLabel(*values)[source]

Bases: Enum

Stream data column header labels

class OpenPinch.lib.enums.StreamID(*values)[source]

Bases: Enum

Stream identity

class OpenPinch.lib.enums.StreamLoc(*values)[source]

Bases: Enum

Stream set identity

class OpenPinch.lib.enums.StreamType(*values)[source]

Bases: Enum

Steam type

class OpenPinch.lib.enums.SummaryRowType(*values)[source]

Bases: Enum

Row semantics for tabular summary output.

class OpenPinch.lib.enums.TargetType(*values)[source]

Bases: Enum

Different target calculation categories.

OpenPinch.lib.enums.TT

alias of TargetType

class OpenPinch.lib.enums.TurbineModel(*values)[source]

Bases: Enum

Alternative turbine performance correlations used in power targeting.

class OpenPinch.lib.enums.ZoneType(*values)[source]

Bases: Enum

Types of zones used to divide the problem.

OpenPinch.lib.enums.ZT

alias of ZoneType

Pydantic Schemas

The schema layer is the primary programmatic interface to OpenPinch. It is now split by concern under OpenPinch.lib.schemas rather than concentrated in one large module.

The main schema modules are:

Common request models include:

Common response and reporting models include:

Heat pump integration helper models include:

Specialised helper models also capture lower-level Heat Pump optimisation inputs/outputs, integrated Heat Pump screening comparisons, piecewise stream linearisation requests, and legacy visualisation data structures.

Concern-based schema package for OpenPinch.

Common schema primitives and shared type aliases.

class OpenPinch.lib.schemas.common.StatefulValueWithUnit(*, values, unit=None)[source]

Bases: BaseModel

Container storing multi-state magnitudes, weights, and a shared unit.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.common.StatefulValueWithUnitAndWeights(*, values, unit=None, weights=None)[source]

Bases: BaseModel

Container storing multi-state magnitudes, weights, and a shared unit.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.common.ValueWithUnit(*, value=None, unit=None)[source]

Bases: BaseModel

Container storing a magnitude and its associated unit string.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • value (float | None)

  • unit (str | None)

model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Graph payload schemas.

class OpenPinch.lib.schemas.graphs.DataPoint(*, x, y)[source]

Bases: BaseModel

Coordinate used to construct composite curves and other plots.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.graphs.Graph(*, type, segments=<factory>)[source]

Bases: BaseModel

Collection of segments representing a single graph (e.g., GCC).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'use_enum_values': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.graphs.GraphSet(*, name='GraphSet', target_type=None, state_id=None, zone_name=None, zone_address=None, graphs=<factory>)[source]

Bases: BaseModel

Named group of graphs emitted for a particular zone or context.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • name (str)

  • target_type (str | None)

  • state_id (str | None)

  • zone_name (str | None)

  • zone_address (str | None)

  • graphs (List[Graph])

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.graphs.Segment(*, title=None, colour=None, arrow=None, data_points=<factory>)[source]

Bases: BaseModel

Continuous plot segment optionally annotated with colour/arrows.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Schemas used by heat pump and refrigeration solvers.

class OpenPinch.lib.schemas.hpr.HeatPumpTargetInputs(*, hpr_type, Q_hpr_target, Q_heat_max, Q_cool_max, z_amb_hot, z_amb_cold, dt_range_max, T_hot, H_hot, T_cold, H_cold, n_cond, n_evap, eta_comp, eta_exp, dtcont_hp, dt_hp_ihx, dt_cascade_hx, dt_phase_change, heat_to_power_ratio, cold_to_power_ratio, is_heat_pumping, max_multi_start, T_env, dt_env_cont, eta_ii_hpr_carnot, eta_ii_he_carnot, refrigerant_ls, do_refrigerant_sort, initialise_simulated_cycle, allow_integrated_expander, dT_subcool=None, dT_superheat=None, bckgrd_hot_streams=None, bckgrd_cold_streams=None, bb_minimiser=None, eta_penalty=0.01, rho_penalty=10, idx=0, debug)[source]

Bases: BaseModel

Parameter bundle for heat pump and refrigeration targeting routines.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.hpr.HeatPumpTargetOutputs(*, utility_tot, w_net, w_hpr=None, w_he=None, heat_recovery=None, Q_ext, Q_amb_hot, Q_amb_cold, cop_h=None, eta_he=None, obj, success, hpr_hot_streams, hpr_cold_streams, amb_streams, T_cond=None, T_evap=None, Q_cond=None, Q_evap=None, Q_cond_he=None, Q_evap_he=None, dT_subcool=None, dT_superheat=None, T_comp_out=None, dT_gc=None, dT_comp=None, Q_heat=None, Q_cool=None, model=None)[source]

Bases: BaseModel

Normalized output contract for HPR targeting routines.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.hpr.HPRParsedState(*, Q_amb_hot=0.0, Q_amb_cold=0.0, T_cond=None, T_evap=None, dT_subcool=None, dT_superheat=None, dT_ihx_gas_side=None, T_comp_out=None, dT_gc=None, dT_comp=None, Q_heat=None, Q_cool=None)[source]

Bases: BaseModel

Internal parsed optimisation-state payload across HPR backends.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.hpr.HPRThermoArtifacts(*, hpr_streams=None, model=None, debug_figure=None)[source]

Bases: BaseModel

Optional solved thermodynamic artefacts attached to a backend result.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.hpr.HPRBackendResult(*, obj, utility_tot, w_net, Q_ext_heat, Q_ext_cold, Q_amb_hot, Q_amb_cold, success=True, w_hpr=None, w_he=None, heat_recovery=None, cop_h=None, eta_he=None, amb_streams=None, T_cond=None, T_evap=None, Q_cond=None, Q_evap=None, Q_cond_he=None, Q_evap_he=None, dT_subcool=None, dT_superheat=None, T_comp_out=None, dT_gc=None, dT_comp=None, Q_heat=None, Q_cool=None, failure_reason=None, artifacts=None)[source]

Bases: BaseModel

Internal backend result before public schema validation.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Schemas for external inputs, outputs, and user-facing I/O data.

class OpenPinch.lib.schemas.io.GetInputOutputData(*, plant_profile_data, streams, utilities=<factory>, options=<factory>)[source]

Bases: BaseModel

Aggregate structure used by legacy I/O helpers and tests.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.LineariseInput(*, t_h_data, num_intervals=100, t_min=1, streams, ppKey='', mole_flow=1.0)[source]

Bases: BaseModel

Input bundle for stream linearisation workflows.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.LineariseOutput(*, streams)[source]

Bases: BaseModel

Output data containing generated linearised stream segments.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

streams (List[list | None])

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.NonLinearStream(*, t_supply, t_target, p_supply, p_target, h_supply, h_target, composition)[source]

Bases: BaseModel

Nonlinear stream definition used by piecewise linearisation utilities.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.ProblemTableDataSchema(*, name, data)[source]

Bases: BaseModel

Named container for a single temperature-enthalpy profile.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.StreamSchema(*, zone, name, t_supply, t_target, heat_flow, dt_cont=0.0, htc=1.0, active=True)[source]

Bases: BaseModel

Process stream definition supplied to the targeting service.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.THSchema(*, T, H_hot=None, H_cold=None, H_net=None, H_hot_net=None, H_cold_net=None)[source]

Bases: BaseModel

Temperature-enthalpy series data used for Problem Table exchange.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.TargetInput(*, streams, utilities=<factory>, options=None, zone_tree=None)[source]

Bases: BaseModel

Validated top-level input data for pinch_analysis_service.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.TargetOutput(*, name='Site', state_id=None, targets, graphs=None)[source]

Bases: BaseModel

Top-level response data returned by OpenPinch.pinch_analysis_service().

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.UtilitySchema(*, name, type, t_supply, t_target=None, heat_flow=None, dt_cont=0.0, htc=1.0, price=1.0, active=True)[source]

Bases: BaseModel

Utility definition including thermal and optional economic attributes.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'use_enum_values': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.VisualiseInput(*, zones)[source]

Bases: BaseModel

Input data for graph visualisation conversion routines.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

zones (list)

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.VisualiseOutput(*, graphs)[source]

Bases: BaseModel

Graph payload returned by visualisation conversion routines.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

graphs (List[GraphSet])

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.io.ZoneTreeSchema(*, name, type, dt_cont_multiplier=None, children=None)[source]

Bases: BaseModel

Recursive description of the zone hierarchy for the analysis.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Schemas for serialized summaries and report-facing data.

class OpenPinch.lib.schemas.reporting.HeatUtility(*, name, heat_flow)[source]

Bases: BaseModel

Report-friendly representation of a utility contribution.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.reporting.TargetResults(*, name, state_id=None, degree_of_integration=None, Qh, Qc, Qr, utility_cost=None, row_type=None, hot_utilities=<factory>, cold_utilities=<factory>, temp_pinch, work_target=None, turbine_efficiency_target=None, area=None, num_units=None, capital_cost=None, total_cost=None, exergy_sources=None, exergy_sinks=None, ETE=None, exergy_req_min=None, exergy_des_min=None, hpr_cycle=None, hpr_utility_total=None, hpr_work=None, hpr_external_utility=None, hpr_ambient_hot=None, hpr_ambient_cold=None, hpr_cop=None, hpr_eta_he=None, hpr_success=None, hpr_hot_streams=None, hpr_cold_streams=None)[source]

Bases: BaseModel

Summary metrics for a single zone/target returned by the analysis.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.reporting.TempPinch(*, cold_temp=None, hot_temp=None)[source]

Bases: BaseModel

Hot and cold pinch temperatures attached to a targeting record.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Runtime target schemas used by OpenPinch analysis services.

class OpenPinch.lib.schemas.targets.BaseTargetModel(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True)[source]

Bases: BaseModel

Shared metadata for all solved target objects.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_target_results(isTotal=False)[source]

Convert the runtime target into the exported reporting schema.

Parameters:

isTotal (bool)

Return type:

TargetResults

serialize_json(isTotal=False)[source]

Serialise the reporting-schema view of this target to plain Python.

Parameters:

isTotal (bool)

Return type:

dict[str, Any]

class OpenPinch.lib.schemas.targets.DirectHeatPumpTarget(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target=0.0, cold_utility_target=0.0, heat_recovery_target=0.0, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None, graphs=<factory>, pt, work_target=None, turbine_efficiency_target=None, hpr_cycle, hpr_utility_total, hpr_work, hpr_external_utility, hpr_ambient_hot, hpr_ambient_cold, hpr_cop, hpr_eta_he, hpr_success, hpr_hot_streams, hpr_cold_streams, hpr_details)[source]

Bases: HeatPumpTargetBase

Direct heat pump targeting result.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.targets.DirectIntegrationTarget(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target, cold_utility_target, heat_recovery_target, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None, graphs=<factory>, pt, pt_real, utility_heat_recovery_target=None, area=None, num_units=None, capital_cost=None, total_cost=None, exergy_sinks=None, exergy_sources=None, exergy_des_min=None, exergy_req_min=None, ETE=None, work_target=None, turbine_efficiency_target=None)[source]

Bases: GraphBackedTarget, UtilitySummaryTarget

Detailed direct-integration runtime target.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
to_target_results(isTotal=False)[source]

Return the reporting payload including DI-only cost and work fields.

Parameters:

isTotal (bool)

Return type:

TargetResults

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.targets.DirectRefrigerationTarget(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target=0.0, cold_utility_target=0.0, heat_recovery_target=0.0, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None, graphs=<factory>, pt, work_target=None, turbine_efficiency_target=None, hpr_cycle, hpr_utility_total, hpr_work, hpr_external_utility, hpr_ambient_hot, hpr_ambient_cold, hpr_cop, hpr_eta_he, hpr_success, hpr_hot_streams, hpr_cold_streams, hpr_details)[source]

Bases: HeatPumpTargetBase

Direct refrigeration targeting result.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.targets.HeatPumpTargetBase(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target=0.0, cold_utility_target=0.0, heat_recovery_target=0.0, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None, graphs=<factory>, pt, work_target=None, turbine_efficiency_target=None, hpr_cycle, hpr_utility_total, hpr_work, hpr_external_utility, hpr_ambient_hot, hpr_ambient_cold, hpr_cop, hpr_eta_he, hpr_success, hpr_hot_streams, hpr_cold_streams, hpr_details)[source]

Bases: GraphBackedTarget, UtilitySummaryTarget

Base contract for advanced HPR targets from explicit target_* methods.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
to_target_results(isTotal=False)[source]

Return the reporting payload for explicit HPR target results.

Parameters:

isTotal (bool)

Return type:

TargetResults

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.targets.IndirectHeatPumpTarget(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target=0.0, cold_utility_target=0.0, heat_recovery_target=0.0, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None, graphs=<factory>, pt, work_target=None, turbine_efficiency_target=None, hpr_cycle, hpr_utility_total, hpr_work, hpr_external_utility, hpr_ambient_hot, hpr_ambient_cold, hpr_cop, hpr_eta_he, hpr_success, hpr_hot_streams, hpr_cold_streams, hpr_details)[source]

Bases: HeatPumpTargetBase

Indirect heat pump targeting result.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.targets.IndirectRefrigerationTarget(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target=0.0, cold_utility_target=0.0, heat_recovery_target=0.0, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None, graphs=<factory>, pt, work_target=None, turbine_efficiency_target=None, hpr_cycle, hpr_utility_total, hpr_work, hpr_external_utility, hpr_ambient_hot, hpr_ambient_cold, hpr_cop, hpr_eta_he, hpr_success, hpr_hot_streams, hpr_cold_streams, hpr_details)[source]

Bases: HeatPumpTargetBase

Indirect refrigeration targeting result.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.targets.TotalProcessTarget(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target, cold_utility_target, heat_recovery_target, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None)[source]

Bases: UtilitySummaryTarget

Aggregated process-level utility summary built from solved subzones.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.targets.TotalSiteTarget(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target, cold_utility_target, heat_recovery_target, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None, graphs=<factory>, pt, work_target=None, turbine_efficiency_target=None)[source]

Bases: GraphBackedTarget, UtilitySummaryTarget

Total Site / indirect integration target with site Problem Tables and graphs.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
to_target_results(isTotal=False)[source]

Return the reporting payload including Total Site work fields.

Parameters:

isTotal (bool)

Return type:

TargetResults

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.targets.UtilitySummaryTarget(*, zone_name=None, state_id=None, state_idx=None, name, type, parent_zone=None, config=<factory>, active=True, hot_utilities=<factory>, cold_utilities=<factory>, hot_utility_target, cold_utility_target, heat_recovery_target, heat_recovery_limit=None, degree_of_int=None, utility_cost=0.0, hot_pinch=None, cold_pinch=None)[source]

Bases: BaseTargetModel

Target that returns utility duties and recovered-heat summaries.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
property utility_streams: StreamCollection

Return hot and cold utilities as one combined collection.

calc_utility_cost()[source]

Calculate and cache the total utility cost across attached utilities.

Return type:

float

to_target_results(isTotal=False)[source]

Return the common reporting payload for utility-summary targets.

Parameters:

isTotal (bool)

Return type:

TargetResults

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Schemas for turbine solve outputs.

class OpenPinch.lib.schemas.turbine.TurbineSolveResult(*, mode, turbine_model, load_frac, mech_eff, min_eff, is_high_p_cond_flash, total_work, total_isentropic_work, overall_efficiency, total_process_duty, steam_mass_flow_in=None, inlet_pressure=None, inlet_temperature=None, sink_pressure=None, sink_temperature=None, stage_temperatures=<factory>, stage_heat_flows=<factory>, stages=<factory>)[source]

Bases: BaseModel

Validated output for a multi-stage turbine targeting solve.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class OpenPinch.lib.schemas.turbine.TurbineStageResult(*, stage, source_index, stage_type, temperature, process_duty, pressure_in, pressure_out, mass_flow_in, mass_flow_extracted, mass_flow_out, enthalpy_in, enthalpy_out, condensate_enthalpy, saturation_enthalpy, dh_isentropic, work_actual, work_isentropic, isentropic_efficiency, turbine_model)[source]

Bases: BaseModel

Detailed result for one solved turbine stage.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].