Skip to content

Commit 4c21f08

Browse files
committed
Merge branch 'improve-process-builder' of https://github.com/equinor/neqsim-python into improve-process-builder
2 parents 315ddbd + 0397b0d commit 4c21f08

1 file changed

Lines changed: 24 additions & 11 deletions

File tree

src/neqsim/process/processTools.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ def adjuster(
461461

462462
def ejector(self, name: str, motive_stream: Any, suction_stream: Any) -> Any:
463463
"""Create an ejector and add to this process."""
464-
ej = jneqsim.process.equipment.ejector.Ejector(name, motive_stream, suction_stream)
464+
ej = jneqsim.process.equipment.ejector.Ejector(
465+
name, motive_stream, suction_stream
466+
)
465467
return self.add(ej)
466468

467469
def flare(self, name: str, inlet_stream: Any = None) -> Any:
@@ -1284,7 +1286,7 @@ def setup_recycle_loop(
12841286
ProcessBuilder()
12851287
.add_stream("feed", fluid, flow_rate=100, flow_unit="kg/hr")
12861288
# Set up the recycle initial guess
1287-
.setup_recycle_loop("my_recycle", "recycle_guess", "feed",
1289+
.setup_recycle_loop("my_recycle", "recycle_guess", "feed",
12881290
initial_flow=10.0, initial_flow_unit="kg/hr")
12891291
# Mix feed with recycle
12901292
.add_mixer("mixer", inlets=["feed", "recycle_guess.out"])
@@ -1345,15 +1347,22 @@ def close_recycle_loop(
13451347
"""
13461348
# Get the virtual stream from setup if outlet not specified
13471349
if outlet is None:
1348-
if hasattr(self, "_pending_recycles") and recycle_name in self._pending_recycles:
1350+
if (
1351+
hasattr(self, "_pending_recycles")
1352+
and recycle_name in self._pending_recycles
1353+
):
13491354
vs_name = self._pending_recycles[recycle_name]
13501355
outlet = f"{vs_name}.out"
13511356
else:
13521357
raise ValueError(
13531358
f"No outlet specified and no setup_recycle_loop found for '{recycle_name}'"
13541359
)
13551360
return self.add_recycle(
1356-
recycle_name, inlet=inlet, outlet=outlet, tolerance=tolerance, priority=priority
1361+
recycle_name,
1362+
inlet=inlet,
1363+
outlet=outlet,
1364+
tolerance=tolerance,
1365+
priority=priority,
13571366
)
13581367

13591368
def add_distillation_column(
@@ -1594,7 +1603,9 @@ def add_ejector(
15941603
"""
15951604
motive_stream = self._get_outlet(motive_inlet)
15961605
suction_stream = self._get_outlet(suction_inlet)
1597-
ej = jneqsim.process.equipment.ejector.Ejector(name, motive_stream, suction_stream)
1606+
ej = jneqsim.process.equipment.ejector.Ejector(
1607+
name, motive_stream, suction_stream
1608+
)
15981609
self.equipment[name] = ej
15991610
self.process.add(ej)
16001611
return self
@@ -1670,7 +1681,7 @@ def add_virtual_stream(
16701681
ProcessBuilder()
16711682
.add_stream("feed", fluid, flow_rate=100, flow_unit="kg/hr")
16721683
# Virtual stream as recycle guess (small flow to start)
1673-
.add_virtual_stream("recycle_guess", source="feed",
1684+
.add_virtual_stream("recycle_guess", source="feed",
16741685
flow_rate=5.0, flow_unit="kg/hr")
16751686
# Mix feed with recycle
16761687
.add_mixer("mixer", inlets=["feed", "recycle_guess.out"])
@@ -1970,7 +1981,11 @@ def add_compressor_with_chart(
19701981
comp.setUseEnergyEfficiencyChart(use_energy_efficiency_chart)
19711982

19721983
# Set surge curve if provided
1973-
if surge_flow is not None and surge_head is not None and chart_conditions is not None:
1984+
if (
1985+
surge_flow is not None
1986+
and surge_head is not None
1987+
and chart_conditions is not None
1988+
):
19741989
comp.getCompressorChart().getSurgeCurve().setCurve(
19751990
chart_conditions, surge_flow, surge_head
19761991
)
@@ -2409,7 +2424,7 @@ def add_pid_controller(
24092424
kp: Proportional gain (default 1.0).
24102425
ti: Integral time constant (default 100.0).
24112426
td: Derivative time constant (default 0.0).
2412-
reverse_acting: If True, controller output decreases when
2427+
reverse_acting: If True, controller output decreases when
24132428
process variable increases (default False).
24142429
24152430
Returns:
@@ -3709,9 +3724,7 @@ def get_inlets(self, equipment_name: str) -> List[str]:
37093724

37103725
return inlets if inlets else ["inlet"]
37113726

3712-
def validate_connection(
3713-
self, source: str, target_equipment: str
3714-
) -> Dict[str, Any]:
3727+
def validate_connection(self, source: str, target_equipment: str) -> Dict[str, Any]:
37153728
"""
37163729
Validate if a connection between equipment is valid.
37173730

0 commit comments

Comments
 (0)