Edge

Edge represents the passive components. It used to connect two nodes and helps to move items between them. It is the base class used to model buffers, conveyors, fleets, etc in manufacturing system.

Parameters:
  • id (str) –

    unique identifier for the edge

  • src_node (Node) –

    reference to the source node connected to this edge.

  • dest_node (Node) –

    reference to the destination node connected to this edge.

Raises:
  • TypeError

    If the type of env or id is incorrect.

  • ValueError

    If the delay parameter is not a valid type (int, float, generator, or callable).

  • ValueError

    If the edge is already connected to a source or destination node and reconnect is False.

  • ValueError

    If the source or destination nodes are not valid Node instances.

get_delay(delay)

Returns value based on the type of parameter delay provided.

Parameters:
  • delay (int, float, generator, or callable) –

    The delay time, which can be:

    • int or float: Used as a constant delay.
    • generator: A generator instance yielding delay values.
    • callable: A function that returns a delay values.
Returns:
  • Returns a constant delay if delay is an int or float, a value yielded if delay is a generator, or the value returned from a Callable function if delay is callable.

update_state(new_state, current_time)

Update node state and track the time spent in the previous state.

Parameters:
  • new_state (str) –

    The new state to transition to. Must be one of "SETUP_STATE", "GENERATING_STATE", "BLOCKED_STATE".

  • current_time (float) –

    The current simulation time.

connect(src, dest, reconnect=False)

Connects this edge to a source node and a destination node.

This method checks that both src and dest are valid Node objects and that the edge is not already connected, unless reconnect is set to True. It also registers this edge in the out_edges of the source node and the in_edges of the destination node.

Parameters:
  • src (Node) –

    The source node to connect.

  • dest (Node) –

    The destination node to connect.

  • reconnect (bool, default: False ) –

    If True, allows reconnection even if the edge is already connected. Defaults to False.

Raises:
  • ValueError

    If the edge is already connected and reconnect is False.

  • ValueError

    If src or dest is not a valid Node instance.