@@ -57,7 +57,7 @@ class RecirculationLoop(ProcessSystem):
5757 def __init__ (
5858 self ,
5959 process_system_id : ProcessSystemId ,
60- inner_process : ProcessSystem ,
60+ inner_process : ProcessSystem | ProcessUnit ,
6161 fluid_service : FluidService ,
6262 recirculation_rate : float = 0 ,
6363 ):
@@ -77,20 +77,36 @@ def __init__(
7777 )
7878
7979 def _validate_inner_process (self ):
80- assert isinstance (self ._inner_process , ProcessSystem ), "Recirculation loop should contain a ProcessSystem"
81- for process_unit in self ._inner_process .get_process_units ():
82- if isinstance (process_unit , Mixer | Splitter ):
83- raise DomainValidationException ("Recirculation loop cannot contain splitters or mixers" )
80+ if not isinstance (self ._inner_process , ProcessSystem | ProcessUnit ):
81+ raise DomainValidationException (
82+ "Recirculation loop should contain a ProcessSystem with a compressor or a single compressor"
83+ )
84+ if isinstance (self ._inner_process , ProcessSystem ):
85+ for process_unit in self ._inner_process .get_process_units ():
86+ if isinstance (process_unit , Splitter | Mixer ):
87+ raise DomainValidationException ("Recirculation loop cannot contain splitters or mixers" )
88+ if isinstance (self ._inner_process , ProcessUnit ):
89+ if not isinstance (self ._inner_process , Compressor ):
90+ raise DomainValidationException (
91+ "Recirculation loop should contain a ProcessSystem with a compressor or a single compressor"
92+ )
8493
8594 def get_id (self ) -> ProcessSystemId :
8695 return self ._id
8796
8897 def get_process_units (self ) -> Sequence [ProcessUnit | ProcessSystem ]:
89- return [
90- self ._mixer ,
91- * self ._inner_process .get_process_units (),
92- self ._splitter ,
93- ]
98+ if isinstance (self ._inner_process , ProcessSystem ):
99+ return [
100+ self ._mixer ,
101+ * self ._inner_process .get_process_units (),
102+ self ._splitter ,
103+ ]
104+ else :
105+ return [
106+ self ._mixer ,
107+ self ._inner_process ,
108+ self ._splitter ,
109+ ]
94110
95111 def set_recirculation_rate (self , rate : float ):
96112 self ._mixer .set_mix_rate (rate )
0 commit comments