00001 // $Id: fault_check.h 2009-12-15 15:00:00Z d3x593 $ 00002 // Copyright (C) 2009 Battelle Memorial Institute 00003 00004 #ifndef _FAULT_CHECK_H 00005 #define _FAULT_CHECK_H 00006 00007 #include "powerflow.h" 00008 00009 class fault_check : public powerflow_object 00010 { 00011 public: 00012 static CLASS *oclass; 00013 static CLASS *pclass; 00014 public: 00015 //Move typedef in here so reliabilty-related items can access the enumeration 00016 typedef enum { 00017 SINGLE=0, //Runs one fault_check, right at the beginning of powerflow 00018 ONCHANGE=1, //Runs fault_check everytime a Jacobian reconfiguration is requested 00019 ALLT=2, //Runs fault_check on every iteration 00020 SINGLE_DEBUG=3 //Runs one fault_check, but will terminate the simulation -- bypasses some phase check errors 00021 } FCSTATE; 00022 00023 unsigned int **Supported_Nodes; //Nodes with source support (connected to swing somehow) 00024 char *Alteration_Nodes; //Similar to Supported_Nodes, but used to track alteration progression (namely, has the side been handled) 00025 char *Alteration_Links; //Similar to Supported_Nodes, but used to track alteration progression in links 00026 unsigned char *valid_phases; //Nodes with source support, specific to individual phases (hex mapped) -- used for mesh-based check 00027 00028 enumeration fcheck_state; //Mode variable 00029 char1024 output_filename; //File name to output unconnected bus values 00030 bool reliability_mode; //Flag for reliability implementation 00031 bool reliability_search_mode; //Flag for how the object removal search occurs - basically assuming radial versus not 00032 bool grid_association_mode; //Flag to see if fault_check should be checking for multiple grids, or just go on the "master swing" idea 00033 bool full_print_output; //Flag to determine if both supported and unsupported nodes get written to the output file 00034 OBJECT *rel_eventgen; //Eventgen object in reliability - allows "unscheduled" faults 00035 00036 fault_check(MODULE *mod); 00037 fault_check(CLASS *cl=oclass):powerflow_object(cl){}; 00038 int create(void); 00039 int init(OBJECT *parent=NULL); 00040 int isa(char *classname); 00041 void search_links(int node_int); //Function to check connectivity and support of nodes 00042 void search_links_mesh(int node_int); //Function to check connectivity and support of nodes, but more in the "mesh" sense 00043 void support_check(int swing_node_int); //Function that performs the connectivity check - this way so can be easily externally accessed 00044 void support_check_mesh(void); //Function that performs the connectivity check for not-so-radial systems 00045 void reset_support_check(void); //Function to re-init the support matrix 00046 void write_output_file(TIMESTAMP tval, double tval_delta); //Function to write out "unsupported" items 00047 00048 void support_check_alterations(int baselink_int, bool rest_mode); //Function to update powerflow for "no longer supported" devices 00049 void reset_alterations_check(void); //Function to re-init the alterations support matrix - mainly used to see if ends have been touched or not 00050 void allocate_alterations_values(bool reliability_mode_bool); //Function to allocate the various memory items associated with reliability 00051 bool output_check_supported_mesh(void); //Function to check and see if anything is unsupported and set overall flag (file outputs) 00052 00053 void support_search_links(int node_int, int node_start, bool impact_mode); //Function to check connectivity and support of nodes and remove/restore components as necessary 00054 void support_search_links_mesh(int baselink_int, bool impact_mode); //Function to parse bus list and remove anything that isn't supported (mesh systems) 00055 void momentary_activation(int node_int); //Function to progress down a branch and flag momentary outages 00056 void special_object_alteration_handle(int branch_idx); //Functionalized special device alteration code 00057 00058 void reset_associated_grid(void); //Function to reset/allocate "grid association" array 00059 void associate_grids(void); //Function to look for the various swing nodes in the system, then associate the grids 00060 void search_associated_grids(unsigned int node_int, int grid_counter); //Function to perform the "grid association" and populate the array 00061 00062 STATUS disable_island(int island_number); //Function to remove/disable an island if it diverged in powerflow 00063 STATUS rescan_topology(int bus_that_called_reset); //Function to do the grid association and rescan islands 00064 00065 TIMESTAMP sync(TIMESTAMP t0); 00066 00067 private: 00068 TIMESTAMP prev_time; //Previous timestamp - mainly for intialization 00069 FUNCTIONADDR restoration_fxn; // Function address for restoration object reconfiguration call 00070 bool force_reassociation; //Flag to force the island reassociation -- used if an island was removed to renumber them 00071 }; 00072 00073 EXPORT int powerflow_alterations(OBJECT *thisobj, int baselink,bool rest_mode); 00074 EXPORT double handle_sectionalizer(OBJECT *thisobj, int sectionalizer_number); 00075 EXPORT STATUS powerflow_disable_island(OBJECT *thisobj, int island_number); 00076 EXPORT STATUS powerflow_rescan_topo(OBJECT *thisobj,int bus_that_called_reset); 00077 00078 #endif // _FAULT_CHECK_H