How to use the ciw.arrival_node.ArrivalNode function in Ciw

To help you get started, we’ve selected a few Ciw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CiwPython / Ciw / ciw / exactnode.py View on Github external
def get_service_time(self, clss):
        """
        Returns a service time for the given customer class
        """
        return Decimal(str(self.simulation.service_times[self.id_number][clss]._sample(self.simulation.current_time)))


    def get_now(self):
        """
        Gets the current time
        """
        return Decimal(self.simulation.current_time)


class ExactArrivalNode(ArrivalNode):
    """
    Inherits from the ArrivalNode class, implements a
    more precise version of addition to fix discrepencies
    with floating point numbers.
    """
    def increment_time(self, original, increment):
        """
        Increments the original time by the increment
        """
        return Decimal(str(original)) + Decimal(str(increment))

    def inter_arrival(self, nd, clss):
        """
        Samples the inter-arrival time for next class and node.
        """
        return Decimal(str(self.simulation.inter_arrival_times[nd][clss]._sample(self.simulation.current_time)))
github CiwPython / Ciw / ciw / simulation.py View on Github external
def set_classes(self, node_class, arrival_node_class):
        """
        Sets the type of ArrivalNode and Node classes being used
        in the Simulation model (if customer classes are used.)
        """
        if arrival_node_class is not None:
            self.ArrivalNodeType = arrival_node_class
        else:
            self.ArrivalNodeType = ArrivalNode

        if node_class is not None:
            self.NodeType = node_class
        else:
            self.NodeType = Node