residential/house.h

Go to the documentation of this file.
00001 
00009 #ifndef _HOUSE_H
00010 #define _HOUSE_H
00011 
00012 #include "residential.h"
00013 
00014 typedef enum {  BRK_OPEN=0,     
00015                 BRK_CLOSED=1,   
00016                 BRK_FAULT=-1}   
00017     BREAKERSTATUS; 
00018 typedef enum {  X12=0,  
00019                 X23=1,  
00020                 X13=2}  
00021     CIRCUITTYPE; 
00022 
00023 typedef struct s_circuit {
00024     CIRCUITTYPE type;   
00025     complex *pS; 
00026     complex *pV; 
00027     double max_amps; 
00028     int id; 
00029     BREAKERSTATUS status; 
00030     TIMESTAMP reclose; 
00031     unsigned short tripsleft; 
00032     struct s_circuit *next; 
00033 } CIRCUIT; 
00034 typedef struct s_panel {
00035     double max_amps; 
00036     BREAKERSTATUS status; 
00037     TIMESTAMP reclose; 
00038     CIRCUIT *circuits; 
00039 } PANEL; 
00040 
00041 #define N_SOLAR_SURFACES 9
00042 typedef enum {HORIZONTAL, NORTH, NORTH_EAST, EAST, SOUTH_EAST, SOUTH, SOUTH_WEST, WEST, NORTH_WEST} ORIENTATION;
00043 
00044 class house {
00045 private:
00046     PANEL panel; 
00047 
00048 
00049     inline complex V(CIRCUIT *c) 
00050     { return c->status==BRK_CLOSED ? *(c->pV) : complex(0,0);};
00051     complex *pCircuit_V; 
00052     complex *pLine_I; 
00053 
00054 public:  //definitions
00055     typedef enum {  HEAT, 
00056                     AUX, 
00057                     COOL, 
00058                     OFF  
00059                 }HCMODE; 
00060 
00061 public:
00062     // published variables
00063     double floor_area;              
00064     double envelope_UA;             
00065     double glazing_shgc;            
00066     double window_wall_ratio;       
00067     double gross_wall_area;         
00068     double ceiling_height;          
00069     double aspect_ratio;            
00070     double thermostat_deadband;     
00071     double airchange_per_hour;      
00072     double heating_setpoint;        
00073     double cooling_setpoint;        
00074     double solar_aperture[N_SOLAR_SURFACES];        
00075     double design_heating_capacity; 
00076     double design_cooling_capacity; 
00077     double heating_COP;             
00078     double cooling_COP;             
00079     double over_sizing_factor;      
00080 
00081     double volume;                  
00082     double air_mass;                
00083     double air_thermal_mass;        
00084     double solar_load;              
00085     double house_content_heat_transfer_coeff; 
00086     double COP_coeff;               
00087     double air_density;             
00088     double air_heat_capacity;       
00089     double house_content_thermal_mass; 
00090 
00091     double *pTout;
00092     double vTout;
00093     double *pRhout;
00094     double *pSolar;
00095 
00096     double Tair;
00097     double Tsolar;
00098     double Tmaterials;
00099 
00100     HCMODE heat_cool_mode;          
00101     double hvac_rated_power;
00102     double hvac_rated_capacity;
00103     double rated_heating_capacity;
00104     double rated_cooling_capacity;
00105 
00106     double total_internal_gain;
00107     double lights_heat_energy;
00108     double range_heat_energy;
00109     double occupantload_heat_energy;
00110     double plugload_heat_energy;
00111     double microwave_heat_energy;
00112     double dishwasher_heat_energy;
00113     double clotheswasher_heat_energy;
00114     double waterheater_heat_energy;
00115     double hvac_kWh_use;
00116     complex power_kw;
00117 
00118 private:
00119     double A11;
00120     double A12;
00121     double A21;
00122     double A22;
00123 
00124     double B11;
00125     double B12;
00126     double B21;
00127     double B22;
00128 
00129     double s1;
00130     double s2;
00131 
00132     double M_inv11;
00133     double M_inv12;
00134     double M_inv21;
00135     double M_inv22;
00136 
00137     double BB11;
00138     double BB21;
00139     double BB12;
00140     double BB22;
00141 
00142 public:
00143     static CLASS *oclass;
00144     static house *defaults;
00145     house( MODULE *module);
00146     ~house();
00147 
00148     int create();
00149     TIMESTAMP presync(TIMESTAMP t0, TIMESTAMP t1);
00150     TIMESTAMP sync(TIMESTAMP t0, TIMESTAMP t1);
00151     TIMESTAMP sync_hvac_load(TIMESTAMP t0, double nHours);
00152     int init(OBJECT *parent);
00153     int init_climate(void);
00154 
00155     CIRCUIT *attach(OBJECT *obj, double limit, int is220=false);
00156     TIMESTAMP thermostat(TIMESTAMP t0, TIMESTAMP t1);
00157 
00158 // access methods
00159 public:
00160     double get_floor_area () { return floor_area; };
00161     double get_Tout () { return *pTout; };
00162     double get_Tair () { return Tair; };
00163     double get_Tsolar(int hour, int month, double Tair, double Tout);
00164     int set_Eigen_values();
00165     complex *get_complex(OBJECT *obj, char *name);
00166 };
00167 
00168 #endif
00169 

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