00001
00009 #ifndef _battery_H
00010 #define _battery_H
00011
00012 #include <stdarg.h>
00013 #include "../powerflow/powerflow_object.h"
00014
00015
00016 #include "gridlabd.h"
00017 #include "energy_storage.h"
00018
00019
00020 class battery : public energy_storage
00021 {
00022 private:
00023 double number_of_phases_out;
00024 TIMESTAMP prev_time;
00025 int first_time_step;
00026 double power_transferred;
00027 int prev_state;
00028
00029
00030
00031
00032 protected:
00033
00034 public:
00035
00036 set phases;
00037 enum GENERATOR_MODE {
00038 GM_UNKNOWN=0,
00039 GM_CONSTANT_V=1,
00040 GM_CONSTANT_PQ,
00041 GM_CONSTANT_PF,
00042 GM_SUPPLY_DRIVEN,
00043 GM_POWER_DRIVEN,
00044 GM_VOLTAGE_CONTROLLED,
00045 GM_POWER_VOLTAGE_HYBRID
00046 } gen_mode_v;
00047
00048
00049 enum GENERATOR_STATUS {
00050 OFFLINE=1,
00051 ONLINE=2
00052 } gen_status_v;
00053
00054 enum ADDITIONAL_CONTROLS {
00055 AC_NONE=0,
00056 AC_LINEAR_TEMPERATURE=1
00057 } additional_controls;
00058
00059 enum POWER_TYPE {
00060 DC=1,
00061 AC=2
00062 } power_type_v;
00063
00064 enum RFB_SIZE {
00065 SMALL=1,
00066 MED_COMMERCIAL,
00067 MED_HIGH_ENERGY,
00068 LARGE,
00069 HOUSEHOLD
00070 } rfb_size_v;
00071
00072 enum BATTERY_STATE {
00073 BS_WAITING = 0,
00074 BS_CHARGING = 1,
00075 BS_DISCHARGING = 2,
00076 BS_FULL = 3,
00077 BS_EMPTY = 4,
00078 BS_CONFLICTED = 5,
00079 } battery_state;
00080
00081
00082 complex *pCircuit_V;
00083 complex *pLine_I;
00084 complex *pLine12;
00085 complex *pPower;
00086 double power_set_high;
00087 double power_set_low;
00088 double power_set_high_highT;
00089 double power_set_low_highT;
00090 double voltage_set_high;
00091 double voltage_set_low;
00092 double deadband;
00093 double check_power;
00094
00095
00096
00097 complex last_current[3];
00098 double no_of_cycles;
00099 bool Iteration_Toggle;
00100 bool *NR_mode;
00101 double *pTout;
00102 double *pSolar;
00103 double parasitic_power_draw;
00104 double high_temperature;
00105 double low_temperature;
00106 double midpoint_temperature;
00107 double sensitivity;
00108 double check_power_high;
00109 double check_power_low;
00110
00111 public:
00112
00113 battery(MODULE *module);
00114 int create(void);
00115 int init(OBJECT *parent);
00116
00117 TIMESTAMP rfb_event_time(TIMESTAMP t0, complex power, double e);
00118 TIMESTAMP presync(TIMESTAMP t0, TIMESTAMP t1);
00119 TIMESTAMP sync(TIMESTAMP t0, TIMESTAMP t1);
00120 TIMESTAMP postsync(TIMESTAMP t0, TIMESTAMP t1);
00121
00122 bool *get_bool(OBJECT *obj, char *name);
00123 double calculate_efficiency(complex voltage, complex current);
00124 complex *get_complex(OBJECT *obj, char *name);
00125 complex calculate_v_terminal(complex v, complex i);
00126
00127 public:
00128 static CLASS *oclass;
00129 static battery *defaults;
00130 #ifdef OPTIONAL
00131 static CLASS *pclass;
00132 TIMESTAMPP plc(TIMESTAMP t0, TIMESTAMP t1);
00133 #endif
00134 };
00135
00136 #endif
00137
00147 #ifndef _battery_H
00148 #define _battery_H
00149
00150 #include <stdarg.h>
00151 #include "gridlabd.h"
00152
00153 class battery {
00154 private:
00155
00156 protected:
00157
00158 public:
00159
00160 public:
00161
00162 battery(MODULE *module);
00163 int create(void);
00164 int init(OBJECT *parent);
00165 TIMESTAMP presync(TIMESTAMP t0, TIMESTAMP t1);
00166 TIMESTAMP sync(TIMESTAMP t0, TIMESTAMP t1);
00167 TIMESTAMP postsync(TIMESTAMP t0, TIMESTAMP t1);
00168 public:
00169 static CLASS *oclass;
00170 static battery *defaults;
00171 #ifdef OPTIONAL
00172 static CLASS *pclass;
00173 TIMESTAMPP plc(TIMESTAMP t0, TIMESTAMP t1);
00174 #endif
00175 };
00176
00177 #endif
00178