Пример #1
0
def get_model(a, b):
    model = emu.Model()
    h1 = emu.Holder(model, "h1")
    h2 = emu.Holder(model, "h2")
    obs1 = emu.PushObserver(model, "observer1", "ev1", holder=h1)
    obs2 = emu.PushObserver(model, "observer2", "ev2", holder=h2)
    c = emu.CreateAct(model, "create1", h1)
    sp = emu.SpaceAct(model, "space1")
    sp['setup'].default_time = 1
    sp.add_program('p1', "rng.expovariate(" + str(b) + ")", {
        'source': h1,
        'destination': h2
    })
    model.register_control(ControlCreate, 'run', (model, a))
    model.register_control(ControlSpace)
    return model
Пример #2
0
def get_model():
    model = emu.Model()
    h = emu.Holder(model, "holder1")
    obs1 = emu.PushObserver(model, "observer1", "ev1", observe_type = False, holder = h)
    c = emu.CreateAct(model, "create1", h)
    d = emu.DisposeAct(model, "dispose1", h)
    model.register_control(ControlCreate)
    model.register_control(ControlDispose)
    return model
Пример #3
0
def get_model():
    model = emu.Model()
    h = emu.Holder(model, "holder1")
    obs1 = emu.PushObserver(model, "observer1", "ev1", observe_type = False, holder = h)
    c = emu.CreateAct(model, "create1", h)
    #control processes
    model.register_control(ControlCreate)
    model.register_control(ReportMonitor)
    return model
Пример #4
0
def get_model(stepping = False):
    model = emu.Model()
    h = emu.Holder(model, "holder1")
    h['capacity'] = 5
    h['speed'] = 2
    obs1 = emu.PushObserver(model, "observer1", "ev1", observe_type = False, holder = h)
    obs2 = emu.PullObserver(model, "observer2", "position", holder = h)
    c = emu.CreateAct(model, "create1", h)
    d = emu.DisposeAct(model, "dispose1", h)
    model.register_control(ControlDispose)
    model.register_control(ControlCreate)
    model.register_control(ObsMonitor)
    return model
Пример #5
0
def get_model():
    model = emulation.Model()
    source1 = emulation.Holder(model, "source1")
    obs_source1 = emulation.PushObserver(model, "obs_source1", holder=source1)
    source2 = emulation.Holder(model, "source2")
    obs_source2 = emulation.PushObserver(model, "obs_source2", holder=source2)
    create1 = emulation.CreateAct(model, "create1", destination=source1)
    create2 = emulation.CreateAct(model, "create2", destination=source2)
    assy_space = emulation.Holder(model, "assy_space")
    obs_assy = emulation.PushObserver(model, "obs_assy", holder=assy_space)
    assy = emulation.AssembleAct(model, "assy", assy_holder=assy_space)
    trans = emulation.SpaceAct(model, "trans")
    sink = emulation.Holder(model, "sink")
    obs_sink = emulation.PushObserver(model, "obs_sink", holder=sink)
    trans.add_program('load', 2, {
        'source': source1,
        'destination': assy_space
    })
    trans.add_program('unload', 1, {'source': assy_space, 'destination': sink})
    assy.add_program('p', 5, {'source': source2})
    model.register_control(ControlCreate)
    model.register_control(ControlAssy)
    return model
Пример #6
0
def get_model():
    model = emu.Model()
    h = emu.Holder(model, "holder1")
    c = emu.CreateAct(model, "create1", h)
    model.register_control(ControlCreate)
    return model
Пример #7
0
 def setUp(self):
     import test_sim14 as sim
     self.model = sim.get_model()
     self.h = emu.Holder(emu.Model(), "h", speed=0)
Пример #8
0
def create_model():
    model = emulation.Model()
    #holders
    for i in range(1,13):
        st[i] = emulation.Holder(model, "st"+str(i))
    for i in cells:
        inBuf[i] = emulation.Holder(model, "in"+str(i))
        outBuf[i] = emulation.Holder(model, "out"+str(i))
        workBuf[i] = emulation.Holder(model, "work"+str(i))
    #actuators
    create = emulation.CreateAct(model, "create",inBuf['Sf'])
    for i in cells:
        machine[i] = emulation.ShapeAct(model, "machine"+str(i), workBuf[i])
        if i in ['Fa', 'Fb', 'Fc']:
            dispose[i] = emulation.DisposeAct(model, "dispose"+i, outBuf[i])
            machine[i]['setup'].default_time = 0
        else:
            machine[i]['setup'].default_time = 30
        load[i] = emulation.SpaceAct(model, "load"+str(i))
    transSt = emulation.SpaceAct(model, "transSt")
    transSt['setup'].default_time = 0
    #actuator's programs
    for i in cells:
        load[i].add_program('load', 0, {'source':inBuf[i], 'destination':workBuf[i]})
        load[i].add_program('unload', 0, {'source':workBuf[i], 'destination':outBuf[i]})
    for m in cells:
        if m in ['Sf']:
            process_time = sf_process_time
        else:
            process_time = f_process_time
        i = 1 
        for t in process_time:
            machine[m].add_program('p'+str(i), ("rng.normalvariate(%s, 0.5)" % t))
            i += 1
    for i in range(1,13):
        transSt.add_program('load_st'+str(i), 0, {'source':outBuf['Sf'],'destination':st[i]})
        for j in ['a', 'b', 'c']:
            transSt.add_program('unload_st'+str(i)+'to'+j, 0, {'source':st[i],'destination':inBuf['F'+j]})
    #observers
    for i in cells:
        emulation.PushObserver(model, "obs_work"+i, "work"+i+"_ready", observe_type = True, holder = workBuf[i])
        emulation.PushObserver(model, "obs_in"+i, "in"+i+"_ready", identify = True, holder = inBuf[i])
        emulation.PushObserver(model, "obs_out"+i, "out"+i+"_ready", identify = True, holder = outBuf[i])
    for i in range(1,13):
        emulation.PushObserver(model, "obs_st"+str(i),"st"+str(i)+"_ready", identify = True, holder = st[i])
    #failures (with degradation)
    fail1 = emulation.Failure(model, "fail1", 
                              'rng.expovariate({0})'.format(1./500.),
                              'rng.expovariate({0})'.format(1./30.), 
                              [machine['Fa']])
    fail1.properties['degradation'] = 0.9
    fail1.properties['repeat'] = True
    
    fail2 = emulation.Failure(model, "fail2", 
                              'rng.expovariate({0})'.format(1./400.),
                              'rng.expovariate({0})'.format(1./30.), 
                              [machine['Fb']])
    fail2.properties['degradation'] = 0.8
    fail2.properties['repeat'] = True
    
    fail3 = emulation.Failure(model, "fail3", 
                              'rng.expovariate({0})'.format(1./300.),
                              'rng.normalvariate({0}, {1})'.format(30., 5.), 
                              [machine['Fc']])
    fail3.properties['degradation'] = 0.9
    fail3.properties['repeat'] = True
    
    
    return model