00001 // $Id: volt_var_control.h 4738 2014-07-03 00:55:39Z dchassin $ 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 enumeration control_method; 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 bool pf_signed; //Flag to indicate if a signed pf value should be maintained, or just a "deadband around 1" 00042 00043 volt_var_control(MODULE *mod); 00044 volt_var_control(CLASS *cl=oclass):powerflow_object(cl){}; 00045 int create(void); 00046 int init(OBJECT *parent=NULL); 00047 int isa(char *classname); 00048 00049 TIMESTAMP presync(TIMESTAMP t0); 00050 TIMESTAMP postsync(TIMESTAMP t0); 00051 00052 private: 00053 VOLTVARSTATE prev_mode; //Previous mode of Volt-VAr controller - used to transitions 00054 link_object *substation_link; //Object to obtain power-factor measurments 00055 regulator **pRegulator_list; //Regulators 00056 regulator_configuration **pRegulator_configs; //Regulator configurations 00057 capacitor **pCapacitor_list; //Capacitors to monitor 00058 double *Capacitor_size; //Size of various capacitors 00059 double *minimum_voltage; //Minimum allowable voltage of the system 00060 double *maximum_voltage; //Maximum allowable voltage of the system 00061 double *desired_voltage; //Desired operating point voltages 00062 double *max_vdrop; //Maximum allowed voltage drops 00063 double *vbw_low; //Bandwidth (deadband) for low loading 00064 double *vbw_high; //Bandwidth (deadband) for high loading 00065 00066 node ***pMeasurement_list; //Measurement points - they are assumed to be nodes at some level 00067 node **RegToNodes; //To Node (Load side) of regulators - for voltage VO measurements 00068 int num_caps; //Number of capacitors under our control 00069 int num_regs; //Number of regulators under our control 00070 int *num_meas; //Number of voltage measurements to monitor 00071 bool Regulator_Change; //Flag to indicate a regulator change is in progress - used to hold off VAr-based switching 00072 double *reg_step_up; //Regulator step for upper taps 00073 double *reg_step_down; //Regulator step for lower taps (may be same as reg_step_up) 00074 double *RegUpdateTimes; //Regulator progression times (differential) 00075 TIMESTAMP *TRegUpdate; //Regulator update times to proceed towards (absolute) 00076 double *CapUpdateTimes; //Capacitor progression times (differential) 00077 TIMESTAMP TCapUpdate; //Capacitor time to proceed towards 00078 bool TUpdateStatus; //Status variable for TUpdate - used for transitioning between Active/Standby states 00079 bool first_cycle; 00080 regulator_configuration::Control_enum *PrevRegState; //Previous state of the regulators 00081 capacitor::CAPCONTROL *PrevCapState; //Previous state of the capacitors 00082 TIMESTAMP prev_time; 00083 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) 00084 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) 00085 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) 00086 }; 00087 00088 #endif // _VOLT_VAR_CONTROL_H