:py:mod:`ethos_penalps.stream`
==============================

.. py:module:: ethos_penalps.stream


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   ethos_penalps.stream.BaseStreamState
   ethos_penalps.stream.StreamStaticData
   ethos_penalps.stream.StreamEnergyData
   ethos_penalps.stream.BatchStreamStaticData
   ethos_penalps.stream.BatchStreamState
   ethos_penalps.stream.BatchStreamProductionPlanEntry
   ethos_penalps.stream.BatchStream
   ethos_penalps.stream.ContinuousStreamState
   ethos_penalps.stream.ContinuousStreamStaticData
   ethos_penalps.stream.ContinuousStreamProductionPlanEntry
   ethos_penalps.stream.ContinuousStream
   ethos_penalps.stream.ProcessStepProductionPlanEntryWithInputStreamState
   ethos_penalps.stream.StreamDataFrameMetaInformation




.. py:class:: BaseStreamState


   Bases: :py:obj:`dataclasses_json.DataClassJsonMixin`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: name
      :type: str

      

   .. py:attribute:: start_time
      :type: datetime.datetime

      

   .. py:attribute:: end_time
      :type: datetime.datetime

      

   .. py:attribute:: date_time_range
      :type: datetimerange.DateTimeRange

      


.. py:class:: StreamStaticData


   Bases: :py:obj:`dataclasses_json.DataClassJsonMixin`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: start_process_step_name
      :type: str

      

   .. py:attribute:: end_process_step_name
      :type: str

      

   .. py:attribute:: commodity
      :type: ethos_penalps.data_classes.Commodity

      

   .. py:attribute:: mass_unit
      :type: str

      

   .. py:attribute:: name_to_display
      :type: str | None

      


.. py:class:: StreamEnergyData


   Bases: :py:obj:`dataclasses_json.DataClassJsonMixin`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: stream_name
      :type: str

      

   .. py:attribute:: load_dict
      :type: dict[str, ethos_penalps.data_classes.LoadType]

      

   .. py:attribute:: dict_stream_load_energy_data
      :type: dict[str, ethos_penalps.data_classes.StreamLoadEnergyData]

      

   .. py:method:: add_stream_load_energy_data(stream_load_energy_data: ethos_penalps.data_classes.StreamLoadEnergyData)



.. py:class:: BatchStreamStaticData


   Bases: :py:obj:`StreamStaticData`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: delay
      :type: datetime.timedelta

      

   .. py:attribute:: minimum_batch_mass_value
      :type: numbers.Number

      

   .. py:attribute:: maximum_batch_mass_value
      :type: numbers.Number

      

   .. py:attribute:: stream_type
      :type: str
      :value: 'BatchStream'

      


.. py:class:: BatchStreamState


   Bases: :py:obj:`BaseStreamState`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: batch_mass_value
      :type: numbers.Number

      


.. py:class:: BatchStreamProductionPlanEntry


   Bases: :py:obj:`dataclasses_json.DataClassJsonMixin`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: name
      :type: str

      

   .. py:attribute:: commodity
      :type: str

      

   .. py:attribute:: start_time
      :type: datetime.datetime

      

   .. py:attribute:: end_time
      :type: datetime.datetime

      

   .. py:attribute:: duration
      :type: datetime.timedelta

      

   .. py:attribute:: delay
      :type: datetime.timedelta

      

   .. py:attribute:: batch_mass_value
      :type: numbers.Number

      

   .. py:attribute:: batch_mass_unit
      :type: str

      

   .. py:attribute:: minimum_batch_mass_value
      :type: numbers.Number

      

   .. py:attribute:: maximum_batch_mass_value
      :type: numbers.Number

      

   .. py:attribute:: stream_type
      :type: str

      

   .. py:attribute:: name_to_display
      :type: str | None

      


.. py:class:: BatchStream


   Bases: :py:obj:`dataclasses_json.DataClassJsonMixin`

   Batch streams represent streams which are instantaneously loaded and unloaded.
   The mass reaches the destination in a discrete event opposed to continuous delivery in a continuous stream

   .. py:attribute:: static_data
      :type: BatchStreamStaticData

      

   .. py:attribute:: stream_type
      :value: 'BatchStream'

      

   .. py:method:: __post_init__()


   .. py:method:: create_stream_energy_data(specific_energy_demand: numbers.Number, load_type: ethos_penalps.data_classes.LoadType, mass_unit: str = Units.mass_unit.__str__(), energy_unit: str = Units.energy_unit.__str__())


   .. py:method:: create_production_plan_entry(state: BatchStreamState) -> BatchStreamProductionPlanEntry


   .. py:method:: get_produced_amount(state: BatchStreamState) -> numbers.Number


   .. py:method:: get_time_frame_overlap_share(stream_state: BatchStreamState, is_input_stream: bool, target_date_range: datetimerange.DateTimeRange) -> datetimerange.DateTimeRange


   .. py:method:: get_mass_share_in_time_period(stream_state: BatchStreamState, is_input_stream: bool, target_date_range: datetimerange.DateTimeRange) -> numbers.Number


   .. py:method:: create_batch_state(end_time: datetime.datetime, batch_mass_value: numbers.Number) -> BatchStreamState


   .. py:method:: consider_maximum_batch_mass(target_batch_mass: numbers.Number) -> numbers.Number

      Check if the desired maximum batch mass can be returned.
      Returns desired mass if its within boundaries. If desired mass
      is bigger than maximum, the maximum value is returned.

      :param target_batch_mass: _description_
      :type target_batch_mass: float
      :raises Exception: _description_
      :return: _description_
      :rtype: float


   .. py:method:: get_upstream_node_name() -> str


   .. py:method:: get_downstream_node_name() -> str


   .. py:method:: get_produced_mass_between_end_and_start_date(target_start_date: datetime.datetime, target_end_date: datetime.datetime, state: BatchStreamState) -> numbers.Number


   .. py:method:: json_dumps_state(stream_state: BatchStreamState, path_to_save_folder: str = '')


   .. py:method:: json_load_state(path_to_file: str = '')



