Coverage for backend/ahuora-builder/src/ahuora_builder/custom/custom_variable.py: 79%

19 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2026-06-23 21:51 +0000

1from idaes.models.control.controller import PIDControllerData, ControllerType, ControllerMVBoundType, ControllerAntiwindupType, smooth_bound, smooth_heaviside 

2from pyomo.environ import Var 

3from idaes.core import UnitModelBlockData, declare_process_block_class 

4from pyomo.common.config import ConfigValue, In, Bool 

5import pyomo.environ as pyo 

6from idaes.core.util.exceptions import ConfigurationError 

7import pyomo.dae as pyodae 

8from idaes.core.util import scaling as iscale 

9import functools 

10from idaes.core.util.tables import create_stream_table_dataframe 

11 

12@declare_process_block_class( 

13 "CustomVariable", 

14 doc="Custom variable model block. You can finally be free!", 

15) 

16class CustomVariableData(UnitModelBlockData): 

17 

18 CONFIG = UnitModelBlockData.CONFIG() 

19 

20 def build(self): 

21 """ 

22 Build the custom variable block 

23 """ 

24 super().build() 

25 self.variable = Var( 

26 self.flowsheet().time, 

27 initialize=0.0, 

28 doc="A variable you are free to do whatever you want with", 

29 ) 

30 

31 

32 def _get_stream_table_contents(self, time_point=0): 

33 io_dict = {} # no inlets or outlets 

34 return create_stream_table_dataframe(io_dict, time_point=time_point) 

35