PinchWorkspace
OpenPinch.PinchWorkspace manages named OpenPinch.PinchProblem
cases. The public vocabulary is consistently case-oriented.
Golden Path
from OpenPinch import PinchWorkspace
workspace = PinchWorkspace("crude_preheat_train.json", project_name="Site")
baseline = workspace.case("baseline")
baseline.target.direct_heat_integration()
retrofit = workspace.scenario("retrofit", dt_cont_multiplier=0.8)
retrofit.target.direct_heat_integration()
comparison = workspace.compare_cases("baseline", "retrofit")
Interaction Matrix
Surface |
Purpose |
Return |
State effect |
Dependency |
|---|---|---|---|---|
construction, |
Load, retrieve, select, and list named cases |
problem or names |
prepare/select |
base |
|
Create an unsolved case from an existing case with named overrides |
problem |
add case |
base |
|
Run one named workflow across an ordered case set |
ordered case result |
per-case |
method-specific |
|
Observe every selected solved case and preserve per-case failures |
result and error mappings |
none |
base |
|
Export each case workbook into a distinctly named case subdirectory |
result and error mappings |
explicit files |
excel |
|
Compare cached numerical summaries |
dataframe |
none |
base |
|
Forward to the active case |
active-case accessor |
method-specific |
method-specific |
|
Change persistent fallback values on a named or active case |
none |
invalidates case |
base |
|
Observe the selected case without solving |
dataframe, mapping, report, or record |
none |
base |
|
Persist or recover case inputs |
path, workspace, or mapping |
explicit persistence |
base |
|
Explicit output side effects for the active case |
path or dashboard handle |
none |
output-specific |
Observation methods do not solve an unsolved scenario. Call the desired
target or design method first. Method arguments remain ephemeral;
update_options(...) changes stored fallbacks.
Batch target and design namespaces are intentionally separate: a target batch
does not advertise HEN design methods, and a design batch does not advertise
targeting methods. One case failing does not discard successful cases; inspect
outcome.errors before using outcome.results.
Complete API
- class OpenPinch.PinchWorkspace(source=None, *, project_name='Site', baseline_name='baseline')[source]
Bases:
objectManage multiple named
PinchProblemcases with a script-native API.- Parameters:
source (TargetInput | JsonDict | PathLike | tuple[PathLike, PathLike] | PinchProblem | None)
project_name (Optional[str])
baseline_name (str)
- classmethod load_bundle(path)[source]
Load a previously persisted workspace bundle.
- Parameters:
path (str | Path)
- Return type:
- load(source, *, case_name=None, activate=True, project_name=None)[source]
Load or replace a named case and return a live validated case.
- Parameters:
source (TargetInput | Dict[str, Any] | str | Path | tuple[str | Path, str | Path] | PinchProblem | None)
case_name (str | None)
activate (bool)
project_name (str | None)
- Return type:
PinchProblem | None
- validation_report(case_name=None)[source]
Return a structured validation report for one case input.
- Parameters:
case_name (str | None)
- list_cases()[source]
Return the loaded case names in stable insertion order.
- Return type:
list[str]
- cases(names=None)[source]
Return an ordered batch view over selected cases.
- Parameters:
names (Iterable[str] | None)
- Return type:
_CaseBatch
- case(name=None)[source]
Return the live
PinchProblemfor one named case.- Parameters:
name (str | None)
- Return type:
- scenario(name, *, base=None, options=None, replace_options=False, dt_cont_multiplier=None, activate=False)[source]
Create and return an unsolved named scenario.
- Parameters:
name (str)
base (str | None)
options (dict[str, Any] | None)
replace_options (bool)
dt_cont_multiplier (float | None)
activate (bool)
- Return type:
- to_problem_json(*, case_name=None)[source]
Return canonical problem input for one named case.
- Parameters:
case_name (str | None)
- Return type:
Dict[str, Any]
- property active_case_name: str | None
Return the currently active case name.
- property target
Delegate the
targetaccessor to the active case.
- property plot
Delegate the
plotaccessor to the active case.
- property design
Delegate the
designaccessor to the active case.
- property components
Delegate the
componentsaccessor to the active case.
- property config
Return the active case’s read-only configuration view.
- property problem_data
Return the active case input.
- property problem_filepath
Return the active case filepath when available.
- property results
Return the active case results when available.
- property master_zone
Return the active case master zone when available.
- summary_frame(*, case_name=None, detailed=False, include_periods=False, include_weighted_average=False)[source]
Return the solved summary for one case.
- Parameters:
case_name (str | None)
detailed (bool)
include_periods (bool)
include_weighted_average (bool)
- Return type:
DataFrame
- metrics(*, case_name=None, include_periods=False, include_weighted_average=False)[source]
Return typed metrics for one case.
- Parameters:
case_name (str | None)
include_periods (bool)
include_weighted_average (bool)
- report(*, case_name=None, include_periods=False, include_weighted_average=False)[source]
Return a typed report for one case.
- Parameters:
case_name (str | None)
include_periods (bool)
include_weighted_average (bool)
- export_excel(destination, *, case_name=None, include_periods=False, include_weighted_average=False)[source]
Export one case to an Excel workbook.
- Parameters:
destination (str | Path)
case_name (str | None)
include_periods (bool)
include_weighted_average (bool)
- Return type:
Any
- set_dt_cont_multiplier(value, *, zone_name=None, case_name=None)[source]
Update one case multiplier and keep the stored case input in sync.
- Parameters:
value (float)
zone_name (str | None)
case_name (str | None)
- update_options(options, *, case_name=None, replace=False)[source]
Update one case’s options and keep the stored case input in sync.
- Parameters:
options (dict[str, Any])
case_name (str | None)
replace (bool)
- Return type:
- show_dashboard(*, case_name=None, zone=None, graph_data=None, page_title='OpenPinch Dashboard', value_rounding=2)[source]
Launch the dashboard for one case.
- Parameters:
case_name (str | None)
graph_data (dict[str, Any] | None)
page_title (str | None)
value_rounding (int)
- Return type:
None
- compare_to(other_problem, *, case_name=None, other_case_name=None, target_name=None, base_label='Base case', other_label='Scenario')[source]
Compare one workspace case to another problem or workspace case.
- Parameters:
other_problem (PinchProblem | 'PinchWorkspace')
case_name (Optional[str])
other_case_name (Optional[str])
target_name (Optional[str])
base_label (str)
other_label (str)
- Return type:
pd.DataFrame
See Tutorial Coverage Map for every workspace operation and its executable tutorial owner.