00001
00002
00003
00004 #ifndef _REGULATOR_H
00005 #define _REGULATOR_H
00006
00007 #include "powerflow.h"
00008 #include "link.h"
00009 #include "regulator_configuration.h"
00010
00011 EXPORT SIMULATIONMODE interupdate_regulator(OBJECT *obj, unsigned int64 delta_time, unsigned long dt, unsigned int iteration_count_val, bool interupdate_pos);
00012
00013 class regulator : public link_object
00014 {
00015 public:
00016 double VtapChange;
00017 double tapChangePer;
00018 double Vlow;
00019 double Vhigh;
00020 complex V2[3], Vcomp[3];
00021 int16 tap[3];
00022 int16 prev_tap[3];
00023 complex volt[3];
00024 complex D_mat[3][3];
00025 complex W_mat[3][3];
00026 complex curr[3];
00027 complex check_voltage[3];
00028 OBJECT *RemoteNode;
00029 double tap_A_change_count;
00030 double tap_B_change_count;
00031 double tap_C_change_count;
00032 int16 initial_tap_A;
00033 int16 initial_tap_B;
00034 int16 initial_tap_C;
00035 int16 tap_A_changed;
00036 int16 tap_B_changed;
00037 int16 tap_C_changed;
00038 typedef enum {
00039 msg_INTERNAL,
00040 msg_EXTERNAL,
00041 } msg_mode;
00042 enumeration msgmode;
00043 TIMESTAMP prev_time;
00044 int16 prev_tap_A;
00045 int16 prev_tap_B;
00046 int16 prev_tap_C;
00047
00048 double regulator_resistance;
00049
00050
00051 SIMULATIONMODE inter_deltaupdate_regulator(unsigned int64 delta_time, unsigned long dt, unsigned int iteration_count_val, bool interupdate_pos);
00052 void reg_prePre_fxn(double curr_time_value);
00053 void reg_postPre_fxn(void);
00054 double reg_postPost_fxn(double curr_time_value);
00055
00056 protected:
00057 double mech_t_next[3];
00058 double dwell_t_next[3];
00059 double next_time;
00060 int16 mech_flag[3];
00061 int16 dwell_flag[3];
00062 int16 first_run_flag[3];
00063 void get_monitored_voltage();
00064 bool toggle_reverse_flow[3];
00065 bool toggle_reverse_flow_banked;
00066 int16 reverse_flow_tap[3];
00067
00068 private:
00069 bool offnominal_time;
00070 bool iteration_flag;
00071 bool new_reverse_flow_action[3];
00072 bool deltamode_reiter_request;
00073 gld_property *RNode_voltage[3];
00074 gld_property *ToNode_voltage[3];
00075 public:
00076 static CLASS *oclass;
00077 static CLASS *pclass;
00078
00079 public:
00080 OBJECT *configuration;
00081 regulator(MODULE *mod);
00082 inline regulator(CLASS *cl=oclass):link_object(cl){};
00083 int create(void);
00084 int init(OBJECT *parent);
00085 TIMESTAMP presync(TIMESTAMP t0);
00086 TIMESTAMP postsync(TIMESTAMP t0);
00087 int isa(char *classname);
00088 int kmldata(int (*stream)(const char*,...));
00089 };
00090
00091 #endif // _REGULATOR_H