00001
00011 #ifndef SWITCH_OBJECT_H
00012 #define SWITCH_OBJECT_H
00013
00014 #include "powerflow.h"
00015 #include "link.h"
00016
00017 EXPORT SIMULATIONMODE interupdate_switch(OBJECT *obj, unsigned int64 delta_time, unsigned long dt, unsigned int iteration_count_val, bool interupdate_pos);
00018
00019 class switch_object : public link_object
00020 {
00021 public:
00022 static CLASS *oclass;
00023 static CLASS *pclass;
00024
00025 public:
00026 typedef enum {OPEN=0, CLOSED=1} SWITCHSTATE;
00027 typedef enum {INDIVIDUAL_SW=0, BANKED_SW=1} SWITCHBANK;
00028 unsigned char prev_full_status;
00029
00030 int create(void);
00031 int init(OBJECT *parent);
00032 TIMESTAMP sync(TIMESTAMP t0);
00033 switch_object(MODULE *mod);
00034 inline switch_object(CLASS *cl=oclass):link_object(cl){};
00035 int isa(char *classname);
00036
00037 void set_switch(bool desired_status);
00038 void set_switch_full(char desired_status_A, char desired_status_B, char desired_status_C);
00039 void set_switch_full_reliability(unsigned char desired_status);
00040 void set_switch_faulted_phases(unsigned char desired_status);
00041 void switch_sync_function(void);
00042 unsigned char switch_expected_sync_function(void);
00043 OBJECT **get_object(OBJECT *obj, char *name);
00044
00045 void BOTH_switch_sync_pre(unsigned char *work_phases_pre, unsigned char *work_phases_post);
00046 void NR_switch_sync_post(unsigned char *work_phases_pre, unsigned char *work_phases_post, OBJECT *obj, TIMESTAMP *t0, TIMESTAMP *t2);
00047
00048
00049 SIMULATIONMODE inter_deltaupdate_switch(unsigned int64 delta_time, unsigned long dt, unsigned int iteration_count_val, bool interupdate_pos);
00050
00051 enumeration switch_banked_mode;
00052 TIMESTAMP prev_SW_time;
00053
00054 unsigned char phased_switch_status;
00055 unsigned char faulted_switch_phases;
00056 bool prefault_banked;
00057 enumeration phase_A_state;
00058 enumeration phase_B_state;
00059 enumeration phase_C_state;
00060
00061 double switch_resistance;
00062 int kmldata(int (*stream)(const char*,...));
00063 private:
00064 OBJECT **eventgen_obj;
00065 FUNCTIONADDR event_schedule;
00066 FUNCTIONADDR fault_handle_call;
00067 bool event_schedule_map_attempt;
00068 };
00069
00070 EXPORT int change_switch_state(OBJECT *thisobj, unsigned char phase_change, bool state);
00071 EXPORT int reliability_operation(OBJECT *thisobj, unsigned char desired_phases);
00072 EXPORT int create_fault_switch(OBJECT *thisobj, OBJECT **protect_obj, char *fault_type, int *implemented_fault, TIMESTAMP *repair_time);
00073 EXPORT int fix_fault_switch(OBJECT *thisobj, int *implemented_fault, char *imp_fault_name);
00074 EXPORT int switch_fault_updates(OBJECT *thisobj, unsigned char restoration_phases);
00075 EXPORT int change_switch_state_toggle(OBJECT *thisobj);
00076
00077 #endif // SWITCH_OBJECT_H
00078