Esempio n. 1
0
 def change_prod_con(self,
                     areas,
                     prod,
                     con,
                     pf,
                     tol=4,
                     row=None,
                     column=None):
     """Wrapper function to change load and production
     Args:
         areas: area number
         prod: production
         con: consumption
         pf: power factor
         tol: tolerance for round
         row: which row to write to
         column: which column to write to
     """
     psspy.bsys(sid=0, numarea=1, areas=[areas])
     psspy.scal_2(0, 0, 0, [0, 1, 1, 1, 0], [
         con, prod, 0.0, 0.0, 0.0, 0.0,
         round(con * math.tan(math.acos(pf)), tol)
     ])
     if self.to_excel:
         self.sheet.cell(row=row, column=column).value = prod
         self.sheet.cell(row=row, column=column + 1).value = con
def scale_gen(MW_change, list_redispatched_gen):

    # Define a new subsystem (call it nbr 3) --all gen that will be redispatched
    psspy.bsys(1, 0, [0.0, 0.0], 0, [], len(list_redispatched_gen),
               list_redispatched_gen, 0, [], 0, [])
    psspy.scal_2(1, 0, 1, [0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
    psspy.scal_2(0, 1, 2, [_i, 3, 1, 4, 0],
                 [0.0, MW_change, 0.0, 0.0, 0.0, 0.0, 0.95])

    return
Esempio n. 3
0
 def step(self, value):
     """
         Wrapper around psspy scal_2 to step the load.
         Input:
             value: the load increase or decrease
     """
     wrappers.one_bus_subsys(1, self.bus_id)
     psspy.scal_2(1, 0, 1, [0, 0, 0, 0, 0],
                  [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
     psspy.scal_2(0, 1, 2, [_i, 3, 1, 1, 0],
                  [value, 0, 0.0, -.0, 0.0, -.0, 0.0])
 def _increaseLoadAtBuses(self,load_buses,percent_change):
     #define the bus subsystem
     psspy.bsys(1,0,[0.0,0.0],0,[],len(load_buses),load_buses,1,[1],0,[])
     #prepare the load increase
     #in first array
     #1st zero = include all buses in the subsystem both interruptible and uninterrupted 
     #5th zero = loads of all types (1,2 and 3) 
     psspy.scal_2(1,0,1,[0,0,0,0,0],[0.0,0.0,0.0,0.0,0.0,0.0,0.0])
     #increase the loads
     #in first array
     #2nd number = percent change
     #3rd number = ignore machine limits
     #4th number = increase the reactive load equally (in percents)
     #in second array 
     #1st number load increase
     _i = psspy.getdefaultint()
     psspy.scal_2(0,0,2,[_i,2,0,3,0],[ percent_change,0.0,0.0,0.0,0.0,0.0,0.0])
Esempio n. 5
0
 def _setPEVOutputPower(self, power, bus):
     """Sets the PEV power for a specified bus"""
     psspy.bsys(0, 0, [345., 345.], 3, [1, 2, 3], 1, [bus], 1, [2], 0, [])
     psspy.scal_2(0, 0, 0, [psspy._i, 1, 0, 0, 0],
                  [power, 0.0, 0.0, -.0, 0.0, -.0, 1.0])
     psspy.scal_2(0, 0, 1, [psspy._i, 1, 0, 0, 0],
                  [power, 0.0, 0.0, -.0, 0.0, -.0, 1.0])
     psspy.scal_2(0, 0, 2, [psspy._i, 1, 0, 0, 0],
                  [power, 0.0, 0.0, -.0, 0.0, -.0, 1.0])
 def _setPEVTotalOutputPower(self,power):
     """Set the pevs total output power. The individual PEV power is proportional to the P at that bus"""
     #PEVs needs to be defined with owner number 2
     total_power = sum(pev._P for pev in self._simulation._power_system_object._pevs)
     for pev in self._simulation._power_system_object._pevs:
         p_to_set = pev._P/total_power*power
         psspy.bsys(0,0,[ 345., 345.],3,[1,2,3],1,[pev._bus],1,[2],0,[])
         psspy.scal_2(0,0,0,[psspy._i,1,0,0,0],[p_to_set,0.0,0.0,-.0,0.0,-.0, 1.0])
         psspy.scal_2(0,0,1,[psspy._i,1,0,0,0],[p_to_set,0.0,0.0,-.0,0.0,-.0, 1.0])
         psspy.scal_2(0,0,2,[psspy._i,1,0,0,0],[p_to_set,0.0,0.0,-.0,0.0,-.0, 1.0])
Esempio n. 7
0
 def _setPEVTotalOutputPower(self, power):
     """Set the pevs total output power. The individual PEV power is proportional to the P at that bus"""
     #PEVs needs to be defined with owner number 2
     total_power = sum(
         pev._P for pev in self._simulation._power_system_object._pevs)
     for pev in self._simulation._power_system_object._pevs:
         p_to_set = pev._P / total_power * power
         psspy.bsys(0, 0, [345., 345.], 3, [1, 2, 3], 1, [pev._bus], 1, [2],
                    0, [])
         psspy.scal_2(0, 0, 0, [psspy._i, 1, 0, 0, 0],
                      [p_to_set, 0.0, 0.0, -.0, 0.0, -.0, 1.0])
         psspy.scal_2(0, 0, 1, [psspy._i, 1, 0, 0, 0],
                      [p_to_set, 0.0, 0.0, -.0, 0.0, -.0, 1.0])
         psspy.scal_2(0, 0, 2, [psspy._i, 1, 0, 0, 0],
                      [p_to_set, 0.0, 0.0, -.0, 0.0, -.0, 1.0])
 def _setPEVOutputPower(self,power,bus):
     """Sets the PEV power for a specified bus"""
     psspy.bsys(0,0,[ 345., 345.],3,[1,2,3],1,[bus],1,[2],0,[])
     psspy.scal_2(0,0,0,[psspy._i,1,0,0,0],[power,0.0,0.0,-.0,0.0,-.0, 1.0])
     psspy.scal_2(0,0,1,[psspy._i,1,0,0,0],[power,0.0,0.0,-.0,0.0,-.0, 1.0])
     psspy.scal_2(0,0,2,[psspy._i,1,0,0,0],[power,0.0,0.0,-.0,0.0,-.0, 1.0])