def __init__(self,**args): defaults={'net':Network(), 'L':[], 'net_updt_time':0.001, 'sim':None, 'show_sg':False, 'disp_inf':False, 'save':[]} ## initialize attributes for key, value in defaults.items(): if args.has_key(key): setattr(self, key, args[key]) else: setattr(self, key, value) args[key]=value self.args=args Process.__init__(self,name='PNetwork',sim=self.sim) self.cpt=self.sim.now() self.filename='pos' if 'mysql' in self.save: config = ConfigParser.ConfigParser() config.read(pyu.getlong('simulnet.ini','ini')) sql_opt = dict(config.items('Mysql')) self.net.db = Database(sql_opt['host'],sql_opt['user'],sql_opt['passwd'],sql_opt['dbname'])
def __init__(self, model, proc_info): Process.__init__(self, name=proc_info.name, sim=model) self._model = model self._internal_id = Processor._identifier Processor._identifier += 1 self.identifier = proc_info.identifier # EDIT currently running time partition self._time_part = False self._running_inst = None self._evts_inst = deque([]) self._sched_part = None self._running = None self.was_running = None self._evts = deque([]) self.sched = model.scheduler self.monitor = Monitor(name="Monitor" + proc_info.name, sim=model) self._caches = [] self._penalty = proc_info.penalty self._cs_overhead = proc_info.cs_overhead self._cl_overhead = proc_info.cl_overhead self._migration_overhead = proc_info.migration_overhead self.set_caches(proc_info.caches) self.timer_monitor = Monitor(name="Monitor Timer" + proc_info.name, sim=model) self._speed = proc_info.speed
def __init__(self, sim, task_info): """ Args: - `sim`: :class:`Model <simso.core.Model>` instance. - `task_info`: A :class:`TaskInfo` representing the Task. :type sim: Model :type task_info: TaskInfo """ Process.__init__(self, name=task_info.name, sim=sim) self.name = task_info.name self._task_info = task_info self._monitor = Monitor(name="Monitor" + self.name + "_states", sim=sim) self._activations_fifo = deque([]) self._sim = sim self.cpu = None self._etm = sim.etm self._job_count = 0 self._last_cpu = None self._cpi_alone = {} self._jobs = [] self.job = None # other tasks executed after it is preempted self._other_tasks = []
def __init__(self,**args): defaults={'sim':None, 'ID':'1', 'net':Network(), 'gcom': Gcom(), 'devt': {}, 'refreshRSS':0.3, 'refreshTOA':0.3, 'mp':False } ## initialize attributes for key, value in defaults.items(): if args.has_key(key): setattr(self, key, args[key]) else: setattr(self, key, value) args[key]=value self.args=args self.PN=self.net.node[self.ID]['PN'] self.create_evt() Process.__init__(self,name='Rx-'+str(self.ID),sim=self.sim) Cf = ConfigParser.ConfigParser() Cf.read(pyu.getlong('agent.ini','ini')) for s in Cf.sections(): try: d= dict(Cf.items(s)) if d['id']==self.ID: self.refreshRSS=eval(d['refreshrss']) self.refreshTOA=eval(d['refreshtoa']) break except: pass
def __init__(self, name, sim, task): Process.__init__(self, name=name, sim=sim) # number of the action self.q = 0 # corresonding pycpa task self.task = task # the signal used to wake up the activation event self.signal_event = SimEvent(sim=sim) # workload left to consume self.workload = task.wcet # active segments of the execution of the form: [(0,1), (3,9)] self.exec_windows = list() # last recent start of a execution segment self.recent_window_start = None # actual response time self.response_time = 0 # start time self.start_time = 0 # finishing time self.finish_time = 0
def __init__(self): Process.__init__(self) self._signals = { 'kill' : SimEvent('kill'), 'finish' : SimEvent('finish'), } self._finished = False
def __init__(self, **args): defaults = {"net": None, "L": None, "fname": "network", "fig": None, "ax": None, "sim": None} ## initialize attributes for key, value in defaults.items(): if key in args: setattr(self, key, args[key]) else: setattr(self, key, value) args[key] = value self.args = args self.fname = self.args["fname"] Process.__init__(self, name="shownet", sim=self.args["sim"]) self.fig = plt.figure(self.fname, figsize=(20, 5), dpi=100) self.fig.subplots_adjust(left=0.1, right=0.9, top=0.9, bottom=0.1) self.fig, self.ax = self.L.showGs(fig=self.fig) self.legend = True self.ion = True self.info = False self.coll_plot = {} self.C = ConfigParser.ConfigParser() self.C.read(pyu.getlong("show.ini", "ini")) self.RATcolor = dict(self.C.items("RATcolor")) self.RATes = dict(self.C.items("RATestyle")) self.update = dict(self.C.items("update")) self.option = dict(self.C.items("option")) self.cpt = self.sim.now()
def initialize(self): Process.__init__(self) CoreObject.initialize(self) self.waitToDispose=False #flag that shows if the object waits to dispose an entity self.Up=True #Boolean that shows if the object is in failure ("Down") or not ("up") self.currentEntity=None self.totalFailureTime=0 #holds the total failure time self.timeLastFailure=0 #holds the time that the last failure of the object started self.timeLastFailureEnded=0 #holds the time that the last failure of the object Ended self.downTimeProcessingCurrentEntity=0 #holds the time that the object was down while processing the current entity self.downTimeInTryingToReleaseCurrentEntity=0 #holds the time that the object was down while trying #to release the current entity self.downTimeInCurrentEntity=0 #holds the total time that the object was down while holding current entity self.timeLastEntityLeft=0 #holds the last time that an entity left the object self.processingTimeOfCurrentEntity=0 #holds the total processing time that the current entity required self.totalBlockageTime=0 #holds the total blockage time self.totalWaitingTime=0 #holds the total waiting time self.totalWorkingTime=0 #holds the total working time self.completedJobs=0 #holds the number of completed jobs self.timeLastEntityEnded=0 #holds the last time that an entity ended processing in the object self.timeLastEntityEntered=0 #holds the last time that an entity ended processing in the object self.timeLastFrameWasFull=0 #holds the time that the last frame was full, ie that assembly process started self.nameLastFrameWasFull="" #holds the name of the last frame that was full, ie that assembly process started self.nameLastEntityEntered="" #holds the name of the last frame that entered processing in the object self.nameLastEntityEnded="" #holds the name of the last frame that ended processing in the object self.Res=Resource(1) self.Res.activeQ=[] self.Res.waitQ=[]
def __init__(self, sim, task_info): """ Args: - `sim`: :class:`Model <simso.core.Model>` instance. - `task_info`: A :class:`TaskInfo` representing the Task. :type sim: Model :type task_info: TaskInfo """ Process.__init__(self, name=task_info.name, sim=sim) self.name = task_info.name self._task_info = task_info self._monitor = Monitor(name="Monitor" + self.name + "_states", sim=sim) self._activations_fifo = deque([]) self._sim = sim self.cpu = None self._etm = sim.etm self._job_count = 0 self._last_cpu = None self._cpi_alone = {} self._jobs = [] self.job = None self.last_skipped = 0 self.reclaimed_budget = 0 # EDIT added partition to which this task belongs self._part = None
def __init__(self, timer): Process.__init__(self, name="Timer", sim=timer.sim) self.function = timer.function self.args = timer.args self.delay = timer.delay self.one_shot = timer.one_shot self.cpu = timer.cpu self.running = False
def __init__(self, sender, simulation, circuit_id, flux_size, control_packet_offset): Process.__init__(self, sim=simulation) self.id = circuit_id self.sender = sender self.total_propagation_time = 0 self.circuit_expiration = self.sim.now() + CIRCUIT_EXPIRATION_SECONDS self.offset = control_packet_offset self.dropped = False
def __init__(self, actor): """ Constructor of the ActorProcess object, arguments: Actor: An instance of an Action object """ Process.__init__(self) self.actor = actor
def __init__(self, timer): Process.__init__(self, name="Timer", sim=timer.sim) self.function = timer.function self.args = timer.args self.delay = timer.delay self.one_shot = timer.one_shot self.cpu = timer.cpu self.running = False self.overhead = timer.overhead
def __init__(self, task, sim): Process.__init__(self, name=task.name, sim=sim) # link to the pycpa model self.task = task # add a list to store the execution windows in the task self.task.q_exec_windows = list() # all activations that have been emitted self.activations = list()
def __init__(self, sim, name="SPP", tasks=list()): assert sim != None Process.__init__(self, name=name, sim=sim) self.tasks = tasks self.pending = list() # list of simtasks self.simtasks = list() self.arrival_event = SimEvent('Arrival Event', sim=sim)
def __init__(self, part, name, pred, monitor, etm, sim, can_donate = False): """ Args: - `part`: The parent :class:`TimePartition <simso.core.TimePartition.TimePartition>`. - `name`: The name for this instance. - `pred`: If the partition is not periodic, pred is the partition instance that \ released this one. - `monitor`: A monitor is an object that log in time. - `etm`: The execution time model. - `sim`: :class:`Model <simso.core.Model>` instance. :type part: PartitionInstance :type name: str :type pred: bool :type monitor: Monitor :type etm: AbstractExecutionTimeModel :type sim: Model """ Process.__init__(self, name=name, sim=sim) self._part = part self._pred = pred self.instr_count = 0 # Updated by the cache model. self._computation_time = 0 self._last_exec = None self._start_date = None self._end_date = None self._is_preempted = False self._donated = False self._activation_date = self.sim.now_ms() self._absolute_deadline = self.sim.now_ms() + part.deadline self._aborted = False self._sim = sim self._monitor = monitor self._etm = etm self._was_running_on = part.cpus self.can_donate = can_donate self._extra_budget = 0 self._avail_budget = {} # Initialize WCB for this partition self._WCB = {} self._WCB_tmr = {} for cpu in part.cpus: self._WCB[cpu] = part.length self._WCB_tmr[cpu] = None self._avail_budget[cpu] = 0 # This is only required to get the execution speed. So pick # the first CPU in the list self.cpu = part.cpus[0] self._on_activate() self.context_ok = True # The context is ready to be loaded.
def __init__(self, max_wait, instance_type='m1.small', latency=0): self.terminated = False name = 'Server%d' % Server.counter.next() Process.__init__(self, name) self.max_wait = max_wait self.instance_type = instance_type self.latency = latency self.service_time_factor = 1.0 / COST_MODEL[self.instance_type][1] self.start_time = now() sys.stdout.write('+') sys.stdout.flush()
def initialize(self): Process.__init__(self) CoreObject.initialize(self) self.Res=Resource(capacity=infinity) self.Up=True #Boolean that shows if the object is in failure ("Down") or not ("up") self.currentEntity=None self.totalBlockageTime=0 #holds the total blockage time self.totalFailureTime=0 #holds the total failure time self.totalWaitingTime=0 #holds the total waiting time self.totalWorkingTime=0 #holds the total working time self.completedJobs=0 #holds the number of completed jobs self.timeLastEntityEnded=0 #holds the last time that an entity ended processing in the object self.nameLastEntityEnded="" #holds the name of the last entity that ended processing in the object self.timeLastEntityEntered=0 #holds the last time that an entity entered in the object self.nameLastEntityEntered="" #holds the name of the last entity that entered in the object self.timeLastFailure=0 #holds the time that the last failure of the object started self.timeLastFailureEnded=0 #holds the time that the last failure of the object Ended self.downTimeProcessingCurrentEntity=0 #holds the time that the object was down while processing the current entity self.downTimeInTryingToReleaseCurrentEntity=0 #holds the time that the object was down while trying #to release the current entity self.downTimeInCurrentEntity=0 #holds the total time that the object was down while holding current entity self.timeLastEntityLeft=0 #holds the last time that an entity left the object self.processingTimeOfCurrentEntity=0 #holds the total processing time that the current entity required self.waitToDispose=False #shows if the object waits to dispose an entity self.position=[] #list that shows the position of the corresponding element in the conveyer self.timeLastMoveHappened=0 #holds the last time that the move was performed (in reality it is #continued, in simulation we have to handle it as discrete) #so when a move is performed we can calculate where the entities should go self.timeToReachEnd=0 #if the conveyer has entities but none has reached the end of it, this calculates #the time when the first entity will reach the end and so it will be ready to be disposed self.timeToBecomeAvailable=0 #if the conveyer has entities on its back this holds the time that it will be again free #for an entity. of course this also depends on the length of the entity who requests it self.conveyerMover=ConveyerMover(self) #process that is triggered at the times when an entity reached the end or #a place is freed. It performs the move at this point, #so if there are actions to be carried they will self.call=False #flag that shows if the ConveyerMover should be triggered self.entityLastReachedEnd=None #the entity that last reached the end of the conveyer self.timeBlockageStarted=now() #the time that the conveyer reached the blocked state #plant considers the conveyer blocked even if it can accept just one entity #I think this is false self.wasFull=False #flag that shows if the conveyer was full. So when an entity is disposed #if this is true we count the blockage time and set it to false self.currentRequestedLength=0 #the length of the entity that last requested the conveyer self.currentAvailableLength=self.length #the available length in the end of the conveyer self.predecessorIndex=0 #holds the index of the predecessor from which the Conveyer will take an entity next self.successorIndex=0 #holds the index of the successor where the Queue Conveyer dispose an entity next
def __init__(self, sim, name="SPNP", tasks=list()): assert sim != None Process.__init__(self, name=name, sim=sim) # list of pending activations self.pending = list() # list of blocker activations (usually one lower priority activation) self.blockers = list() # list of simtasks self.simtasks = list() # signals a new activation self.arrival_event = SimEvent('Arrival Event', sim=sim)
def __init__(self, max_wait, instance_type, latency, period, breach_duration, min_size, max_size, cooldown, lower_threshold, lower_breach_scale_increment, upper_threshold, upper_breach_scale_increment): Process.__init__(self, 'Watcher') self.max_wait = max_wait self.instance_type = instance_type self.latency = latency # # aws autoscale settings # self.period = period self.breach_duration = breach_duration self.min_size = min_size self.max_size = max_size self.cooldown = cooldown self.lower_threshold = lower_threshold self.lower_breach_scale_increment = lower_breach_scale_increment self.upper_threshold = upper_threshold self.upper_breach_scale_increment = upper_breach_scale_increment
def __init__(self, sim, part_info): """ Args: - `sim`: :class:`Model <simso.core.Model>` instance. - `part_info`: A :class:`TimePartitionInfo` representing the TimePartition. :type sim: Model :type task_info: TimePartitionInfo """ Process.__init__(self, name=part_info.name, sim=sim) self.name = part_info.name self._part_info = part_info self._monitor = Monitor(name="Monitor" + self.name + "_states", sim=sim) self._activations_fifo = deque([]) self._sim = sim self.cpus = [] self._etm = sim.etm self._last_cpus = None self._inst_count = 0 self._insts = [] self.inst = None self._task_evts = {} self._sched_info = part_info.task_scheduler_info """ This structure keeps track of which job is running on each cpu of a partition """ self.running_jobs = {} # Create tasks for this partition self._tasks = [] for task_info in part_info.task_infos: task = Task(sim, task_info) task.set_time_partition(self) self._tasks.append(task) sim.task_list.append(task) # Is budget donation active for this partition? self.can_donate = False if 'can_donate' in part_info.data: self.can_donate = part_info.data['can_donate']
def __init__(self, stopwatch_seconds=60): Process.__init__(self) self.stopwatch_seconds = stopwatch_seconds tk = world().tk canvas, x_, y_ = tk.canvas, tk.x_, tk.y_ cx, cy = 27, 136 self.cx, self.cy = cx, cy canvas.create_oval(x_(cx - 5), y_(cy - 5), x_(cx + 5), y_(cy + 5), fill='white') steps = 60 if stopwatch_seconds == 60: steps = 5 for ii in range(0, stopwatch_seconds, steps): inner_radius = 4.2 if steps == 5 and ii % 15 in (5, 10): inner_radius = 4.6 radians = self.seconds_to_radians(ii) canvas.create_line(x_(cx + cos(radians) * inner_radius), y_(cy + sin(radians) * inner_radius), x_(cx + cos(radians) * 5), y_(cy + sin(radians) * 5)) self.hand = canvas.create_line(0, 0, 1, 1)
def __init__(self, task, name, pred, monitor, etm, sim, jobid, optional_part=False, override_wcet=None): """ Args: - `task`: The parent :class:`task <simso.core.Task.Task>`. - `name`: The name for this job. - `pred`: If the task is not periodic, pred is the job that \ released this one. - `monitor`: A monitor is an object that log in time. - `etm`: The execution time model. - `sim`: :class:`Model <simso.core.Model>` instance. :type task: GenericTask :type name: str :type pred: bool :type monitor: Monitor :type etm: AbstractExecutionTimeModel :type sim: Model """ Process.__init__(self, name=name, sim=sim) self._task = task self._pred = pred self.instr_count = 0 # Updated by the cache model. self._computation_time = 0 self._last_exec = None self._n_instr = task.n_instr self._start_date = None self._end_date = None self._is_preempted = False self._activation_date = self.sim.now_ms() self._absolute_deadline = self.sim.now_ms() + task.deadline self._aborted = False self._sim = sim self._monitor = monitor self._etm = etm self._was_running_on = task.cpu self.jobid = jobid self.timer_deadline = None self.optional_part = optional_part self.override_wcet = override_wcet self._on_activate() self.context_ok = True # The context is ready to be loaded.
def initialize(self, identifier, simInstance, peer=None, priority=0): """ Initializes the object. @param identifier: identifier of simulation event @type identifier: str @param peerId: peerId of simulation event @type peerId: int @param priority: priority of simulation event. @type priority: int @rtype: None @note: All simulation events are initialized as unhandled. """ Process.__init__(self, identifier,simInstance) self.__identifier = identifier self.__peer = peer self.__priority = priority self.__isIdentified = False SimulationProcessLogger().resgiterLoggingInfo("Initialize Simulation Process => %s"%self.__identifier)
def __init__(self, model, proc_info): Process.__init__(self, name=proc_info.name, sim=model) self._model = model self._internal_id = Processor._identifier Processor._identifier += 1 self.identifier = proc_info.identifier self._running = None self.was_running = None self._evts = deque([]) self.sched = model.scheduler self.monitor = Monitor(name="Monitor" + proc_info.name, sim=model) self._caches = [] self._penalty = proc_info.penalty self._cs_overhead = proc_info.cs_overhead self._cl_overhead = proc_info.cl_overhead self._migration_overhead = proc_info.migration_overhead self.set_caches(proc_info.caches) self.timer_monitor = Monitor(name="Monitor Timer" + proc_info.name, sim=model) self._speed = proc_info.speed
def __init__(self, interval, name=None, until=infinite, drift=('fixed', 0)): Process.__init__(self) self.interval = interval if name is not None: eventname = name else: eventname = "a_SimEvent" self.event = SimEvent(eventname) self.until = until try: key, mean, cfg = drift except ValueError: key, mean = drift cfg = {} lb = cfg.get('lb', 0); ub = cfg.get('ub', interval) if lb < 0: raise ValueError('drift lb = %s >= 0' %lb) if ub > interval: raise ValueError('drift ub = %s < %s = interval' %interval) cfg['lb'] = lb; cfg['ub'] = ub self.rgen = RandInterval.get(key, mean, cfg)
def __init__(self, id, name, **kw): Process.__init__(self) self.id = id self.objName = name # lists that hold the previous and next objects in the flow self.next=[] #list with the next objects in the flow self.previous=[] #list with the previous objects in the flow self.nextIds=[] #list with the ids of the next objects in the flow self.previousIds=[] #list with the ids of the previous objects in the flow self.Failure=[] self.Working=[] self.Blockage=[] self.Waiting=[] self.OffShift=[] #default attributes set so that the CoreObject has them self.isPreemptive=False self.resetOnPreemption=False self.interruptCause=None self.gatherWipStat=False
def __init__(self, task, name, pred, monitor, etm, sim, wcet=None): """ Args: - `task`: The parent :class:`task <simso.core.Task.Task>`. - `name`: The name for this job. - `pred`: If the task is not periodic, pred is the job that \ released this one. - `monitor`: A monitor is an object that log in time. - `etm`: The execution time model. - `sim`: :class:`Model <simso.core.Model>` instance. :type task: GenericTask :type name: str :type pred: bool :type monitor: Monitor :type etm: AbstractExecutionTimeModel :type sim: Model """ Process.__init__(self, name=name, sim=sim) self._task = task self._pred = pred self.instr_count = 0 # Updated by the cache model. self._computation_time = 0 self._last_exec = None self._n_instr = task.n_instr self._start_date = None self._end_date = None self._is_preempted = False self._activation_date = self.sim.now_ms() self._absolute_deadline = self.sim.now_ms() + task.deadline self._aborted = False self._sim = sim self._monitor = monitor self._etm = etm self._was_running_on = task.cpu self._wcet = wcet self._on_activate() self.context_ok = True # The context is ready to be loaded.
def __init__(self,**args): defaults={'sim':None, 'net': Network(), 'gcom': Gcom(), 'ID': 0, 'dcond':{}, 'devt': {}, 'lcst': [] } ## initialize attributes for key, value in defaults.items(): if args.has_key(key): setattr(self, key, args[key]) else: setattr(self, key, value) args[key]=value self.args=args self.PN=self.net.node[self.ID]['PN'] self.evt_create() self.c_init() Process.__init__(self,name='Tx'+str(self.ID),sim=self.sim)
def __init__(self, initstate=None, start=False, **kwargs): """Constructor. :param initstate: Initial state to `goto`. :param start: Boolean; if true, `start()` immediately. :param kwargs: Keywords passed to `Traceable` constructor. """ Traceable.__init__(self, **kwargs) Process.__init__(self, name=self.name) self.__sem = None self.__state = None self.__started = False self.__initstate = self.HALT, (), {} # patch SimPy to fix hold if not FSM._fixsimhold: self.sim._dispatch[fsmhold] = fsmholdfunc self.sim._commandcodes = self.sim._dispatch.keys() self.sim._commandwords[fsmhold] = 'fsmhold' self.sim.reactivate = lambda *args, **kwargs: _fixreactivate(self.sim, *args, **kwargs) FSM._fixsimhold = True # continue initializing FSM if initstate: self.goto(initstate) if start: self.start()
def __init__(self, **args): defaults = {"net": None, "fname": "table", "lAg": None, "fig": None, "ax": None, "sim": None} ## initialize attributes for key, value in defaults.items(): if key in args: setattr(self, key, args[key]) else: setattr(self, key, value) args[key] = value self.args = args self.fname = self.args["fname"] self.fig = plt.figure(self.fname, figsize=(30, 15), dpi=50) self.fig.subplots_adjust(left=0.1, right=0.9, top=0.9, bottom=0.1) self.ax1 = self.fig.add_subplot(111, frame_on=False) self.ax1.xaxis.set_visible(False) self.ax1.yaxis.set_visible(False) self.fig2 = plt.figure(self.fname + str(2), figsize=(30, 15), dpi=50) self.ax2 = self.fig2.add_subplot(111, frame_on=False) self.ax2.xaxis.set_visible(False) self.ax2.yaxis.set_visible(False) self.coll_plot = {} self.colLabels1 = ("RAT", "Node link", "TOA ", "TOA std", "Pr", "Pr std", "distance") self.colLabels2 = ("name", "pos x", "pos y ", "vel x", "vel y", "acc x", "acc y") self.cellText = [] self.C = ConfigParser.ConfigParser() self.C.read(pyu.getlong("show.ini", "ini")) self.RATcolor = dict(self.C.items("RATcolor")) self.RATes = dict(self.C.items("RATestyle")) self.update = dict(self.C.items("update")) Process.__init__(self, name="PShowTable", sim=self.args["sim"])
def __init__(self, name): Process.__init__(self, name)
def __init__(self, myBus): Process.__init__(self, name='Breakdown ' + myBus.name) self.bus = myBus
def __init__(self, lives=1, name='ImaTarget'): Process.__init__(self, name) self.lives = lives # provide Player objects with a "damage" property self.damage = 0
def __init__(self, epidemic, ind_id, health_status='susceptible'): Process.__init__(self) self.ind_id = ind_id self.e = epidemic self.health_status = health_status self.e.all_individuals.append(self)
def __init__(self): Process.__init__(self) self.prts = []
def __init__(self, name, cc): Process.__init__(self, name=name) self.cc = cc
def __init__(self, name): Process.__init__(self, name=name) self.doneSignal = SimEvent()
def __init__(self, conveyer): Process.__init__(self) self.conveyer=conveyer #the conveyer that owns the mover self.timeToWait=0 #the time to wait every time. This is calculated by the conveyer and corresponds
def __init__(self, i, len): Process.__init__(self, name='Message' + str(i)) self.i = i self.len = len
def __init__(self, victim=None): Process.__init__(self) self.victim=victim
def initialize(self): Process.__init__(self)
def __init__(self, simulation, burst_id, burst_size, burst_header_offset): Process.__init__(self, sim=simulation) self.id = burst_id self.burst_size = burst_size self.offset = burst_header_offset
def initialize(self): # XXX why call super.__init__ outside of __init__ ? Process.__init__(self) self.Up=True #Boolean that shows if the machine is in failure ("Down") or not ("up") self.onShift=True self.currentEntity=None # ============================== total times =============================================== self.totalBlockageTime=0 #holds the total blockage time self.totalFailureTime=0 #holds the total failure time self.totalWaitingTime=0 #holds the total waiting time self.totalWorkingTime=0 #holds the total working time self.totalOffShiftTime=0 #holds the total off-shift time self.completedJobs=0 #holds the number of completed jobs # ============================== Entity related attributes ================================= self.timeLastEntityEnded=0 #holds the last time that an entity ended processing in the object self.nameLastEntityEnded="" #holds the name of the last entity that ended processing in the object self.timeLastEntityEntered=0 #holds the last time that an entity entered in the object self.nameLastEntityEntered="" #holds the name of the last entity that entered in the object # ============================== shift related times ===================================== self.timeLastShiftStarted=0 #holds the time that the last shift of the object started self.timeLastShiftEnded=0 #holds the time that the last shift of the object ended self.offShiftTimeTryingToReleaseCurrentEntity=0 #holds the time that the object was off-shift while trying #to release the current entity # ============================== failure related times ===================================== self.timeLastFailure=0 #holds the time that the last failure of the object started self.timeLastFailureEnded=0 #holds the time that the last failure of the object ended self.downTimeProcessingCurrentEntity=0 #holds the time that the machine was down while #processing the current entity self.downTimeInTryingToReleaseCurrentEntity=0 #holds the time that the object was down while trying #to release the current entity self.downTimeInCurrentEntity=0 #holds the total time that the #object was down while holding current entity self.timeLastEntityLeft=0 #holds the last time that an entity left the object self.processingTimeOfCurrentEntity=0 #holds the total processing time that the current entity required # ============================== waiting flag ============================================== self.waitToDispose=False #shows if the object waits to dispose an entity # ============================== the below are currently used in Jobshop ======================= self.giver=None #the CoreObject that the activeObject will take an Entity from if len(self.previous)>0: self.giver=self.previous[0] self.receiver=None #the CoreObject that the activeObject will give an Entity to if len(self.next)>0: self.receiver=self.next[0] # ============================== variable that is used for the loading of machines ============= self.exitAssignedToReceiver = False # by default the objects are not blocked # when the entities have to be loaded to operatedMachines # then the giverObjects have to be blocked for the time # that the machine is being loaded # ============================== lists to hold statistics of multiple runs ===================== self.totalTimeWaitingForOperator=0 self.operatorWaitTimeCurrentEntity=0 self.totalTimeInCurrentEntity=0 self.operatorWaitTimeCurrentEntity=0 self.totalProcessingTimeInCurrentEntity=0 self.failureTimeInCurrentEntity=0 self.setupTimeCurrentEntity=0 self.shouldPreempt=False #flag that shows that the machine should preempt or not self.lastGiver=None # variable that holds the last giver of the object, used by machine in case of preemption # initialize the wipStatList - # TODO, think what to do in multiple runs # TODO, this should be also updated in Globals.setWIP (in case we have initial wip) self.wipStatList=[[0,0]]
def __init__(self): Process.__init__(self)
def __init__(self, interval, sim=None): Process.__init__(self, sim=sim) self.world = world() self.interval = interval self.display_interval = 60.0