00001
00010 #ifndef _HOUSE_E_H
00011 #define _HOUSE_E_H
00012
00013 #include "residential.h"
00014 #include "complex.h"
00015 #include "enduse.h"
00016 #include "loadshape.h"
00017 #include "residential_enduse.h"
00018
00019 typedef struct s_implicit_enduse {
00020 enduse load;
00021 double amps;
00022 int is220;
00023 struct s_implicit_enduse *next;
00024 } IMPLICITENDUSE;
00025
00026 typedef enum {
00027
00028 IEU_LIGHTS = 0x00000001,
00029 IEU_PLUGS = 0x00000002,
00030 IEU_OCCUPANCY = 0x00000004,
00031
00032
00033 IEU_DISHWASHER = 0x00000100,
00034 IEU_MICROWAVE = 0x00000200,
00035
00036
00037 IEU_FREEZER = 0x00010000,
00038 IEU_REFRIGERATOR = 0x00020000,
00039 IEU_RANGE = 0x00040000,
00040 IEU_EVCHARGER = 0x00080000,
00041 IEU_WATERHEATER = 0x00100000,
00042
00043
00044 IEU_CLOTHESWASHER = 0x01000000,
00045 IEU_DRYER = 0x02000000,
00046
00048 IEU_ALL = 0x03170303,
00049 } IMPLICITENDUSEFLAGS;
00050
00051 typedef enum {
00052 IES_ELCAP1990 = 0,
00053 IES_ELCAP2010 = 1,
00054 IES_RBSA2014 = 2,
00055 } IMPLICITENDUSESOURCE;
00056
00057
00058 #define NO_SOLAR 0x0000
00059 #define HORIZONTAL 0x0001
00060 #define NORTH 0x0002
00061 #define EAST 0x0004
00062 #define SOUTH 0x0008
00063 #define WEST 0x0010
00064
00065 EXPORT SIMULATIONMODE interupdate_house_e(OBJECT *obj, unsigned int64 delta_time, unsigned long dt, unsigned int iteration_count_val);
00066 EXPORT STATUS postupdate_house_e(OBJECT *obj);
00067
00068 class house_e : public residential_enduse {
00069 public:
00070 object weather;
00071 PANEL panel;
00072
00073
00074 IMPLICITENDUSE *implicit_enduse_list;
00075 static set implicit_enduses_active;
00076 static enumeration implicit_enduse_source;
00077 public:
00078
00079 double floor_area;
00080 double envelope_UA;
00081 double number_of_doors;
00082 double area_per_door;
00083 double total_door_area;
00084 double total_wall_area;
00085 double gross_wall_area;
00086 double ceiling_height;
00087 double interior_exterior_wall_ratio;
00088 double exterior_wall_fraction;
00089 double exterior_ceiling_fraction;
00090 double exterior_floor_fraction;
00091 double aspect_ratio;
00092 double solar_aperture[N_SOLAR_SURFACES];
00093 double house_content_heat_transfer_coeff;
00094 double air_density;
00095 double air_heat_capacity;
00096 double house_content_thermal_mass;
00097 double total_thermal_mass_per_floor_area;
00098 double interior_surface_heat_transfer_coeff;
00099 double air_heat_fraction;
00100 double mass_solar_gain_fraction;
00101 double mass_internal_gain_fraction;
00102 double number_of_stories;
00103
00104
00105 set include_solar_quadrant;
00106 typedef enum {HC_DEFAULT=0, HC_FLAT=1, HC_LINEAR=2, HC_CURVED=3};
00107 enumeration heating_cop_curve;
00108 typedef enum {HP_DEFAULT=0, HP_FLAT=1, HP_LINEAR=2, HP_CURVED=3};
00109 enumeration heating_cap_curve;
00110 typedef enum {CC_DEFAULT=0, CC_FLAT=1, CC_LINEAR=2, CC_CURVED=3};
00111 enumeration cooling_cop_curve;
00112 typedef enum {CP_DEFAULT=0, CP_FLAT=1, CP_LINEAR=2, CP_CURVED=3};
00113 enumeration cooling_cap_curve;
00114 bool use_latent_heat;
00115 bool include_fan_heatgain;
00116 double fan_heatgain_fraction;
00117 double horizontal_diffuse_solar_radiation;
00118 double north_incident_solar_radiation;
00119 double north_west_incident_solar_radiation;
00120 double west_incident_solar_radiation;
00121 double south_west_incident_solar_radiation;
00122 double south_incident_solar_radiation;
00123 double south_east_incident_solar_radiation;
00124 double east_incident_solar_radiation;
00125 double north_east_incident_solar_radiation;
00126
00127
00128 double glazing_shgc;
00129 double window_wall_ratio;
00130 double window_roof_ratio;
00131 double total_window_area;
00132 double window_exterior_transmission_coefficient;
00133 double solar_heatgain_factor;
00134
00135
00136 bool window_openings;
00137 double window_open;
00138 double window_low_temp;
00139 double window_high_temp;
00140 double window_a;
00141 double window_b;
00142 double window_c;
00143 double window_temp_delta;
00144 double last_temperature;
00145 int window_first_time_through;
00146
00147
00148
00149 double thermostat_deadband;
00150 int16 thermostat_cycle_time;
00151 int16 thermostat_off_cycle_time;
00152 int16 thermostat_on_cycle_time;
00153 TIMESTAMP thermostat_last_cycle_time;
00154 TIMESTAMP thermostat_last_off_cycle_time;
00155 TIMESTAMP thermostat_last_on_cycle_time;
00156 double heating_setpoint;
00157 double cooling_setpoint;
00158 double dlc_offset;
00159
00160
00161 typedef enum {TC_FULL=0, TC_BAND=1, TC_NONE=2};
00162 enumeration thermostat_control;
00163 double TcoolOn;
00164 double TcoolOff;
00165 double TheatOn;
00166 double TheatOff;
00167 double TauxOn;
00168
00169
00170 double design_heating_setpoint;
00171 double design_cooling_setpoint;
00172 double design_heating_capacity;
00173 double design_cooling_capacity;
00174 double heating_COP;
00175 double cooling_COP;
00176
00177 double over_sizing_factor;
00178 double rated_heating_capacity;
00179 double rated_cooling_capacity;
00180 double hvac_breaker_rating;
00181 double hvac_power_factor;
00182
00183 double aux_heat_capacity;
00184 double aux_heat_deadband;
00185 double aux_heat_temp_lockout;
00186 double aux_heat_time_delay;
00187
00188 double fan_design_power;
00189 double fan_low_power_fraction;
00190 double fan_power;
00191 double fan_design_airflow;
00192
00194 double fan_impedance_fraction;
00195 double fan_current_fraction;
00196 double fan_power_fraction;
00197 double fan_power_factor;
00198
00199 double duct_pressure_drop;
00200 double cooling_supply_air_temp;
00201 double heating_supply_air_temp;
00202
00203 double airchange_per_hour;
00204 double airchange_UA;
00205 double UA;
00206 double latent_load_fraction;
00207
00208
00209 double system_rated_power;
00210 double system_rated_capacity;
00211 complex hvac_power;
00212
00213
00214 double hvac_load;
00215 double total_load;
00216 enduse total;
00217 double heating_demand;
00218 double cooling_demand;
00219 double last_heating_load;
00220 double last_cooling_load;
00221 bool compressor_on;
00222 int64 compressor_count;
00223
00224
00225 TIMESTAMP hvac_last_on;
00226 TIMESTAMP hvac_last_off;
00227 double hvac_period_on;
00228 double hvac_period_off;
00229 double hvac_period_length;
00230 double hvac_duty_cycle;
00231
00232
00233 bool thermal_storage_present;
00234 bool thermal_storage_inuse;
00235
00236 typedef enum {
00237 ST_NONE = 0x00000000,
00238 ST_GAS = 0x00000001,
00239 ST_AC = 0x00000002,
00240 ST_AIR = 0x00000004,
00241 ST_VAR = 0x00000008,
00242 ST_RST = 0x00000010,
00243 } SYSTEMTYPE;
00244 set system_type;
00245
00246
00247 typedef enum {
00248 AX_NONE = 0x0,
00249 AX_DEADBAND = 0x1,
00250 AX_TIMER = 0x2,
00251 AX_LOCKOUT = 0x4,
00252 } AUXSTRATEGY;
00253 set auxiliary_strategy;
00254
00255 typedef enum{
00256 AT_UNKNOWN = 0,
00257 AT_NONE = 1,
00258 AT_ELECTRIC = 2,
00259 } AUXILIARYSYSTEMTYPE;
00260 enumeration auxiliary_system_type;
00261
00262 typedef enum{
00263 HT_UNKNOWN = 0,
00264 HT_NONE = 1,
00265 HT_GAS = 2,
00266 HT_HEAT_PUMP = 3,
00267 HT_RESISTANCE = 4,
00268 } HEATSYSTEMTYPE;
00269 enumeration heating_system_type;
00270
00271 typedef enum {
00272 CT_UNKNOWN = 0,
00273 CT_NONE = 1,
00274 CT_ELECTRIC = 2,
00275 } COOLSYSTEMTYPE;
00276 enumeration cooling_system_type;
00277
00278 typedef enum {
00279 FT_UNKNOWN = 0,
00280 FT_NONE = 1,
00281 FT_ONE_SPEED = 2,
00282 FT_TWO_SPEED = 3,
00283 } FANTYPE;
00284 enumeration fan_type;
00285
00286 typedef enum {
00287 GM_OTHER = 0,
00288 GM_GLASS = 1,
00289 GM_LOW_E_GLASS = 2,
00290 } GLASSTYPE;
00291 enumeration glass_type;
00292
00293 typedef enum {
00294 WF_NONE = 0,
00295 WF_ALUMINUM = 1,
00296 WF_THERMAL_BREAK = 2,
00297 WF_WOOD = 3,
00298 WF_INSULATED = 4,
00299 } WINDOWFRAME;
00300 enumeration window_frame;
00301
00302 typedef enum {
00303 GT_OTHER = 0,
00304 GT_CLEAR = 1,
00305 GT_ABS = 2,
00306 GT_REFL = 3,
00307 GT_LOW_S = 4,
00308 GT_HIGH_S = 5,
00309 } GLAZINGTREATMENT;
00310 enumeration glazing_treatment;
00311
00312 typedef enum {
00313 GL_ONE=1,
00314 GL_TWO=2,
00315 GL_THREE=3,
00316 GL_OTHER,
00317 } GLAZINGLAYERS;
00318 enumeration glazing_layers;
00319
00320 typedef enum {
00321 TI_VERY_LITTLE =0,
00322 TI_LITTLE =1,
00323 TI_BELOW_NORMAL =2,
00324 TI_NORMAL =3,
00325 TI_ABOVE_NORMAL =4,
00326 TI_GOOD =5,
00327 TI_VERY_GOOD =6,
00328 TI_UNKNOWN =7
00329 } THERMAL_INTEGRITY;
00330 enumeration thermal_integrity_level;
00331
00332 typedef enum {
00333 MM_NONE = 0,
00334 MM_BASIC = 1,
00335 MM_FULL = 2
00336 } MOTORMODEL;
00337 enumeration motor_model;
00338
00339
00340 double hvac_motor_efficiency;
00341 double hvac_motor_loss_power_factor;
00342 double hvac_motor_real_loss;
00343 double hvac_motor_reactive_loss;
00344 typedef enum {
00345 ME_VERY_POOR = 0,
00346 ME_POOR = 1,
00347 ME_AVERAGE = 2,
00348 ME_GOOD = 3,
00349 ME_VERY_GOOD = 4,
00350 } MOTOREFFICIENCY;
00351 enumeration motor_efficiency;
00352
00353 typedef enum {
00354 SM_UNKNOWN =0,
00355 SM_OFF =1,
00356 SM_HEAT =2,
00357 SM_AUX =3,
00358 SM_COOL =4,
00359 } SYSTEMMODE;
00360 enumeration system_mode,
00361 last_system_mode;
00362 int64 last_mode_timer;
00363
00364
00365 double volume;
00366 double air_mass;
00367 double air_thermal_mass;
00368 double solar_load;
00369
00370
00371
00372
00373
00374 double cooling_design_temperature;
00375 double heating_design_temperature;
00376 double design_peak_solar;
00377 double design_internal_gains;
00378 double design_internal_gain_density;
00379
00380 double Rroof;
00381 double Rwall;
00382 double Rfloor;
00383 double Rwindows;
00384 double Rdoors;
00385
00386 double incident_solar_radiation;
00387
00388 double Tair;
00389 double Tmaterials;
00390 double outside_temperature;
00391 double outdoor_rh;
00392
00393 double is_AUX_on,is_HEAT_on,is_COOL_on;
00394
00395 typedef enum {
00396 TM_OFF = 0,
00397 TM_AUTO = 1,
00398 TM_HEAT = 2,
00399 TM_COOL = 3,
00400 }THERMOSTATMODE;
00401 enumeration thermostat_mode;
00402
00403 private:
00404 TIMESTAMP simulation_beginning_time;
00405 void set_thermal_integrity();
00406 void set_window_shgc();
00407 void set_window_Rvalue();
00408
00409 double dTair;
00410 double a,b,c,d,c1,c2,A3,A4,k1,k2,r1,r2,Teq,Tevent,Qi,Qa,Qm,adj_cooling_cap,adj_heating_cap,adj_cooling_cop,adj_heating_cop;
00411 double Qlatent;
00412 static bool warn_control;
00413 static double warn_low_temp;
00414 static double warn_high_temp;
00415 static double system_dwell_time;
00416 bool check_start;
00417 bool heat_start;
00418
00419 bool deltamode_inclusive;
00420 bool deltamode_registered;
00421 bool proper_meter_parent;
00422 bool proper_climate_found;
00423
00424
00425 gld_property *pCircuit_V[3];
00426 gld_property *pLine_I[3];
00427 gld_property *pShunt[3];
00428 gld_property *pPower[3];
00429 gld_property *pMeterStatus;
00430 gld_property *pFrequency;
00431
00432
00433 complex value_Circuit_V[3];
00434 complex value_Line_I[3];
00435 complex value_Shunt[3];
00436 complex value_Power[3];
00437 enumeration value_MeterStatus;
00438 double value_Frequency;
00439
00440
00441 gld_property *pTout;
00442 gld_property *pRhout;
00443 gld_property *pSolar[9];
00444
00445
00446 double value_Tout;
00447 double value_Rhout;
00448 double value_Solar[9];
00449
00450 public:
00451 int error_flag;
00452 static CLASS *oclass, *pclass;
00453 house_e( MODULE *module);
00454 ~house_e();
00455
00456 int create();
00457 TIMESTAMP presync(TIMESTAMP t0, TIMESTAMP t1);
00458 TIMESTAMP sync(TIMESTAMP t0, TIMESTAMP t1);
00459 TIMESTAMP postsync(TIMESTAMP t0, TIMESTAMP t1);
00460 TIMESTAMP sync_billing(TIMESTAMP t0, TIMESTAMP t1);
00461 TIMESTAMP sync_thermostat(TIMESTAMP t0, TIMESTAMP t1);
00462 TIMESTAMP sync_panel(TIMESTAMP t0, TIMESTAMP t1);
00463 TIMESTAMP sync_enduses(TIMESTAMP t0, TIMESTAMP t1);
00464 void update_system(double dt=0);
00465 void update_model(double dt=0);
00466 void check_controls(void);
00467 void update_Tevent(void);
00468
00469 int init(OBJECT *parent);
00470 int init_climate(void);
00471 int isa(char *classname);
00472
00473 CIRCUIT *attach(OBJECT *obj, double limit, int is220=false, enduse *pEnduse=NULL);
00474 void attach_implicit_enduses(void);
00475
00476 SIMULATIONMODE inter_deltaupdate(unsigned int64 delta_time, unsigned long dt, unsigned int iteration_count_val);
00477 STATUS post_deltaupdate(void);
00478
00479
00480 public:
00481
00482 gld_property *map_complex_value(OBJECT *obj, char *name);
00483 gld_property *map_double_value(OBJECT *obj, char *name);
00484 void pull_complex_powerflow_values(void);
00485 void pull_climate_values(void);
00486 void push_complex_powerflow_values(void);
00487 };
00488
00489 #endif
00490