00001 // $Id: volt_var_control.h 2010-02-26 15:00:00Z d3x593 $ 00002 // Copyright (C) 2010 Battelle Memorial Institute 00003 00004 #ifndef _VOLT_VAR_CONTROL_H 00005 #define _VOLT_VAR_CONTROL_H 00006 00007 #include "powerflow.h" 00008 #include "regulator.h" 00009 #include "capacitor.h" 00010 00011 typedef enum { 00012 STANDBY=0, //CVVC is off 00013 ACTIVE=1 //CVVC is on 00014 } VOLTVARSTATE; 00015 00016 class volt_var_control : public powerflow_object 00017 { 00018 public: 00019 static CLASS *oclass; 00020 static CLASS *pclass; 00021 public: 00022 VOLTVARSTATE control_method; //Control method for IVVC controller (On or off) 00023 double cap_time_delay; //Default delay for capacitors 00024 double reg_time_delay; //Default delay for regulator 00025 double desired_pf; //Desired power factor for the system 00026 double d_max; //Scaling constant for capacitor switching on - typically 0.3 - 0.6 00027 double d_min; //Scaling constant for capacitor switching off - typically 0.1 - 0.4 00028 OBJECT *substation_lnk_obj; //Power factor measurement link 00029 char1024 regulator_list; //List of regulators, separated by commas 00030 char1024 capacitor_list; //List of controllable capacitors, separated by commas 00031 char1024 measurement_list; //List of available voltage measurement points, separated by commas with the regulator index between 00032 char1024 minimum_voltage_txt; //List of minimum allowable voltage of the system 00033 char1024 maximum_voltage_txt; //List of maximum allowable voltage of the system 00034 char1024 desired_voltage_txt; //List of desired operating point voltages 00035 char1024 max_vdrop_txt; //List of maximum allowed voltage drops 00036 char1024 vbw_low_txt; //List of bandwidth (deadband) for low loading 00037 char1024 vbw_high_txt; //List of bandwidth (deadband) for high loading 00038 set pf_phase; //Phases for power factor monitoring to occur 00039 double react_pwr; //Reactive power quantity at the substation 00040 double curr_pf; //Current pf at the substation 00041 00042 volt_var_control(MODULE *mod); 00043 volt_var_control(CLASS *cl=oclass):powerflow_object(cl){}; 00044 int create(void); 00045 int init(OBJECT *parent=NULL); 00046 int isa(char *classname); 00047 00048 TIMESTAMP presync(TIMESTAMP t0); 00049 TIMESTAMP postsync(TIMESTAMP t0); 00050 00051 private: 00052 VOLTVARSTATE prev_mode; //Previous mode of Volt-VAr controller - used to transitions 00053 link *substation_link; //Object to obtain power-factor measurments 00054 regulator **pRegulator_list; //Regulators 00055 regulator_configuration **pRegulator_configs; //Regulator configurations 00056 capacitor **pCapacitor_list; //Capacitors to monitor 00057 double *Capacitor_size; //Size of various capacitors 00058 double *minimum_voltage; //Minimum allowable voltage of the system 00059 double *maximum_voltage; //Maximum allowable voltage of the system 00060 double *desired_voltage; //Desired operating point voltages 00061 double *max_vdrop; //Maximum allowed voltage drops 00062 double *vbw_low; //Bandwidth (deadband) for low loading 00063 double *vbw_high; //Bandwidth (deadband) for high loading 00064 00065 node ***pMeasurement_list; //Measurement points - they are assumed to be nodes at some level 00066 node **RegToNodes; //To Node (Load side) of regulators - for voltage VO measurements 00067 int num_caps; //Number of capacitors under our control 00068 int num_regs; //Number of regulators under our control 00069 int *num_meas; //Number of voltage measurements to monitor 00070 bool Regulator_Change; //Flag to indicate a regulator change is in progress - used to hold off VAr-based switching 00071 double *reg_step_up; //Regulator step for upper taps 00072 double *reg_step_down; //Regulator step for lower taps (may be same as reg_step_up) 00073 double *RegUpdateTimes; //Regulator progression times (differential) 00074 TIMESTAMP *TRegUpdate; //Regulator update times to proceed towards (absolute) 00075 double *CapUpdateTimes; //Capacitor progression times (differential) 00076 TIMESTAMP TCapUpdate; //Capacitor time to proceed towards 00077 bool TUpdateStatus; //Status variable for TUpdate - used for transitioning between Active/Standby states 00078 bool first_cycle; 00079 regulator_configuration::Control_enum *PrevRegState; //Previous state of the regulators 00080 capacitor::CAPCONTROL *PrevCapState; //Previous state of the capacitors 00081 TIMESTAMP prev_time; 00082 void size_sorter(double *cap_size, int *cap_Index, int cap_num, double *temp_cap_size, int *temp_cap_Index); //Capacitor size sorting function (recursive) 00083 char *dbl_token(char *start_token, double *dbl_val); //Function to parse a comma-separated list to get the next double (or the last double) 00084 char *obj_token(char *start_token, OBJECT **obj_val); //Function to parse a comma-separated list to get the next object (or the last object) 00085 }; 00086 00087 #endif // _VOLT_VAR_CONTROL_H