residential/waterheater.h

Go to the documentation of this file.
00001 
00009 #ifndef _WATERHEATER_H
00010 #define _WATERHEATER_H
00011 
00012 #include "residential.h"
00013 
00014 class waterheater {
00015 private:
00016     complex *pVoltage;      // reference to the assigned panel circuit voltage
00017     house *pHouse;          // reference to the parent house
00018 
00019 public:
00020     typedef enum {
00021         ONENODE,    
00022         TWONODE,    
00023         NONE,       
00024     } WHMODEL;  
00025     typedef enum {
00026         DEPLETING,  
00027         RECOVERING, 
00028         STABLE,     
00029     } WHQFLOW;      
00030     typedef enum {
00031         INSIDE,     
00032         GARAGE,     
00033     } WHLOCATION;
00034     typedef enum {
00035         FULL,       
00036         PARTIAL,    
00037         EMPTY,      
00038     } WHQSTATE; 
00039 
00040     // One of our main return values...
00041     double time_to_transition;      
00042 
00043     // Basic characteristics defined at creation...
00044     double Tset_curtail;            
00045     double Tinlet;                  
00046     WHLOCATION location;            
00047 
00048     // Characteristics calculated from basics at creation...
00049     double area;                    
00050     double height;                  
00051     double Ton;                     
00052     double Toff;                    
00053     double Cw;                      
00054 
00055     // The primary values we compute in our simultation...
00056     double h;                       
00057     double Tlower;                  
00058     double Tupper;                  
00059     double Twater;                  
00060     double Tw;                      
00061 
00062     double last_water_demand;
00063     double cur_water_demand;
00064     // Convenience values (some pre-computed here and there for efficiency)...
00065     bool heat_needed;               
00066 
00067 public:
00068     double tank_volume;                 
00069     double tank_UA;                     
00070     double tank_diameter;               
00071     double water_demand;                
00072     double heating_element_capacity;    
00073     double tank_setpoint;               
00074     double thermostat_deadband;         
00075     complex power_kw;                   
00076     double power_factor;
00077     complex kwh_meter;                  
00078 
00079 public:
00080     static CLASS *oclass;
00081     static waterheater *defaults;
00082     
00083     waterheater(MODULE *mod);
00084     ~waterheater(void);
00085     int create();
00086     int init(OBJECT *parent);
00087     void thermostat(TIMESTAMP t0, TIMESTAMP t1);                    // Thermostat plc control code - determines whether to heat...
00088     TIMESTAMP sync(TIMESTAMP t0, TIMESTAMP t1);
00089 
00090 
00091 public:
00092     WHMODEL current_model;              
00093     WHQFLOW load_state;                 
00094 
00095     WHQSTATE tank_state(void);              // Are we full, partial, or empty?
00096     void set_time_to_transition(void);                  //< Sets timeToTransition...
00097     WHQFLOW set_current_model_and_load_state(void); // set the model and state for each cycle
00098     void update_T_and_or_h(double);                     // Reset Tw and or h...
00099 
00100     double dhdt(double h);                              // Calculates dh/dt...
00101     double actual_Q(void);                              // Actual heat from heating element...
00102     double new_time_1node(double T0, double T1);        // Calcs time to transition...
00103     double new_temp_1node(double T0, double delta_t);   // Calcs temp after transition...
00104     double new_time_2zone(double h0, double h1);        // Calcs time to transition...
00105     double new_h_2zone(double h0, double delta_t);      // Calcs h after transition...
00106 
00107     double get_Tambient(WHLOCATION water_heater_location);      // ambient T [F] -- either an indoor house temperature or a garage temperature, probably...
00108     typedef enum {MODEL_NOT_1ZONE=0, MODEL_NOT_2ZONE=1} WRONGMODEL;
00109     void wrong_model(WRONGMODEL msg);
00110 };
00111 
00112 #endif
00113 

GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy