コード例 #1
0
ファイル: dssInstance.py プロジェクト: kdheepak/PyDSS
 def _CreateBusObjects(self):
     BusNames = self._dssCircuit.AllBusNames()
     self._dssInstance.run_command('New  Fault.DEFAULT Bus1={} enabled=no r=0.01'.format(BusNames[0]))
     for BusName in BusNames:
         self._dssCircuit.SetActiveBus(BusName)
         self._dssBuses[BusName] = dssBus(self._dssInstance)
     return
コード例 #2
0
ファイル: dssInstance.py プロジェクト: NREL/PyDSS
 def CreateBusObjects():
     dssBuses = {}
     BusNames = dss.Circuit.AllBusNames()
     dss.run_command('New  Fault.DEFAULT Bus1={} enabled=no r=0.01'.format(
         BusNames[0]))
     for BusName in BusNames:
         dss.Circuit.SetActiveBus(BusName)
         dssBuses[BusName] = dssBus()
     return dssBuses
コード例 #3
0
ファイル: dssElement.py プロジェクト: yuanzy97/PyDSS
    def __init__(self, dssInstance):
        fullName = dssInstance.Element.Name()
        if dssInstance.CktElement.Name() != fullName:
            raise Exception(
                f"name mismatch {dssInstance.CktElement.Name()} {fullName}")

        self._Class, name = fullName.split('.', 1)
        super(dssElement, self).__init__(dssInstance, name, fullName)
        self._Enabled = dssInstance.CktElement.Enabled()
        if not self._Enabled:
            return

        self._Parameters = {}
        self._NumTerminals = dssInstance.CktElement.NumTerminals()
        self._NumConductors = dssInstance.CktElement.NumConductors()

        assert self._NumConductors <= self._MAX_CONDUCTORS, str(
            self._NumConductors)
        self._NumPhases = dssInstance.CktElement.NumPhases()

        n = self._NumConductors
        nodes = dssInstance.CktElement.NodeOrder()
        self._Nodes = [
            nodes[i * n:(i + 1) * n] for i in range((len(nodes) + n - 1) // n)
        ]

        assert len(nodes) == self._NumTerminals * self._NumConductors, \
            f"{self._Nodes} {self._NumTerminals} {self._NumConductors}"

        self._dssInstance = dssInstance

        PropertiesNames = self._dssInstance.Element.AllPropertyNames()
        AS = range(len(PropertiesNames))
        for i, PptName in zip(AS, PropertiesNames):
            self._Parameters[PptName] = str(i)

        CktElmVarDict = dssInstance.CktElement.__dict__
        for VarName in dssInstance.CktElement.AllVariableNames():
            CktElmVarDict[VarName] = None

        for key in CktElmVarDict.keys():
            try:
                self._Variables[key] = getattr(dssInstance.CktElement, key)
            except:
                self._Variables[key] = None
        self.Bus = dssInstance.CktElement.BusNames()
        self.BusCount = len(self.Bus)
        self.sBus = []
        for BusName in self.Bus:
            self._dssInstance.Circuit.SetActiveBus(BusName)
            self.sBus.append(dssBus(self._dssInstance))