tespy.models package¶
tespy.models.template module¶
- class tespy.models.template.ModelTemplate[source]¶
Bases:
object- optimize(algorithm, termination, variables: dict, constraints: dict = None, objective: list = None, minimize_flags: list = None, kpi: list = None) DataFrame[source]¶
- plot_Ts_diagram_matplotlib(connection_label, ax=None, save_dir=None, figsize=None, xlim=None, ylim=None)[source]¶
- plot_logph_diagram_matplotlib(connection_label, ax=None, save_dir=None, figsize=None, xlim=None, ylim=None)[source]¶
- run_exergy_analysis(Tamb, pamb, E_F, E_P, E_L=None)[source]¶
Run an exergy analysis via exerpy and cache the result.
- Parameters:
Tamb (float) – Ambient temperature in °C.
pamb (float) – Ambient pressure in bar.
E_F (dict) – Fuel exergy definition, e.g.
{'inputs': [...], 'outputs': [...]}.E_P (dict) – Product exergy definition.
E_L (dict, optional) – Loss exergy definition.
- Returns:
exerpy.ExergyAnalysis
- sensitivity_analysis(param_dict=None, result_param_list=None, mode='design', postproc_func=None) DataFrame[source]¶
- Parameters:
param_dict (dict) – A dictionary of parameter names and lists of values to be used in the sensitivity analysis. All lists must have the same length, which determines the number of simulations to be run.
result_param_list (list, optional) – Names of model parameters (from
_parameter_lookup()) to record after each simulation step.mode (str, optional) –
'design'or'offdesign'. Default is'design'.postproc_func (callable, optional) – A function
postproc_func(model) -> dict | Nonecalled after each successful solve. Use it to run any postprocessing - e.g. an exergy analysis, custom KPI calculation, or result export. The returned dict (if any) is merged into the result row as additional columns alongsideresult_param_list. If the function returnsNoneno extra columns are added.Example - running an exergy analysis after each offdesign solve:
def run_exergy(model): model.run_exergy_analysis(Tamb, pamb, E_F, E_P) hp.sensitivity_analysis( param_dict={"T_geo": [8, 9, 10, 11]}, result_param_list=["epsilon"], mode="offdesign", postproc_func=run_exergy, )
- Returns:
pandas.core.frame.DataFrame – DataFrame with input parameter columns and result columns.