Domain Model
This page is an unsupported contributor reference. Runtime domain classes and parent-owned records may change without compatibility aliases.
Once a problem is prepared, OpenPinch operates on a small set of in-memory domain objects. Understanding these classes is the key to using the package as more than a black box.
Core Objects
ZoneHierarchical analysis boundary containing streams, utilities, targets, and graphs.
StreamProcess or utility stream with
supply_temperature,target_temperature, shifted temperatures, and base/effectivedelta_t_contributionbehavior. A variable-heat-capacity parent owns an immutable ordered view of internal segment records while retaining one physical stream identity.
Segment mutations are transactional and revalidate the complete profile.
Stream.update_segments(...) applies sparse changes to several children in
one atomic commit; an invalid index, attribute, or resulting profile leaves the
parent and every child unchanged. Runtime segment record classes are private;
construct them through Stream mappings or StreamSegmentSchema inputs.
For segmented utilities, child prices may differ. The parent price is the
duty-weighted effective value for each operating period, so the derived parent
cost equals the sum of the child costs. Assigning parent.price is an
explicit broadcast to every child; updating one child afterwards may make the
prices differ again.
StreamCollectionOrdered container with hot/cold filtering and utility inversion helpers. Ordinary iteration and reports remain parent-based; explicit expanded exports include canonical parent keys and ordered segment identities.
ProblemTableNumerical temperature-interval table behind composite curves, pinch temperatures, utility cascades, and several advanced targeting routines.
ProcessComponentMemory-only component attached to a prepared problem when the model needs to be mutated before targeting. The direct process MVR component uses this layer to replace selected hot gas/vapour streams with compressed replacement streams.
HeatExchangerNetworkSelected heat exchanger network design result with ordered exchanger records and period-aware total-duty helpers. The presentation-owned
build_grid_diagram(...)function handles Plotly grid inspection. Period identity may be omitted only when the network has exactly one period.HeatExchangerOne physical parent-level match in a synthesized network. For segmented streams,
segment_area_contributionscontains ordered diagnostic slices; shared topology, maximum design area, and capital data remain on the exchanger. Operating data is read fromstate(period_id).
Operating-period records are owned by each HeatExchanger and contain duty,
activity, terminal approaches, branch split fractions, and source/sink inlet
and outlet temperatures. Their runtime classes are private; multiperiod access
always names the period through exchanger.state(period_id).
These are the objects you inspect when you need to understand how a case was prepared or why a target changed after mutating the in-memory model.
Key Classes
- class OpenPinch.domain.zone.Zone(name='Zone', type='Process Zone', config=None, parent_zone=None)[source]
Bases:
objectHierarchical analysis boundary containing streams, utilities, and targets.
Zones form the backbone of the in-memory OpenPinch model. Each zone can own process streams, utility streams, solved targets, generated graphs, and nested child zones. Direct and indirect integration routines progressively populate this structure as the analysis moves from local process scopes up to site-style aggregation.
Initialise an empty zone with stream, target, and graph containers.
- Parameters:
name (str)
type (str)
config (Optional[Configuration])
parent_zone (Zone)
- property name
Display name used when addressing the zone in the hierarchy.
- property type
Zone type type from
ZoneType.
- property config
Configuration object controlling analysis behaviour for this zone.
- property parent_zone
Direct parent zone in the site hierarchy, if any.
- property active: bool
Whether the zone participates in the current analysis.
- property period_ids: dict[str, int] | None
Canonical
period_id -> idxlookup for this zone.
- property weights
Canonical period weights for this zone.
- property num_periods
Number of distinct states for this zone.
- property address: str
Slash-delimited path from the root zone to this zone.
- property dt_cont_multiplier: float
Effective multiplier applied to stream and utility
dt_contvalues.
- property hot_streams
Process streams that release heat within this zone.
- property cold_streams
Process streams that require heat within this zone.
- property net_hot_streams
Net hot streams derived from zonal aggregation.
- property net_cold_streams
Net cold streams derived from zonal aggregation.
- property hot_utilities
Hot utility streams assigned to the zone.
- property cold_utilities
Cold utility streams assigned to the zone.
- property graphs
Graphs generated for this zone.
- property subzones
Immediate child zones keyed by name.
- property targets
Energy targets keyed by target name.
- property process_streams
Combined hot and cold process streams for the zone.
- property net_process_streams
Combined net hot and net cold process streams for the zone.
- property utility_streams
Combined hot and cold utility streams for the zone.
- property all_streams
All process and utility streams defined on the zone.
- set_period_context(period_ids, weights, num_periods)[source]
Set the canonical period lookup owned by this zone and propagate refs.
- Parameters:
period_ids (dict[str, int] | list[str] | tuple[str, ...] | None)
num_periods (int | None)
- Return type:
None
- add_graph(name, result)[source]
Store a graph result under
namefor later export or display.- Parameters:
name (str)
- add_zone(zone_to_add, sub=True)[source]
Add a single zone object keyed by its name.
If the zone name already exists: - If the zone is identical (e.g. same stream and utility objects), skip. - If it’s different, add it with a suffix like ‘_1’, ‘_2’, etc.
- Parameters:
sub (bool)
- add_target(target_to_add)[source]
Add one target to a specific zone.
- Parameters:
target_to_add (BaseTargetModel)
- add_targets(targets=None)[source]
Add multiple targets to a specific zone.
- Parameters:
targets (list | None)
- get_subzone(loc=None)[source]
Resolve a slash-delimited zone path relative to this zone.
- Parameters:
loc (str)
- Return type:
- calc_utility_cost()[source]
Calculate and cache the annual utility cost across assigned utilities.
- import_hot_and_cold_streams_from_sub_zones(get_net_streams=False, is_n_zone_depth=True, is_new_stream_collection=True)[source]
Get referenced hot and cold streams across multiple subzones.
- Parameters:
get_net_streams (bool)
is_n_zone_depth (bool)
is_new_stream_collection (bool)
- get_target_zone(zone_name)[source]
Resolve
zone_nameto the concrete zone that should receive a target.- Parameters:
zone_name (str | list | None)
- Return type:
- lock_dt_cont_multiplier()[source]
Lock the dt_cont_multiplier to prevent further changes.
- class OpenPinch.domain.stream.Stream(name='Stream', supply_temperature=None, target_temperature=None, supply_pressure=None, target_pressure=None, supply_enthalpy=None, target_enthalpy=None, delta_t_contribution=0.0, delta_t_contribution_multiplier=1.0, heat_flow=0.0, heat_transfer_coefficient=1.0, price=None, is_process_stream=True, fluid_name=None, fluid_phase=None, segments=None)[source]
Bases:
objectGeneric thermal stream used for both process and utility duties.
A
Streamstores supply/target states together with derived values such as hot/cold classification, shifted temperature bounds, heat-capacity flow rate, and simple economic attributes. The same class is reused for process streams, utilities, and derived net streams created during site- level aggregation.Initialise a stream and infer hot/cold classification.
- Parameters:
name (str)
supply_temperature (Optional[MaybeVU])
target_temperature (Optional[MaybeVU])
supply_pressure (Optional[MaybeVU])
target_pressure (Optional[MaybeVU])
supply_enthalpy (Optional[MaybeVU])
target_enthalpy (Optional[MaybeVU])
delta_t_contribution (MaybeVU)
delta_t_contribution_multiplier (float)
heat_flow (MaybeVU)
heat_transfer_coefficient (MaybeVU)
price (Optional[MaybeVU])
is_process_stream (bool)
fluid_name (Optional[str])
fluid_phase (Optional[str | FluidPhase])
segments (list[object] | tuple[object, ...] | None)
- property name: str
Stream name.
- property is_process_stream: bool
Process or utility stream.
- property fluid_name: str | None
CoolProp fluid name or mixture specification.
- property fluid_phase: str | None
sol, sle, liq, vle, sve, or gas.
- Type:
Optional fluid-phase flag
- property segments: tuple[StreamSegment, ...]
Ordered immutable view of the stream’s piecewise thermal segments.
- property has_segments: bool
Return whether this physical stream has an explicit thermal profile.
- property segment_count: int
Return the number of explicit thermal segments.
- property stream_type: str | None
Stream type (Hot, Cold, Both).
- property num_periods: int | None
Number of periods.
- property supply_temperature: Value | None
Supply temperature (e.g., degC).
- property target_temperature: Value | None
Target temperature (e.g., degC).
- property supply_pressure: Value | None
Supply pressure (e.g., kPa).
- property target_pressure: Value | None
Target pressure (e.g., kPa).
- property supply_enthalpy: Value | None
Supply enthalpy (e.g., kJ/kg).
- property target_enthalpy: Value | None
Target enthalpy (e.g., kJ/kg).
- property delta_t_contribution: Value
Preserved base delta-T contribution before any zone multiplier.
- property effective_delta_t_contribution: Value
Effective delta-T contribution used in shifted-temperature calculations.
- property delta_t_contribution_multiplier: float
Effective delta-T contribution used in shifted-temperature calculations.
- property delta_t_contribution_multiplier_locked: bool
Whether the delta-T contribution multiplier is locked against changes.
- property heat_flow: Value
Stream heat flow view over a scalar or multiperiod duty value.
- property heat_transfer_coefficient: Value
Heat transfer coefficient (e.g., kW/m^2/K).
- property heat_transfer_resistance: Value | None
Heat transfer resistance (e.g., m^2.K/kW).
- property price: Value
Unit energy price (e.g., $/MWh).
- property utility_cost: Value | None
Utility cost (e.g., $/y).
- property heat_capacity_flowrate: Value | None
Heat capacity flowrate (e.g., kW/K).
- property resistance_capacity_product: Value | None
Resistance-capacity product (1/heat transfer rate).
- property is_active: bool
Whether the stream is active in analysis.
- property minimum_temperature: Value | None
Minimum temperature (supply or target depending on hot/cold).
- property maximum_temperature: Value | None
Maximum temperature (supply or target depending on hot/cold).
- property shifted_minimum_temperature: Value | None
Shifted minimum temperature.
- property shifted_maximum_temperature: Value | None
Shifted maximum temperature.
- property entropic_mean_temperature: Value | None
Entropic mean temperature of supply and target temperatures.
- invert()[source]
Flip a utility stream into its generating process-stream analogue.
- Return type:
None
- replace_segments(segments)[source]
Normalize and atomically replace the piecewise profile.
- Return type:
None
- update_segment(index, **changes)[source]
Apply one segment update transactionally and revalidate the profile.
- Parameters:
index (int)
- Return type:
None
- update_segments(updates)[source]
Atomically apply sparse attribute changes to ordered child segments.
- Parameters:
updates (Mapping[int, Mapping[str, object]])
- Return type:
None
- classmethod from_temperature_heat_profile(*, name, points, heat_scale=1.0, heat_unit='kW', dt_diff_max=None, **stream_kwargs)[source]
Build one segmented stream from ordered
[heat, temperature]points.- Parameters:
name (str)
heat_scale (float)
heat_unit (str)
dt_diff_max (float | None)
- Return type:
- class OpenPinch.domain.stream_collection.StreamCollection(streams=None)[source]
Bases:
objectA dynamic, ordered collection of streams.
Key features include:
Add and remove streams by name.
Prevent overwriting existing streams by auto-renaming.
Configure sort keys as attributes or callables.
Iterate efficiently with lazy sorting.
Support ascending or descending ordering.
Initialise an empty collection sorted by descending supply temperature.
- Parameters:
streams (List['Stream'] | None)
- property period_ids: dict[str, int] | None
Return the canonical period identifiers for this collection.
- property weights: ndarray | None
Return the canonical period weights for this collection.
- property num_periods: int | None
Return the number of periods for this collection.
- add(stream, key=None, prevent_overwrite=True)[source]
Insert a stream, optionally renaming the key to avoid collisions.
- Parameters:
stream (Stream)
key (str)
prevent_overwrite (bool)
- Return type:
str
- add_many(streams, keys=None, prevent_overwrite=True)[source]
Insert several streams, optionally using explicit keys for each stream.
- Parameters:
streams (List[Stream])
prevent_overwrite (bool)
- remove(stream_name)[source]
Remove a stream by name.
- Parameters:
stream_name (str)
- sum_stream_attribute(attr_name, idx=None)[source]
Return the total of a specified attribute for streams in the collection.
- Parameters:
attr_name (str)
idx (int | None)
- Return type:
float
- set_common_stream_attribute(attr_name, value, *, idx=None)[source]
Set a common attribute across all streams in the collection.
- Parameters:
attr_name (str)
value (Any)
idx (int | None)
- set_sort_key(key, reverse=False)[source]
Set the sorting key. Supports attribute names or custom lambdas.
- Parameters:
key (str | List[str] | Callable)
reverse (bool)
- copy(*, deep=False)[source]
Return a copy of the collection, optionally deep-copying streams.
- Parameters:
deep (bool)
- Return type:
- set_period_context(period_ids, weights, num_periods=None)[source]
Persist the canonical shared period model for this collection.
- Parameters:
period_ids (dict[str, int] | list[str] | tuple[str, ...] | None)
weights (ndarray | list[float] | tuple[float, ...] | None)
num_periods (int | None)
- Return type:
None
- numeric_view(idx=None)[source]
Return a cached dense numeric view for stream-analysis kernels.
- Parameters:
idx (int | None)
- Return type:
StreamCollectionNumericView
- segment_numeric_view(idx=None)[source]
Return a cached numeric view expanded to ordered thermal segments.
- Parameters:
idx (int | None)
- Return type:
StreamCollectionNumericView
- get_index(stream)[source]
Return the position (index) of a stream object in the sorted stream list.
- Return type:
int
- items()[source]
Return the underlying keyed stream items in insertion order.
- to_dict(idx=None, *, expand_segments=False)[source]
Return stream data as serializable rows in standard reporting order.
- Parameters:
idx (int | None)
expand_segments (bool)
- Return type:
dict[str, list[Any]]
- get_hot_streams(include_process_streams=True, include_utility_streams=True, invert_utility=False, sort_attr=None)[source]
Return a new collection containing only hot streams.
- Parameters:
include_process_streams (bool)
include_utility_streams (bool)
invert_utility (bool)
sort_attr (str | None)
- get_cold_streams(include_process_streams=True, include_utility_streams=True, invert_utility=False, sort_attr=None)[source]
Return a new collection containing only cold streams.
- Parameters:
include_process_streams (bool)
include_utility_streams (bool)
invert_utility (bool)
sort_attr (str | None)
- get_process_streams(sort_attr=None)[source]
Return a new collection containing only process streams.
- Parameters:
sort_attr (str | None)
- get_hot_process_streams(sort_attr=None)[source]
Return a new collection containing only hot process streams.
- Parameters:
sort_attr (str | None)
- get_cold_process_streams(sort_attr=None)[source]
Return a new collection containing only cold process streams.
- Parameters:
sort_attr (str | None)
- get_utility_streams(sort_attr=None)[source]
Return a new collection containing only utility streams.
- Parameters:
sort_attr (str | None)
- get_hot_utility_streams(sort_attr=None)[source]
Return a new collection containing only hot utility streams.
- Parameters:
sort_attr (str | None)
- get_cold_utility_streams(sort_attr=None)[source]
Return a new collection containing only cold utility streams.
- Parameters:
sort_attr (str | None)
- get_inverted_hot_utility_streams(sort_attr=None)[source]
Return a new collection containing only inverted hot utility streams.
- Parameters:
sort_attr (str | None)
- get_inverted_cold_utility_streams(sort_attr=None)[source]
Return a new collection containing only inverted cold utility streams.
- Parameters:
sort_attr (str | None)
- class OpenPinch.domain.problem_table.ProblemTable(data_input=None, add_default_labels=True)[source]
Bases:
objectNumPy-backed pinch problem table with enum-friendly accessors.
Initialise the table from a dictionary or list-of-columns structure.
- Parameters:
data_input (dict[str | ProblemTableLabel, object] | list | None)
add_default_labels (bool)
- class ColumnViewByIndex(parent)[source]
Bases:
objectExpose read/write access to columns addressed by integer index.
- Parameters:
parent (ProblemTable)
- property icol
Return a view for column access by integer position.
- class ColumnViewByName(parent)[source]
Bases:
objectExpose read/write access to columns addressed by label or enum.
- Parameters:
parent (ProblemTable)
- property col
Return a view for column access by string label or ProblemTableLabel.
- class ColumnsViewByName(parent)[source]
Bases:
objectVectorised view over multiple labelled columns or enums.
- Parameters:
parent (ProblemTable)
- property cols
Return a vectorised view over multiple labelled columns or enums.
- class LocationByRowByColName(parent)[source]
Bases:
objectRow/column accessor mirroring
DataFrame.locsemantics.- Parameters:
parent (ProblemTable)
- property loc
Expose row/column access using label semantics (
loc).
- class LocationByRowByCol(parent)[source]
Bases:
objectRow/column accessor mirroring
DataFrame.ilocsemantics.- Parameters:
parent (ProblemTable)
- property iloc
Expose row/column access using positional semantics (
iloc).
- slice(keys)[source]
Return a new ProblemTable containing only the requested columns.
- Parameters:
keys (str | ProblemTableLabel | Sequence[str | ProblemTableLabel])
- Return type:
- property shape
Tuple describing
(rows, columns)for the buffer.
- property copy
Return a deep copy of the table.
- to_list(col=None)[source]
Return table data as Python lists; optionally restrict to a single column.
- Parameters:
col (str | ProblemTableLabel | None)
- round(decimals)[source]
Round the underlying NumPy buffer in-place.
- pinch_idx(col=ProblemTableLabel.H_NET)[source]
Return the row indices of the hot and cold pinch temperatures.
- Parameters:
col (int | str | ProblemTableLabel)
- Return type:
Tuple[int, int, bool]
- pinch_temperatures(col_T=ProblemTableLabel.T, col_H=ProblemTableLabel.H_NET)[source]
Determine the hottest hot and coldest cold pinch temperatures.
- Parameters:
col_T (str | ProblemTableLabel)
col_H (int | str | ProblemTableLabel)
- Return type:
Tuple[float | None, float | None]
- shift_heat_cascade(dh, col)[source]
Shift a heat-cascade column by
dhand return a table copy.- Parameters:
dh (float)
col (int | str | ProblemTableLabel)
- Return type:
- share_temperature_intervals(other)[source]
Mutate both tables so they use the union of their temperature intervals.
Returns a tuple containing
(rows_inserted_into_self, rows_inserted_into_other).- Parameters:
other (ProblemTable)
- Return type:
Tuple[int, int]
- insert_temperature_interval(T_ls)[source]
Insert any missing temperature intervals and return count inserted.
- Parameters:
T_ls (List[float] | float)
- Return type:
int
- insert(row_dict, index)[source]
Insert a single row (dict of column: value) at the specified index.
- Parameters:
row_dict (dict)
index (int)
- update_row(index, row_dict)[source]
Update selected columns for one row using values from
row_dict.- Parameters:
index (int)
row_dict (dict)
- update(updates=None, T_col=None)[source]
Assign aligned column values in-place using an explicit source T column.
- Parameters:
updates (dict[str | ProblemTableLabel, ndarray] | None)
T_col (ndarray | None)
- Return type:
- delete_row(index)[source]
Remove a row at
indexfrom the buffer.- Parameters:
index (int)
- sort_by_column(column, ascending=True)[source]
Sort rows in-place by the given column.
- Parameters:
column (str | ProblemTableLabel)
ascending (bool)
- class OpenPinch.domain.heat_exchanger_network.HeatExchangerNetwork(*, exchangers=<factory>, run_id=None, task_id=None, period_id=None, method=None, stage_count=None, objective_value=None, total_annual_cost=None, utility_cost=None, capital_cost=None, summary_metrics=<factory>, solver_axis_metadata=<factory>, source_metadata=<factory>)[source]
Bases:
BaseModelOrdered heat exchanger network result collection.
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:
exchangers (tuple[HeatExchanger, ...])
run_id (str | None)
task_id (str | None)
period_id (str | None)
method (str | None)
stage_count (int | None)
objective_value (float | None)
total_annual_cost (float | None)
utility_cost (float | None)
capital_cost (float | None)
summary_metrics (dict[str, float | int | str | bool | None])
solver_axis_metadata (dict[str, Any])
source_metadata (dict[str, Any])
- model_config = {'extra': 'forbid', 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property period_ids: tuple[str, ...]
Return ordered period identities represented by exchanger states.
- resolve_period_id(period_id=None)[source]
Resolve an optional period identity without ambiguous multiperiod access.
- Parameters:
period_id (str | None)
- Return type:
str | None
- exchangers_involving_stream(stream_id, *, active_only=False, period_id=None)[source]
Return all exchangers that use
stream_idas source or sink.- Parameters:
stream_id (str)
active_only (bool)
period_id (str | None)
- Return type:
tuple[HeatExchanger, …]
- exchanger_between(*, source_stream, sink_stream, stage=None, kind=None)[source]
Return the unique exchanger for a labelled source/sink/stage link.
- Parameters:
source_stream (str)
sink_stream (str)
stage (int | None)
kind (HeatExchangerKind | str | None)
- Return type:
HeatExchanger | None
- total_duty(*, kind=None, stream=None, stage=None, active_only=True, period_id=None)[source]
Return duty total filtered by kind, stream identity, and stage.
- Parameters:
kind (HeatExchangerKind | str | None)
stream (str | None)
stage (int | None)
active_only (bool)
period_id (str | None)
- Return type:
float
- total_area(*, kind=None, stream=None, stage=None, active_only=True, period_id=None)[source]
Return area total filtered by kind, stream identity, and stage.
- Parameters:
kind (HeatExchangerKind | str | None)
stream (str | None)
stage (int | None)
active_only (bool)
period_id (str | None)
- Return type:
float
- total(label, *, kind=None, stream=None, stage=None, active_only=True, period_id=None)[source]
Return a numeric total for a supported heat exchanger network label.
- Parameters:
label (HeatExchangerNetworkLabel | str)
kind (HeatExchangerKind | str | None)
stream (str | None)
stage (int | None)
active_only (bool)
period_id (str | None)
- Return type:
float
- labelled_value(label, *, source_stream, sink_stream, stage=None, kind=None, period_id=None)[source]
Return a labelled value from one source/sink/stage exchanger link.
- Parameters:
label (HeatExchangerNetworkLabel | str)
source_stream (str)
sink_stream (str)
stage (int | None)
kind (HeatExchangerKind | str | None)
period_id (str | None)
- Return type:
float | bool | None
- class OpenPinch.domain.heat_exchanger.HeatExchanger(*, exchanger_id=None, kind, source_stream, sink_stream, source_stream_role, sink_stream_role, stage=None, period_states, area=None, match_allowed=True, capital_cost=None, segment_area_contributions=<factory>, solver_metadata=<factory>, source_metadata=<factory>)[source]
Bases:
BaseModelOne labelled heat-transfer link in a heat exchanger network.
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:
exchanger_id (str | None)
kind (HeatExchangerKind)
source_stream (str)
sink_stream (str)
source_stream_role (StreamID)
sink_stream_role (StreamID)
stage (int | None)
period_states (Annotated[tuple[HeatExchangerPeriodState, ...], MinLen(min_length=1)])
area (float | None)
match_allowed (bool)
capital_cost (float | None)
segment_area_contributions (tuple[HeatExchangerAreaSlice, ...])
solver_metadata (dict[str, Any])
source_metadata (dict[str, Any])
- model_config = {'extra': 'forbid', 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property has_segment_area_contributions: bool
Return whether exact local segment-area slices are available.
- property segment_duty_by_period: dict[str, float]
Return local slice duty totals grouped by operating period.
- property segment_area_by_period: dict[str, float]
Return local slice area totals grouped by operating period.
- property segment_design_area: float | None
Return the maximum period-total slice area when slices are available.
- property period_ids: tuple[str, ...]
Return ordered operating-period identities for this exchanger.
- state(period_id=None)[source]
Return one period state, requiring identity for multiperiod results.
- Parameters:
period_id (str | None)
- Return type:
HeatExchangerPeriodState
- involves_stream(stream_id)[source]
Return whether this exchanger uses
stream_idas source or sink.- Parameters:
stream_id (str)
- Return type:
bool
- matches(*, source_stream, sink_stream, stage=None)[source]
Return whether this exchanger matches a labelled stream-stage link.
- Parameters:
source_stream (str)
sink_stream (str)
stage (int | None)
- Return type:
bool
Process Components
Process components are attached to a live PinchProblem and are not part of
the external input schema. They are useful for before/after studies where a
specific unit operation changes the active process stream set before targeting.
- class OpenPinch.analysis.heat_pumps.components.ProcessComponent(id, problem, component_type, active=True)[source]
Bases:
objectBase class for memory-only process components.
- Parameters:
id (str)
problem (PinchProblem)
component_type (str)
active (bool)
- activate()[source]
Activate the component.
- deactivate()[source]
Deactivate the component.
- class OpenPinch.analysis.heat_pumps.process_mvr.ProcessMVRComponent(id, problem, component_type='process_mvr', active=True, settings=<factory>, source_selectors=<factory>, stream_records=<factory>)[source]
Bases:
ProcessComponentMemory-only direct process MVR component.
- Parameters:
id (str)
problem (PinchProblem)
component_type (str)
active (bool)
settings (DirectGasMVRSettings)
source_selectors (list[Any])
stream_records (list[_ProcessMVRStreamRecord])
- activate()[source]
Use the MVR replacement streams in subsequent targeting.
- deactivate()[source]
Restore the original source streams for subsequent targeting.
Solved Target Records
Targets are stored on zones and normalized through schema models before export. The base target schema is a useful reference when you are programmatically comparing cases or consuming target results in another tool.
- class OpenPinch.domain.targets.BaseTargetModel(*, zone_name=None, period_id=None, period_idx=None, name, type, parent_zone=None, config=<factory>, active=True)[source]
Bases:
BaseModelShared 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:
zone_name (str | None)
period_id (str | None)
period_idx (int | None)
name (str)
type (str)
parent_zone (Any)
config (Configuration)
active (bool)
- 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].
How These Objects Relate
The usual flow is:
input schemas describe the external inputs
preparation turns those inputs into
ZoneandStreamobjectstargeting populates
ProblemTableobjects, zone targets, and graph dataresult schemas serialize the solved state back out
That layering is what lets the package support both high-level scripted use and deeper programmatic inspection.