コード例 #1
0
ファイル: generator.py プロジェクト: jirikuncar/eelap
 def create_system_from_xml(input_file):
     """
     Reads system configuration from param:`xml_system`
     and returns cls:`System` instances.
     """
     from lxml import objectify
     root = objectify.fromstring(input_file.read())
     for s in root.iterfind('system'):
         system = System(**dict(s.items()))
         for c in s.iterfind('component'):
             component = Component(**dict(c.items()))
             for t in c.iterfind('task'):
                 task = Task(**dict(t.items()))
                 component.addTask(task)
             system.addComponent(component)
             if args.path:
                 system.path = args.path
         yield system
         if args.communication_server:
             yield add_server(
                 system,
                 component_period=args.communication_server_period,
                 component_priority=args.communication_server_priority,
                 component_budget=args.communication_server_budget,
                 tasks=tasks)
コード例 #2
0
ファイル: generator.py プロジェクト: jirikuncar/eelap
    def generate_systems():
        for s in range(args.systems):
            for i in range(1000):
                system = rand_system(**vars(args))
                ## assign system data path
                if args.path:
                    system.path = args.path
                ## add communication server to copy of the system
                if args.communication_server:
                    copy_system = add_server(
                        system,
                        component_period=args.communication_server_period,
                        component_priority=args.communication_server_priority,
                        component_budget=args.communication_server_budget,
                        tasks=tasks)

                ## check system and its copy if communication server is added
                if check_system(system) and (not args.communication_server or
                                             check_system(copy_system)):
                    yield system
                    if args.communication_server:
                        yield copy_system
                    break

                if args.verbose:
                    print i, ' ...'