Exemplo n.º 1
0
    def _UpdateDictionary(self):
        InvalidSelection = [
            'Settings', 'ActiveClass', 'dss', 'utils', 'PDElements',
            'XYCurves', 'Bus', 'Properties'
        ]
        # TODO: this causes a segmentation fault. Aadil says it may not be needed.
        #self._dssObjectsByClass={'LoadShape': self._GetRelaventObjectDict('LoadShape')}

        for ElmName in self._dssInstance.Circuit.AllElementNames():
            Class, Name = ElmName.split('.', 1)
            if Class + 's' not in self._dssObjectsByClass:
                self._dssObjectsByClass[Class + 's'] = {}
            self._dssInstance.Circuit.SetActiveElement(ElmName)
            self._dssObjectsByClass[Class + 's'][ElmName] = create_dss_element(
                Class, Name, self._dssInstance)
            self._dssObjects[ElmName] = self._dssObjectsByClass[Class +
                                                                's'][ElmName]

        for ObjName in self._dssObjects.keys():
            Class = ObjName.split('.')[0] + 's'
            if Class not in self._dssObjectsByClass:
                self._dssObjectsByClass[Class] = {}
            if ObjName not in self._dssObjectsByClass[Class]:
                self._dssObjectsByClass[Class][ObjName] = self._dssObjects[
                    ObjName]

        self._dssObjects['Circuit.' + self._dssCircuit.Name()] = dssCircuit(
            self._dssInstance)
        self._dssObjectsByClass['Circuits'] = {
            'Circuit.' + self._dssCircuit.Name():
            self._dssObjects['Circuit.' + self._dssCircuit.Name()]
        }
        return
Exemplo n.º 2
0
    def CreateDssObjects(dssBuses):
        dssObjects = {}
        dssObjectsByClass = defaultdict(dict)

        InvalidSelection = [
            'Settings', 'ActiveClass', 'dss', 'utils', 'PDElements',
            'XYCurves', 'Bus', 'Properties'
        ]
        # TODO: this causes a segmentation fault. Aadil says it may not be needed.
        #self._dssObjectsByClass={'LoadShape': self._GetRelaventObjectDict('LoadShape')}

        for ElmName in dss.Circuit.AllElementNames():
            Class, Name = ElmName.split('.', 1)
            ClassName = Class + 's'
            dss.Circuit.SetActiveElement(ElmName)
            dssObjectsByClass[ClassName][ElmName] = create_dss_element(
                Class, Name)
            dssObjects[ElmName] = dssObjectsByClass[ClassName][ElmName]

        for ObjName in dssObjects.keys():
            ClassName = ObjName.split('.')[0] + 's'
            if ObjName not in dssObjectsByClass[Class]:
                dssObjectsByClass[Class][ObjName] = dssObjects[ObjName]

        dssObjects['Circuit.' + dss.Circuit.Name()] = dssCircuit()
        dssObjectsByClass['Circuits'] = {
            'Circuit.' + dss.Circuit.Name():
            dssObjects['Circuit.' + dss.Circuit.Name()]
        }
        dssObjectsByClass['Buses'] = dssBuses

        return dssObjects, dssObjectsByClass
Exemplo n.º 3
0
 def _GetRelaventObjectDict(self, key):
     ObjectList = {}
     ElmCollection = getattr(self._dssInstance, key)
     Elem = ElmCollection.First()
     while Elem:
         FullName = self._dssInstance.Element.Name()
         Class, Name =  FullName.split('.', 1)
         ObjectList[FullName] = create_dss_element(Class, Name, self._dssInstance)
         Elem = ElmCollection.Next()
     return ObjectList