antupy.Plant#
- class antupy.Plant(out: SimulationOutput = <factory>, constraints: list[tuple[str, ...]]=<factory>)[source]#
Plant base class with component management.
Features: - Automatic component recreation on parameter changes - Dependency tracking between parameters and components - Efficient caching with hash-based invalidation - Dynamic parameter introspection
- Usage:
- class MyPlant(Plant):
# Define parameters as usual param1: Var = Var(10.0, “m”) param2: Var = Var(5.0, “kg”)
@property def my_component(self) -> SomeComponentClass:
- return component(SomeComponentClass(
param1=constraint(self.param1), param2=constraint(self.param2)
))
@property def complex_component(self) -> AnotherComponentClass:
- return component(AnotherComponentClass(
param1=constraint(self.param1), computed_param=derived(self._compute_something, self.param1)
))
- Parameters:
out (SimulationOutput)
- __init__(out: SimulationOutput = <factory>, constraints: list[tuple[str, ...]]=<factory>) None#
- Parameters:
out (SimulationOutput)
- Return type:
None
Methods
__init__(out, constraints, ...]] =)get_component_cache_stats()Get statistics about component cache usage.
run_simulation([verbose])Run simulation method (preserved for Protocol compatibility).
Attributes
outconstraints