Coverage for backend/idaes_service/solver/custom/custom_pressure_changer.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-11-06 23:27 +0000

1from idaes.models.unit_models.pressure_changer import PressureChangerData 

2from .inverted import add_inverted, initialise_inverted 

3from idaes.core import declare_process_block_class 

4 

5@declare_process_block_class("CustomPressureChanger") 

6class CustomPressureChangerData(PressureChangerData): 

7 """ 

8 Custom Pressure Changer model that includes inverted deltaP property. 

9 """ 

10 

11 def build(self, *args, **kwargs): 

12 """ 

13 Build method for the CustomPressureChangerData class. 

14 This method initializes the control volume and sets up the model. 

15 """ 

16 super().build(*args, **kwargs) 

17 

18 # add deltaP_inverted as a property 

19 add_inverted(self, "deltaP") 

20 

21 def initialize_build( 

22 self,*args,**kwargs, 

23 ): 

24 """ 

25 Initialization method for the CustomPressureChangerData class. 

26 

27 Args: 

28 state_args (dict): Arguments to be passed to the state block 

29 solver (str): Solver to use for initialization 

30 optarg (dict): Solver arguments dictionary 

31 """ 

32 initialise_inverted(self, "deltaP") 

33 

34 super().initialize_build(*args, **kwargs)