pycanha_core.parameters — Core Parameters Classes#
These are the C++ base classes for the parameter and formula system.
Parameters#
- class pycanha_core.parameters.Parameters(*args, **kwargs)#
Bases:
objectNamed parameter store for parametric studies.
Stores values of type bool, int, float, str, or numpy array, keyed by string name. Used with Formulas to propagate parameter changes to the thermal network.
- property data#
Dictionary of all parameter name-value pairs.
Entities#
- class pycanha_core.parameters.EntityType(*values)#
Bases:
EnumType of thermal entity in the network.
- T = 0#
- C = 1#
- QS = 2#
- QA = 3#
- QE = 4#
- QI = 5#
- QR = 6#
- GL = 7#
- GR = 8#
- class pycanha_core.parameters.Entity#
Bases:
objectReference to a value in the thermal network.
An Entity points to a specific node attribute (T, C, QI, etc.) or coupling value (GL, GR) in a ThermalNetwork. Use the static factory methods (Entity.make, Entity.t, Entity.gl, etc.) or Entity.from_string to create instances.
- __init__(*args, **kwargs)#
- albedo_heat = <nanobind.nb_func object>#
- c = <nanobind.nb_func object>#
- capacity = <nanobind.nb_func object>#
- conductive = <nanobind.nb_func object>#
- earth_ir = <nanobind.nb_func object>#
- from_internal_symbol = <nanobind.nb_func object>#
- from_string = <nanobind.nb_func object>#
- gl = <nanobind.nb_func object>#
- gr = <nanobind.nb_func object>#
- internal_heat = <nanobind.nb_func object>#
- is_same_as(self, other: pycanha_core.pycanha_core.parameters.Entity) bool#
Check if this entity references the same value as another.
- make = <nanobind.nb_func object>#
- property node_1#
First node number.
- property node_2#
Second node number (-1 for single-node entities).
- property node_count#
Number of nodes this entity type references (0, 1, or 2).
- other_heat = <nanobind.nb_func object>#
- qa = <nanobind.nb_func object>#
- qe = <nanobind.nb_func object>#
- qi = <nanobind.nb_func object>#
- qr = <nanobind.nb_func object>#
- qs = <nanobind.nb_func object>#
- radiative = <nanobind.nb_func object>#
- solar_heat = <nanobind.nb_func object>#
- t = <nanobind.nb_func object>#
- temperature = <nanobind.nb_func object>#
- property token#
Entity type token string (e.g. ‘T’, ‘GL’).
- property type#
Entity type (EntityType enum value).
- property writable#
Whether the entity’s value can be set.
Formulas#
- class pycanha_core.parameters.Formula#
Bases:
objectAbstract base class for formulas that bind parameter values to thermal entities.
- __init__(*args, **kwargs)#
- calculate_derivatives(self) None#
Calculate derivative values with respect to parameter dependencies.
- clone(self) pycanha_core.pycanha_core.parameters.Formula#
Create an independent copy of this formula.
- property entity#
Reference to the target Entity.
- property parameter_dependencies#
List of parameter names this formula depends on.
- class pycanha_core.parameters.ParameterFormula(*args, **kwargs)#
Bases:
FormulaFormula that copies a named parameter value to an entity.
When applied, sets entity value = parameter value.
- __init__(self, entity: pycanha_core.pycanha_core.parameters.Entity, parameters: pycanha_core.pycanha_core.parameters.Parameters, parameter: str) None#
Create a formula linking entity to a named parameter.
- calculate_derivatives(self) None#
Calculate derivative values with respect to parameter dependencies.
- clone(self) pycanha_core.pycanha_core.parameters.Formula#
Create an independent copy of this formula.
- property entity#
Reference to the target Entity.
- property parameter_dependencies#
List of parameter names this formula depends on.
- class pycanha_core.parameters.ExpressionFormula(*args, **kwargs)#
Bases:
FormulaFormula that evaluates a scalar expression of named parameters and/or entity values.
- __init__(self, entity: pycanha_core.pycanha_core.parameters.Entity, parameters: pycanha_core.pycanha_core.parameters.Parameters, expression: str) None#
- __init__(self, entity: pycanha_core.pycanha_core.parameters.Entity, parameters: pycanha_core.pycanha_core.parameters.Parameters, expression: str, network: pycanha_core.pycanha_core.tmm.ThermalNetwork) None
Overloaded function.
__init__(self, entity: pycanha_core.pycanha_core.parameters.Entity, parameters: pycanha_core.pycanha_core.parameters.Parameters, expression: str) -> None
Create an expression formula for the given entity.
__init__(self, entity: pycanha_core.pycanha_core.parameters.Entity, parameters: pycanha_core.pycanha_core.parameters.Parameters, expression: str, network: pycanha_core.pycanha_core.tmm.ThermalNetwork) -> None
Create an expression formula with entity references via network.
- apply_compiled_formula(self) None#
Evaluate the compiled expression and write the result to the entity.
- calculate_derivatives(self) None#
Calculate derivative values with respect to parameter dependencies.
- clone(self) pycanha_core.pycanha_core.parameters.Formula#
Create an independent copy of this formula.
- property entity#
Reference to the target Entity.
- property expression#
Original expression string.
- property parameter_dependencies#
List of parameter names this formula depends on.
- class pycanha_core.parameters.ValueFormula(*args, **kwargs)#
Bases:
FormulaFormula that assigns a fixed constant value to an entity.
- __init__(self, entity: pycanha_core.pycanha_core.parameters.Entity) None#
Create a value formula for the given entity.
- calculate_derivatives(self) None#
Calculate derivative values with respect to parameter dependencies.
- clone(self) pycanha_core.pycanha_core.parameters.Formula#
Create an independent copy of this formula.
- property entity#
Reference to the target Entity.
- property parameter_dependencies#
List of parameter names this formula depends on.
- class pycanha_core.parameters.Formulas(*args, **kwargs)#
Bases:
objectCollection of formulas linking parameters to thermal entities. Call apply_formulas() to propagate parameter changes to the network.
- __init__(self) None#
- __init__(self, network: pycanha_core.pycanha_core.tmm.ThermalNetwork, parameters: pycanha_core.pycanha_core.parameters.Parameters) None
Overloaded function.
__init__(self) -> None
Create an empty Formulas collection.
__init__(self, network: pycanha_core.pycanha_core.tmm.ThermalNetwork, parameters: pycanha_core.pycanha_core.parameters.Parameters) -> None
Create a Formulas collection with associated network and parameters.
- add_formula(self, formula: pycanha_core.pycanha_core.parameters.Formula) None#
- add_formula(self, formula: pycanha_core.pycanha_core.parameters.Formula) None
Overloaded function.
add_formula(self, formula: pycanha_core.pycanha_core.parameters.Formula) -> None
Add a formula (by copy) to the collection.
add_formula(self, formula: pycanha_core.pycanha_core.parameters.Formula) -> None
Add a formula (by shared pointer) to the collection.
- apply_compiled_formulas(self) None#
Apply using pre-compiled pointers (faster, requires compile_formulas()).
- associate(self, network: pycanha_core.pycanha_core.tmm.ThermalNetwork, parameters: pycanha_core.pycanha_core.parameters.Parameters) None#
Associate this collection with a network and parameters store.
- create_formula(self, entity: pycanha_core.pycanha_core.parameters.Entity, formula_string: str) pycanha_core.pycanha_core.parameters.Formula#
Create a formula by auto-detecting its type from the string.
Returns a shared pointer to the created Formula.
- create_parameter_formula(self, entity: pycanha_core.pycanha_core.parameters.Entity, parameter: str) pycanha_core.pycanha_core.parameters.ParameterFormula#
Create and add a ParameterFormula for the entity and parameter name.
- property debug_formulas#
Enable debug logging of formula application.
- property formulas#
List of all stored Formula objects.
- lock_parameters_for_execution(self) None#
Lock parameters to prevent structural changes during solve.
- property parameter_dependencies#
Dict mapping parameter names to lists of dependent formulas.