aspen_pysys.model

Package containing all Pythonic functionality for HYSYS material streams, energy streams, and unit operations.

 1# Copyright 2026 Hariidaran Tamilmaran
 2
 3"""Package containing all Pythonic functionality for HYSYS material streams, energy streams, and unit operations."""  # noqa: E501
 4
 5from __future__ import annotations
 6
 7from aspen_pysys.model import factory, process_stream, unit_operation
 8from aspen_pysys.model.model import HysysModel
 9from aspen_pysys.model.model_type import HysysModelType
10
11HysysModel._set_mod_factory(factory.HysysModManager)  # noqa: RUF067
12
13__all__ = [
14    "HysysModel",
15    "HysysModelType",
16    "factory",
17    "process_stream",
18    "unit_operation",
19]
class HysysModel(aspen_pysys.base.named_object.HysysNamedObject):
17class HysysModel(HysysNamedObject):
18    """Class that represents a model (material stream, energy stream and unit operation) from the HYSYS app."""  # noqa: E501
19
20    FACTORY: type[HysysModFactory]
21
22    @staticmethod
23    def _set_mod_factory(factory_type: type[HysysModFactory]) -> None:
24        HysysModel.FACTORY = factory_type
25
26    def __init__(
27        self,
28        connection: HysysCase,
29        obj: HysysNamedObjReadable,
30        model_type: HysysModelType | None,
31    ) -> None:
32        """Create a Pythonic representation of a model from the HYSYS app.
33
34        Args:
35            connection (HysysCase): Simulation case
36            obj (HysysNamedObjReadable): Raw HYSYS object
37            model_type (HysysModelType): Type of model
38
39        """
40        super().__init__(connection, obj)
41        self._model_type = model_type
42
43    def get_model_type(self) -> HysysModelType | None:
44        return self._model_type

Class that represents a model (material stream, energy stream and unit operation) from the HYSYS app.

HysysModel( connection: aspen_pysys.case.hysys_case.HysysCase, obj: HysysNamedObjReadable, model_type: HysysModelType | None)
26    def __init__(
27        self,
28        connection: HysysCase,
29        obj: HysysNamedObjReadable,
30        model_type: HysysModelType | None,
31    ) -> None:
32        """Create a Pythonic representation of a model from the HYSYS app.
33
34        Args:
35            connection (HysysCase): Simulation case
36            obj (HysysNamedObjReadable): Raw HYSYS object
37            model_type (HysysModelType): Type of model
38
39        """
40        super().__init__(connection, obj)
41        self._model_type = model_type

Create a Pythonic representation of a model from the HYSYS app.

Arguments:
  • connection (HysysCase): Simulation case
  • obj (HysysNamedObjReadable): Raw HYSYS object
  • model_type (HysysModelType): Type of model
def get_model_type(self) -> HysysModelType | None:
43    def get_model_type(self) -> HysysModelType | None:
44        return self._model_type
@unique
class HysysModelType(enum.StrEnum):
 8@unique
 9class HysysModelType(StrEnum):
10    """Class that indicates the type of named object referenced from the HYSYS app."""
11
12    @override
13    def __repr__(self) -> str:
14        return self.__str__()
15
16    @classmethod
17    def all(cls) -> tuple[Self, ...]:
18        """Get all the members of the named object type.
19
20        Returns:
21            tuple[Self, ...]: Tuple of enum members
22        """
23        return tuple(cls.__members__.values())

Class that indicates the type of named object referenced from the HYSYS app.

@classmethod
def all(cls) -> tuple[typing.Self, ...]:
16    @classmethod
17    def all(cls) -> tuple[Self, ...]:
18        """Get all the members of the named object type.
19
20        Returns:
21            tuple[Self, ...]: Tuple of enum members
22        """
23        return tuple(cls.__members__.values())

Get all the members of the named object type.

Returns:

tuple[Self, ...]: Tuple of enum members