コード例 #1
0
    def start_modelling(self, pg0_m, pg1_m, pg0_d, pg1_d, ev0_m, ev0_d, cid0_m,
                        cid1_m, cid2_m, cid3_m, cid0_d, cid1_d, cid2_d, cid3_d,
                        pcd0_m, pcd0_d, cc0_m, cc0_d, c_count):
        random = nr.RandomState()
        passenger_generator0 = RequestGenerator(
            UniformGenerator(pg0_m, pg0_d, random), 'passenger0')
        passenger_generator1 = RequestGenerator(
            UniformGenerator(pg1_m, pg1_d, random), 'passenger1')
        passengers = (passenger_generator0, passenger_generator1)

        entrance_validator0 = RequestProcessor(
            UniformGenerator(ev0_m, ev0_d, random), 'entrance0')

        entrance = (entrance_validator0, )

        checkin_desk0 = RequestProcessor(
            UniformGenerator(cid0_m, cid0_d, random), 'checkin0')
        checkin_desk1 = RequestProcessor(
            UniformGenerator(cid1_m, cid1_d, random), 'checkin1')
        checkin_desk2 = RequestProcessor(
            UniformGenerator(cid2_m, cid2_d, random), 'checkin2')
        checkin_desk3 = RequestProcessor(
            UniformGenerator(cid3_m, cid3_d, random), 'checkin3')
        checkin = (checkin_desk0, checkin_desk1, checkin_desk2, checkin_desk3)

        passport_control_desk0 = RequestProcessor(UniformGenerator(
            pcd0_m, pcd0_d, random),
                                                  'passport0',
                                                  can_drop=True)

        passport_control = (passport_control_desk0, )

        customs_control0 = RequestProcessor(UniformGenerator(
            cc0_m, cc0_d, random),
                                            'customs0',
                                            can_drop=True)
        customs_control = (customs_control0, )

        plane = RequestProcessor(ConstGenerator(0), 'plane', is_exit=True)
        for p in passengers:
            p.add_receivers(entrance)
        for e in entrance:
            e.add_receivers(checkin)
        for c in checkin:
            c.add_receivers(passport_control)
        for p in passport_control:
            p.add_receivers(customs_control)
        for cc in customs_control:
            cc.add_receiver(plane)
        devices = passengers + entrance + checkin + customs_control + passport_control + (
            plane, )
        event_based_modelling(devices,
                              lambda: plane.processed_requests == c_count)
        return devices
コード例 #2
0
    def start_modelling(self, pg0_m, pg1_m, pg0_d, pg1_d, ev0_m, ev1_m, ev2_m,
                        ev0_d, ev1_d, ev2_d, cid0_m, cid1_m, cid2_m, cid3_m,
                        cid0_d, cid1_d, cid2_d, cid3_d, pcd0_m, pcd1_m, pcd0_d,
                        pcd1_d, cc0_m, cc0_d, c_count):
        random = nr.RandomState()
        passenger_generator0 = RequestGenerator(
            UniformGenerator(pg0_m, pg0_d, random), 'отправитель1')
        passenger_generator1 = RequestGenerator(
            UniformGenerator(pg1_m, pg1_d, random), 'отправитель2')
        passengers = (passenger_generator0, passenger_generator1)

        entrance_validator0 = RequestProcessor(
            UniformGenerator(ev0_m, ev0_d, random), 'касса1')
        entrance_validator1 = RequestProcessor(
            UniformGenerator(ev1_m, ev1_d, random), 'касса2')
        entrance_validator2 = RequestProcessor(
            UniformGenerator(ev2_m, ev2_d, random), 'касса3')
        entrance = (entrance_validator0, entrance_validator1,
                    entrance_validator2)

        checkin_desk0 = RequestProcessor(
            UniformGenerator(cid0_m, cid0_d, random), 'лента1')
        checkin_desk1 = RequestProcessor(
            UniformGenerator(cid1_m, cid1_d, random), 'лента2')
        checkin_desk2 = RequestProcessor(
            UniformGenerator(cid2_m, cid2_d, random), 'лента3')
        checkin_desk3 = RequestProcessor(
            UniformGenerator(cid3_m, cid3_d, random), 'лента4')
        checkin = (checkin_desk0, checkin_desk1, checkin_desk2, checkin_desk3)

        passport_control_desk0 = RequestProcessor(UniformGenerator(
            pcd0_m, pcd0_d, random),
                                                  'контроль1',
                                                  can_drop=True)
        passport_control_desk1 = RequestProcessor(UniformGenerator(
            pcd1_m, pcd1_d, random),
                                                  'контроль2',
                                                  can_drop=True)
        passport_control = (passport_control_desk0, passport_control_desk1)

        customs_control = (RequestProcessor(UniformGenerator(
            cc0_m, cc0_d, random),
                                            '',
                                            can_drop=True), )

        plane = RequestProcessor(ConstGenerator(0), 'таможня', is_exit=True)

        for p in passengers:
            p.add_receivers(entrance)
        for e in entrance:
            e.add_receivers(checkin)
        for c in checkin:
            c.add_receivers(passport_control)
        for p in passport_control:
            p.add_receivers(customs_control)
        for cc in customs_control:
            cc.add_receiver(plane)

        devices = passengers + entrance + checkin + passport_control + customs_control + (
            plane, )
        event_based_modelling(devices,
                              lambda: plane.processed_requests == c_count)
        return devices
