def __init__(self, market, identifier): AtomicDEVS.__init__(self, identifier) self.market = market self.identifier = identifier self.last_current_time = 0.0 self.time_advance = float('inf') self.last_transition = None # [internal, external] self.last_elapsed = 0.0 self.in_agent = self.addInPort("in_agent") self.in_orderbook = self.addInPort("in_orderbook") self.out_next = self.addOutPort("out_next") self.out_notify_order = self.addOutPort("out_notify_order") output_ports_map = { 'out_next': getattr(self, 'out_next'), 'out_notify_order': getattr(self, 'out_notify_order') } strategy_params = { 'identifier': identifier + '_strategy', 'output_ports_map': output_ports_map } super(JournalVersion1, self).__init__(identifier + '_strategy', JournalStrategy, strategy_params)
def __init__(self, name="Processor", t_event1=1, iterations=0): AtomicDEVS.__init__(self, name) self.t_event1 = t_event1 self.inport = self.addInPort("inport") self.outport = self.addOutPort("outport") self.state = ModelState() self.iterations = iterations
def __init__(self, name="RailwaySegment", L=5000, v_max=100): AtomicDEVS.__init__(self, name) self.train_in = self.addInPort("train_in") self.train_out = self.addOutPort("train_out") self.Q_recv = self.addInPort("Q_recv") self.Q_sack = self.addOutPort("Q_sack") self.Q_rack = self.addInPort("Q_rack") self.Q_send = self.addOutPort("Q_send") self.UPDATE = self.addInPort("UPDATE") self.elapsed = 0.0 self.state = ("neutral", "neutral") self.L = L self.v_max = v_max self.v_end = 0 # velocity of train when it reaches the end self.x_end = 0 # position of train when it reaches the end self.train = None self.timeArrival = 0 self.duration = 0 self.isLightInSight = False self.query_id = -1 self.current_time = 0.0 self.train_arrival_time = 0.0 self.transit_times = [] self.uptime = 0
def __init__(self, name, mean): AtomicDEVS.__init__(self, name) self.state = OperatorState() self.mean = mean self.in_product = self.addInPort("in_product") self.out_stats = self.addOutPort("out_stats")
def __init__(self, name = "Processor", t_event1 = 1, iterations = 0): AtomicDEVS.__init__(self, name) self.t_event1 = t_event1 self.inport = self.addInPort("inport") self.outport = self.addOutPort("outport") self.state = ModelState() self.iterations = iterations
def __init__(self, name="Generator", t_gen_event1=1.0): AtomicDEVS.__init__(self, name) self.state = ModelState() # Add an extra variable self.state.generated = 0 self.state.counter = t_gen_event1 self.t_gen_event1 = t_gen_event1 self.outport = self.addOutPort("outport") self.inport = self.addInPort("inport")
def __init__(self, name = "Generator", t_gen_event1 = 1.0): AtomicDEVS.__init__(self, name) self.state = ModelState() # Add an extra variable self.state.generated = 0 self.state.counter = t_gen_event1 self.t_gen_event1 = t_gen_event1 self.outport = self.addOutPort("outport") self.inport = self.addInPort("inport")
def __init__(self, name="PollQueue"): AtomicDEVS.__init__(self, name) self.state = "neutral" self.train_in = self.addInPort("train_in") self.train_out = self.addOutPort("train_out") self.Q_rack = self.addInPort("Q_rack") self.Q_send = self.addOutPort("Q_send") self.train = None self.queue = []
def __init__(self, name, mean, standardDeviation, seed=1): AtomicDEVS.__init__(self, name) self.state = OperatorState() self.mean = mean self.standardDeviation = standardDeviation np.random.seed(seed) self.seed = np.random.randint(100000000) self.in_product = self.addInPort("in_product") self.out_stats = self.addOutPort("out_stats")
def __init__(self, gen_param, size_param, gen_num): AtomicDEVS.__init__(self, "Generator") # Output port for the event self.out_event = self.addOutPort("out_event") # Define the state self.state = GeneratorState(gen_num) # Parameters defining the generator's behaviour self.gen_param = gen_param self.size_param = size_param
def __init__(self, nr, proc_param): AtomicDEVS.__init__(self, "Processor_%i" % nr) self.state = ProcessorState() self.in_proc = self.addInPort("in_proc") self.out_proc = self.addOutPort("out_proc") self.out_finished = self.addOutPort("out_finished") # Define the parameters of the model self.speed = proc_param self.nr = nr
def __init__(self, name="Collector"): AtomicDEVS.__init__(self, name) self.train_in = self.addInPort("train_in") self.Q_recv = self.addInPort("Q_recv") self.Q_sack = self.addOutPort("Q_sack") self.UPDATE = self.addInPort("UPDATE") self.elapsed = 0.0 self.current_time = 0.0 self.state = "neutral" self.query_id = -1 self.transit_times = []
def __init__(self, x, y, x_max, y_max): AtomicDEVS.__init__(self, "Cell(%d, %d)" % (x, y)) self.state = CellState(T_AMBIENT) # For Cell DEVS tracing self.x = x self.y = y self.inports = [self.addInPort("in_N"), self.addInPort("in_E"), self.addInPort("in_S"), self.addInPort("in_W"), self.addInPort("in_G")] self.outport = self.addOutPort("out_T") self.taMap = {PH_INACTIVE: INFINITY, PH_UNBURNED: 1.0, PH_BURNING: 1.0, PH_BURNED: INFINITY}
def __init__(self, identifier, strategy, strategy_params): AtomicDEVS.__init__(self, identifier) self.identifier = identifier self.strategy = strategy(self, **strategy_params) self.last_elapsed = 0.0 self.last_current_time = 0.0 self.time_advance = self.strategy.next_wakeup_time self.last_time_advance = None # I/O Ports self.in_order = self.addInPort('in_order') self.out_journal = self.addOutPort('out_journal')
def __init__(self, outputs): AtomicDEVS.__init__(self, "Queue") # Fix the time needed to process a single event self.processing_time = 1.0 self.state = QueueState(outputs) # Create 'outputs' output ports # 'outputs' is a structural parameter! self.out_proc = [] for i in range(outputs): self.out_proc.append(self.addOutPort("proc_%i" % i)) # Add the other ports: incoming events and finished event self.in_event = self.addInPort("in_event") self.in_finish = self.addInPort("in_finish")
def __init__(self, name, iterations, totalAtomics, modelnumber, local, remote, percentageremotes): AtomicDEVS.__init__(self, name) self.inport = self.addInPort("inport") self.percentageremotes = percentageremotes self.outports = [] self.totalAtomics = totalAtomics self.modelnumber = modelnumber for i in xrange(totalAtomics): self.outports.append(self.addOutPort("outport_" + str(i))) self.state = PHOLDModelState() ev = modelnumber self.state.event = [[ev, getProcTime(ev)]] self.iterations = iterations self.local = local self.remote = remote
def __init__(self, identifier, strategy, strategy_params): AtomicDEVS.__init__(self, identifier) self.identifier = identifier self.strategy = strategy(self, **strategy_params) self.last_elapsed = 0.0 self.last_current_time = 0.0 self.time_advance = self.strategy.next_wakeup_time self.last_time_advance = None # I/O Ports self.in_notify_order = self.addInPort("in_notify_order") self.in_next = self.addInPort("in_next") self.out_order = self.addOutPort("out_order") self.output_ports = {'out_order'}
def __init__(self, identifier, strategy, strategy_params, input_ports, contract_port_map): AtomicDEVS.__init__(self, identifier) self.identifier = identifier self.strategy = strategy(self, **strategy_params) self.last_elapsed = 0.0 self.last_current_time = 0.0 self.time_advance = self.strategy.next_wakeup_time self.last_time_advance = None # I/O Ports self.contract_port_map = contract_port_map for port_name in input_ports: setattr(self, port_name, self.addInPort(port_name)) for contract, port_name in contract_port_map.items(): setattr(self, port_name, self.addOutPort(port_name))
def __init__(self, identifier, contract, delay_order, delay_notification): AtomicDEVS.__init__(self, identifier) self.identifier = identifier self.contract = contract self.tick_size = None self.last_current_time = 0.0 self.time_advance = float('inf') self.last_transition = None # [internal, external] self.last_elapsed = 0.0 self.in_order = self.addInPort('in_order') self.out_journal = self.addOutPort('out_journal') output_ports_map = {'out_journal': self.out_journal} self.strategy = OrderbookStrategy(self, identifier, contract, delay_order, delay_notification, output_ports_map)
def __init__(self, name="Generator", IAT_min=60, IAT_max=120, a_min=0.2, a_max=0.7, schedule=[], start="Start", end="End"): AtomicDEVS.__init__(self, name) self.train_out = self.addOutPort("train_out") self.UPDATE = self.addInPort("UPDATE") self.elapsed = 0.0 self.state = "Generator" self.schedule = schedule self.start = start self.end = end self.IAT_min = IAT_min self.IAT_max = IAT_max self.a_min = a_min self.a_max = a_max self.trains_generated = 0 random.seed(123)
def __init__(self, x, y, x_max, y_max): AtomicDEVS.__init__(self, "Cell(%d, %d)" % (x, y)) self.state = CellState(T_AMBIENT) # For Cell DEVS tracing self.x = x self.y = y self.inports = [ self.addInPort("in_N"), self.addInPort("in_E"), self.addInPort("in_S"), self.addInPort("in_W"), self.addInPort("in_G") ] self.outport = self.addOutPort("out_T") self.taMap = { PH_INACTIVE: INFINITY, PH_UNBURNED: 1.0, PH_BURNING: 1.0, PH_BURNED: INFINITY }
def __init__(self): AtomicDEVS.__init__(self, "Generator") # Keep a counter of how many events were sent self.outport = self.addOutPort("outport") self.state = 0
def __init__(self, seed): AtomicDEVS.__init__(self, "RandomProcessor_" + str(seed)) self.inport = self.addInPort("inport") self.outport = self.addOutPort("outport") self.state = RandomProcessorState(seed)
def __init__(self, levels): AtomicDEVS.__init__(self, "Generator") self.outports = [] for i in range(levels): self.outports.append(self.addOutPort("out_" + str(i))) self.state = GeneratorState()
def __init__(self): AtomicDEVS.__init__(self, "PO2") self.inport = self.addInPort("inport") self.outport1 = self.addOutPort("outport1") self.outport2 = self.addOutPort("outport2") self.state = None
def __init__(self, name=None): AtomicDEVS.__init__(self, name) self.state = MachineState() self.inport = self.addInPort("input") self.outport = self.addOutPort("output")
def __init__(self): AtomicDEVS.__init__(self, "Queue") self.state = None self.processing_time = 1.0 self.inport = self.addInPort("input") self.outport = self.addOutPort("output")
def __init__(self): AtomicDEVS.__init__(self, "Gen") self.outport = self.addOutPort("outport") self.state = True
def __init__(self, name): AtomicDEVS.__init__(self, "Processor_%s" % name) self.state = None self.inport = self.addInPort("inport") self.outport = self.addOutPort("outport")
def __init__(self): AtomicDEVS.__init__(self, "Generator") self.state = True self.outport = self.addOutPort("outport")
def __init__(self): AtomicDEVS.__init__(self, "Generator") self.state = "gen_event1" self.send_event1 = self.addOutPort("out_event1")
def __init__(self): AtomicDEVS.__init__(self, "example")
def __init__(self): AtomicDEVS.__init__(self, "ElapsedNothing") self.elapsed = 0.3 self.state = 1
def __init__(self, name, seed): AtomicDEVS.__init__(self, name) self.recv_event1 = self.addInPort("in_event1") self.send_event1 = self.addOutPort("out_event1") self.state = ProcessorState(seed)
def __init__(self): AtomicDEVS.__init__(self, "Generator") self.state = None self.outport = self.addOutPort("outport")
def __init__(self, name, time): AtomicDEVS.__init__(self, name) self.time = time self.object_out = self.addOutPort(name="object_out")
def __init__(self, count): AtomicDEVS.__init__(self, "Consumer_%i" % count) self.inport = self.addInPort("inport")