How to use the ciw.node.Node 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
from .node import Node
from .arrival_node import ArrivalNode
from decimal import Decimal, getcontext
from .server import Server

class ExactNode(Node):
    """
    Inherits from the Node class, implements a more
    precise version of addition to fix discrepencies
    with floating point numbers.
    """
    def create_starting_servers(self):
        """
        Initialise the servers
        """
        return [Server(self, i + 1, Decimal('0.0')) for i in range(self.c)]

    def increment_time(self, original, increment):
        """
        Increments the original time by the increment
        """
        return Decimal(str(original)) + Decimal(str(increment))
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