def __init__(self, rootname, name_scenario='myscenario',
                 description='', parent=None,
                 workdirpath=None, **kwargs):

        self._init_objman(ident='scenario', parent=parent,
                          name='Scenario', info='Main scenario instance.',
                          version=0.2,
                          **kwargs)

        attrsman = self.set_attrsman(cm.Attrsman(self))

        if workdirpath is not None:
            # create a directory if path is given, but does not exist
            if not os.path.isdir(workdirpath):
                os.mkdir(workdirpath)
        else:
            workdirpath = os.getcwd()
            #workdirpath = os.path.expanduser("~")

        self.name_scenario = attrsman.add(cm.AttrConf('name_scenario', name_scenario,
                                                      groupnames=['options'],
                                                      perm='rw',
                                                      name='Name',
                                                      info='Scenario name, used for documentation purposes only.',
                                                      ))

        self.description = attrsman.add(cm.AttrConf('description', description,
                                                    groupnames=['options'],
                                                    perm='rw',
                                                    name='Description',
                                                    info='Short, free description of Scenario.',
                                                    ))

        self.rootname = attrsman.add(cm.AttrConf('rootname', rootname,
                                                 groupnames=['options'],
                                                 perm='r',
                                                 is_save=True,
                                                 name='Shortname',
                                                 info='Short name for scenario. This string is defined when saving the scenario. It is used as rootname for all files produced by this scenario. Please avoid special charracters, whitespace, accents etc. ASCII is recommented in order to remain compatible between operating systems.',
                                                 ))

        self.workdirpath = attrsman.add(cm.AttrConf('workdirpath', workdirpath,
                                                    groupnames=['options'],
                                                    perm='r',
                                                    is_save=True,
                                                    name='Workdir',
                                                    metatype='dirpath',
                                                    info='Working directory for this scenario and can be changed when saving the scenario. Please avoid special charracters, whitespace, accents etc. ASCII is recommented in order to remain compatible between operating systems.',
                                                    ))

        self.net = attrsman.add(cm.ObjConf(network.Network(self)))

        self.landuse = attrsman.add(cm.ObjConf(landuse.Landuse(self, self.net)))

        self.demand = attrsman.add(cm.ObjConf(demand.Demand(self)))
        # if self.get_version()<0.2:
        #    self.delete('simulation')

        self._init_attributes()
示例#2
0
    def _init_attributes(self):
        attrsman = self.get_attrsman()

        self.net = attrsman.add(cm.ObjConf(network.Network(self)))

        self.landuse = attrsman.add(cm.ObjConf(landuse.Landuse(self,
                                                               self.net)))

        self.demand = attrsman.add(cm.ObjConf(demand.Demand(self)))