コード例 #3
0
    def start_modelling(self, pg0_m, pg1_m, pg0_d, pg1_d, ev0_m, ev1_m, ev2_m,
                        ev0_d, ev1_d, ev2_d, cid0_m, cid1_m, cid2_m, cid3_m,
                        cid0_d, cid1_d, cid2_d, cid3_d, pcd0_m, pcd1_m, pcd0_d,
                        pcd1_d, cc0_m, cc0_d, c_count):
        random = nr.RandomState()
        client_generator0 = RequestGenerator(
            UniformGenerator(pg0_m, pg0_d, random), 'client0')
        client_generator1 = RequestGenerator(
            UniformGenerator(pg1_m, pg1_d, random), 'client1')
        clients = (client_generator0, client_generator1)

        check_exist0 = RequestProcessor(UniformGenerator(ev0_m, ev0_d, random),
                                        'check0')
        check_exist1 = RequestProcessor(UniformGenerator(ev1_m, ev1_d, random),
                                        'check1')
        check_exist2 = RequestProcessor(UniformGenerator(ev2_m, ev2_d, random),
                                        'check2')
        check_records = (check_exist0, check_exist1, check_exist2)

        master_working0 = RequestProcessor(
            UniformGenerator(cid0_m, cid0_d, random), 'master0')
        master_working1 = RequestProcessor(
            UniformGenerator(cid1_m, cid1_d, random), 'master1')
        master_working2 = RequestProcessor(
            UniformGenerator(cid2_m, cid2_d, random), 'master2')
        master_working3 = RequestProcessor(
            UniformGenerator(cid3_m, cid3_d, random), 'master3')
        work = (master_working0, master_working1, master_working2,
                master_working3)

        payment_for_services0 = RequestProcessor(UniformGenerator(
            pcd0_m, pcd0_d, random),
                                                 'cashbox0',
                                                 can_drop=True)
        payment_for_services1 = RequestProcessor(UniformGenerator(
            pcd1_m, pcd1_d, random),
                                                 'cashbox1',
                                                 can_drop=True)
        cashbox = (payment_for_services0, payment_for_services1)

        commenting0 = RequestProcessor(UniformGenerator(cc0_m, cc0_d, random),
                                       'comment0',
                                       can_drop=True)
        do_comment = (commenting0, )

        leave = RequestProcessor(ConstGenerator(0), 'leave', is_exit=True)

        for p in clients:
            p.add_receivers(check_records)
        for e in check_records:
            e.add_receivers(work)
        for c in work:
            c.add_receivers(cashbox)
        for p in cashbox:
            p.add_receivers(do_comment)
        for cc in do_comment:
            cc.add_receiver(leave)

        devices = clients + check_records + work + cashbox + do_comment + (
            leave, )
        event_based_modelling(devices,
                              lambda: leave.processed_requests == c_count)
        return devices