.. py:class:: ContinuousStreamState


   Bases: :py:obj:`BaseStreamState`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: total_mass
      :type: numbers.Number

      

   .. py:attribute:: current_operation_rate
      :type: numbers.Number

      


.. py:class:: ContinuousStreamStaticData


   Bases: :py:obj:`StreamStaticData`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: minimum_operation_rate
      :type: numbers.Number

      

   .. py:attribute:: maximum_operation_rate
      :type: numbers.Number

      

   .. py:attribute:: time_unit
      :type: datetime.timedelta

      

   .. py:attribute:: stream_type
      :type: str
      :value: 'ContinuousStream'

      


.. py:class:: ContinuousStreamProductionPlanEntry


   Bases: :py:obj:`dataclasses_json.DataClassJsonMixin`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: name
      :type: str

      

   .. py:attribute:: start_time
      :type: datetime.datetime

      

   .. py:attribute:: end_time
      :type: datetime.datetime

      

   .. py:attribute:: duration
      :type: datetime.timedelta

      

   .. py:attribute:: commodity
      :type: str

      

   .. py:attribute:: current_operation_rate_value
      :type: numbers.Number

      

   .. py:attribute:: current_operation_rate_unit
      :type: str

      

   .. py:attribute:: mass_unit
      :type: str

      

   .. py:attribute:: minimum_operation_rate
      :type: numbers.Number

      

   .. py:attribute:: maximum_operation_rate
      :type: numbers.Number

      

   .. py:attribute:: total_mass
      :type: numbers.Number

      

   .. py:attribute:: stream_type
      :type: str

      

   .. py:attribute:: name_to_display
      :type: str

      


.. py:class:: ContinuousStream


   Bases: :py:obj:`dataclasses_json.DataClassJsonMixin`

   Continuous streams provide mass in continuously while they are active.

   .. py:attribute:: static_data
      :type: ContinuousStreamStaticData

      

   .. py:attribute:: stream_type
      :value: 'ContinuousStream'

      

   .. py:method:: __post_init__()


   .. py:method:: create_stream_energy_data(specific_energy_demand: numbers.Number, load_type: ethos_penalps.data_classes.LoadType, mass_unit: str = Units.mass_unit.__str__(), energy_unit: str = Units.energy_unit.__str__())


   .. py:method:: create_stream_state_for_commodity_amount(commodity_amount: numbers.Number, end_time: datetime.datetime, operation_rate: numbers.Number = float('inf')) -> ContinuousStreamState


   .. py:method:: get_time_frame_overlap_share(numerator_date_range: datetimerange.DateTimeRange, denominator_date_range: datetimerange.DateTimeRange) -> numbers.Number


   .. py:method:: get_mass_share_in_time_period(numerator_date_range: datetimerange.DateTimeRange, stream_state: ContinuousStreamState) -> numbers.Number


   .. py:method:: create_production_plan_entry(state: ContinuousStreamState) -> ContinuousStreamProductionPlanEntry


   .. py:method:: get_produced_amount(state: ContinuousStreamState) -> numbers.Number


   .. py:method:: check_if_operation_rate_is_within_boundaries(operation_rate_to_check: numbers.Number) -> bool


   .. py:method:: determine_start_time(end_time: datetime.datetime, operation_rate: numbers.Number, total_transported_mass: numbers.Number) -> datetime.datetime


   .. py:method:: determine_stream_state_mass(end_time: datetime.datetime, start_time: datetime.datetime, current_operation_rate: numbers.Number | None) -> numbers.Number


   .. py:method:: create_continuous_stream_state(end_time: datetime.datetime, start_time: datetime.datetime, current_operation_rate: numbers.Number | None) -> ContinuousStreamState


   .. py:method:: get_upstream_node_name() -> str


   .. py:method:: get_downstream_node_name() -> str


   .. py:method:: get_produced_mass_between_end_and_start_date(target_start_date: datetime.datetime, target_end_date: datetime.datetime, state: ContinuousStreamState) -> numbers.Number


   .. py:method:: json_dumps_state(stream_state: ContinuousStreamState, path_to_save_folder: str = '')


   .. py:method:: json_load_state(path_to_file: str = '')



.. py:class:: ProcessStepProductionPlanEntryWithInputStreamState


   Bases: :py:obj:`ethos_penalps.data_classes.ProcessStepProductionPlanEntry`

   .. py:attribute:: stream_start_time
      :type: datetime.datetime

      

   .. py:attribute:: stream_end_time
      :type: datetime.datetime

      

   .. py:attribute:: total_stream_mass
      :type: numbers.Number

      


.. py:class:: StreamDataFrameMetaInformation


   Bases: :py:obj:`dataclasses_json.DataClassJsonMixin`

   DataClassJsonMixin is an ABC that functions as a Mixin.

   As with other ABCs, it should not be instantiated directly.

   .. py:attribute:: data_frame
      :type: pandas.DataFrame

      

   .. py:attribute:: stream_name
      :type: str

      

   .. py:attribute:: first_start_time
      :type: datetime.datetime

      

   .. py:attribute:: last_end_time
      :type: datetime.datetime

      

   .. py:attribute:: stream_type
      :type: str

      

   .. py:attribute:: mass_unit
      :type: str

      

   .. py:attribute:: commodity
      :type: ethos_penalps.data_classes.Commodity

      

   .. py:attribute:: name_to_display
      :type: str

      


