Beispiel #1
0
def get_model():
    model = Model()
    source = Holder(model, "source")
    sink = Holder(model, "sink")
    espaceMachine = Holder(model, "espaceMachine")

    obsSource = PushObserver(model,
                             "obsSource",
                             "source-ready",
                             observe_type=False,
                             holder=source)
    obsMachine = PushObserver(model,
                              "obsMachine",
                              "machine-ready",
                              holder=espaceMachine)
    obsSink = PushObserver(model, "obsSink", "sink-ready", holder=sink)

    c = CreateAct(model, "create", source)
    sp = SpaceAct(model, "transporter")
    sp.add_program('load', 2, {'source': source, 'destination': espaceMachine})
    sp.add_program('unload', 2, {'source': espaceMachine, 'destination': sink})
    machine = ShapeAct(model, "machine", espaceMachine)
    machine.add_program('p1', 4)
    machine.add_program('p2', 5)
    machine.add_program('p3', 6)
    m = SetupMatrix(machine.properties, 1)
    m.add('p1', 'p3', 2)
    m.add('p3', 'p1', 3)
    machine.properties['setup'] = m
    model.register_control(ControlCreate)
    model.register_control(ControlMachine)
    return model
Beispiel #2
0
def get_model():
    model = Model()
    
    submodel = Model(model = model, name = "cell", path = 'cell.emu')
    source = Holder(submodel, "source")
    sink = Holder(submodel, "sink")
    espaceMachine = Holder(submodel, "espaceMachine")
    PushObserver(submodel, "obsSource", "source-ready", observe_type = False, holder = source)
    PushObserver(submodel, "obsMachine", "machine-ready", holder = espaceMachine)
    sp = SpaceAct(submodel, "transporter")
    sp.add_program('load', 2, {'source':source, 'destination':espaceMachine})
    sp.add_program('unload', 2, {'source':espaceMachine, 'destination':sink})
    machine = ShapeAct(submodel, "machine", espaceMachine)
    machine.add_program('p1', 4)
    machine.add_program('p2', 5)
    machine.add_program('p3', 6)
    m = SetupMatrix(machine.properties, 1)
    m.add('p1','p3',2)
    m.add('p3','p1',3)
    machine['setup'] = m
    submodel.register_control(ControlCell)
    
    source = model.get_module("cell.source")
    CreateAct(model, "create", source)
    sink = model.get_module("cell.sink")
    DisposeAct(model, "dispose", sink)
    PushObserver(model, "obsSink", "sink-ready", holder = sink)
    model.register_control(ControlCreate)
    model.register_control(ControlDispose)
    return model
Beispiel #3
0
def create_submodel(parent, name, delay):
    model = Model(model=parent, name=name, path='cell.gseme')
    source = Holder(model, "source")
    sink = Holder(model, "sink")
    espaceMachine = Holder(model, "espaceMachine")
    PushObserver(model,
                 "obsSource",
                 "source-ready",
                 observe_type=False,
                 holder=source)
    PushObserver(model, "obsMachine", "machine-ready", holder=espaceMachine)
    sp = SpaceAct(model, "transporter")
    sp.add_program('load', 2, {'source': source, 'destination': espaceMachine})
    sp.add_program('unload', 2, {'source': espaceMachine, 'destination': sink})
    machine = ShapeAct(model, "machine", espaceMachine)
    model.inputs['p_table'] = ("machine", 'program_table')
    model.apply_inputs()
    #machine.properties['program_table'] = "model['p_table']"
    #machine.properties.set_auto_eval('program_table')
    m = SetupMatrix(machine.properties, 1)
    m.add('p1', 'p3', 2)
    m.add('p3', 'p1', 3)
    machine['setup'] = m
    initialize_control_submodel(model)

    def set_delay(value):
        machine['program_table']['p2']

    return model
Beispiel #4
0
 def test_AddValues(self):
     instance = SetupMatrix(Registry(self.p, self.model.rng), 3)
     instance.add('p1', 'p2', 1)
     self.compare(instance, 'p1', 'p2', 1)
     instance.add('p1', 'p3', 2)
     self.compare(instance, 'p1', 'p3', 2)
     self.compare(instance, 'p0', 'p0', 0)
     self.compare(instance, 'p0', 'p1', 3)
     instance.add('p2', 'p3', 4)
     self.compare(instance, 'p2', 'p3', 4)
     self.compare(instance, 'p1', 'p2', 1)
     self.compare(instance, 'p1', 'p3', 2)
     instance.add('p3', 'p1', 5)
     self.compare(instance, 'p3', 'p1', 5)
Beispiel #5
0
def create_submodel(parent, name, delay):
    model = Model(model=parent, name=name, path='cell.gseme')
    source = Holder(model, "source")
    sink = Holder(model, "sink")
    espaceMachine = Holder(model, "espaceMachine")
    PushObserver(model,
                 "obsSource",
                 "source-ready",
                 observe_type=False,
                 holder=source)
    PushObserver(model, "obsMachine", "machine-ready", holder=espaceMachine)
    sp = SpaceAct(model, "transporter")
    sp.add_program('load', 2, {'source': source, 'destination': espaceMachine})
    sp.add_program('unload', 2, {'source': espaceMachine, 'destination': sink})
    machine = ShapeAct(model, "machine", espaceMachine)
    machine.add_program('p1', 4)
    machine.add_program('p2', 5)
    machine.add_program('p3', 6)
    m = SetupMatrix(machine.properties, 1)
    m.add('p1', 'p3', 2)
    m.add('p3', 'p1', 3)
    machine['setup'] = m
    model.register_control(ControlCell)
    model.properties['delay'] = delay
Beispiel #6
0
 def test_ModValue(self):
     instance = SetupMatrix(Registry(self.p, self.model.rng), 3)
     instance.add('p3', 'p1', 5)
     instance.modify('p3', 'p1', new_final = 'p12')
     self.compare(instance, 'p3', 'p12', 5)
     instance.add('p2', 'p3', 4)
     instance.modify('p2', 'p3', new_initial = 'p12')
     self.compare(instance, 'p12', 'p3', 4)
     instance.add('p1', 'p2', 1)
     instance.modify('p1', 'p2', new_time = 2)
     self.compare(instance, 'p1', 'p2', 2)