Coverage for backend/ahuora-compounds/ahuora_property_packages/helmholtz/helmholtz_builder.py: 30%

14 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2026-05-13 02:47 +0000

1from typing import List 

2from idaes.models.properties.general_helmholtz import ( 

3 registered_components, 

4 PhaseType, 

5 StateVars, 

6 AmountBasis 

7) 

8from .helmholtz_extended import HelmholtzExtendedParameterBlock 

9from .parameters import register_compounds 

10 

11# Add the "parameters" directory to the path so that the Helmholtz EOS can find the parameter files. 

12register_compounds() 

13 

14 

15def build_helmholtz_package(compound_list: List[str]): 

16 # TODO: Support additional args, based on what additional parameters can be passed (e.g phaseType etc) 

17 if(len(compound_list) == 0): 

18 raise ValueError("No compounds provided") 

19 elif(len(compound_list) > 1): 

20 raise ValueError("Helmholtz EOS only supports single component systems") 

21 else: 

22 component = compound_list[0] 

23 if component in registered_components(): 

24 # Build and return a helmholtz property package for this compound 

25 return HelmholtzExtendedParameterBlock(pure_component=component, 

26 phase_presentation=PhaseType.LG, 

27 state_vars=StateVars.PH, 

28 amount_basis=AmountBasis.MOLE) 

29 else: 

30 raise ValueError(f"Compound {component} not found in Helmholtz registered components")