00001
00009 #ifndef _HOUSE_H
00010 #define _HOUSE_H
00011
00012 #include "gridlabd.h"
00013
00014 class multizone;
00015
00016
00017 typedef struct s_endusex {
00018 double power_factor;
00019 complex energy;
00020 complex power;
00021 complex demand;
00022 complex constant_power;
00023 complex constant_current;
00024 complex constant_admittance;
00025 double heatgain;
00026 double heatgain_fraction;
00027 } ENDUSE;
00028
00029
00030
00031
00032
00033 typedef enum {
00034 HC_OFF,
00035 HC_HEAT,
00036 HC_AUX,
00037 HC_COOL,
00038 HC_ECON,
00039 HC_VENT,
00040 } HCMODE;
00041
00042
00043 typedef struct s_hvacdesign {
00044 double design_temperature;
00045 double balance_temperature;
00046 double efficiency;
00047 double cop;
00048 double capacity;
00049 double capacity_perF;
00050 } HVACDESIGN;
00051
00052
00053 typedef struct s_hvac {
00054 ENDUSE enduse;
00055 HCMODE mode;
00056 HVACDESIGN cooling;
00057 HVACDESIGN heating;
00058 double minimum_ach;
00059 } HVAC;
00060
00061
00062
00063
00064 typedef struct s_lighting {
00065 ENDUSE enduse;
00066 double capacity;
00067 double fraction;
00068 } LIGHTS;
00069
00070
00071
00072
00073 typedef struct s_plugs {
00074 ENDUSE enduse;
00075 double capacity;
00076 double fraction;
00077 } PLUGS;
00078
00079
00080
00081
00082 typedef struct s_conditions {
00083 double *pTemperature;
00084 double *pHumidity;
00085 double *pSolar;
00086 double out_temp;
00087 double air_temperature;
00088 double mass_temperature;
00089 double occupancy;
00090 double temperature_change;
00091 } CONDITIONS;
00092
00093
00094
00095
00096 typedef struct s_controls {
00097 double cooling_setpoint;
00098 double economizer_cutin;
00099 double heating_setpoint;
00100 double auxiliary_cutin;
00101 double setpoint_deadband;
00102 double ventilation_fraction;
00103 double lighting_fraction;
00104 } CONTROLS;
00105
00106
00107
00108
00109 typedef struct s_zonedata {
00110 struct {
00111 double floor_area;
00112 double floor_height;
00113 double exterior_ua;
00114 double interior_ua;
00115 double interior_mass;
00116 double window_area[9];
00117 double glazing_coeff;
00118 double occupants;
00119 char256 schedule;
00120 } design;
00121 HVAC hvac;
00122 LIGHTS lights;
00123 PLUGS plugs;
00124 ENDUSE total;
00125 CONDITIONS current;
00126 CONTROLS control;
00127 } ZONEDATA;
00128
00129 class office {
00130 public:
00131 static double warn_low_temp;
00132 static double warn_high_temp;
00133 static bool warn_control;
00134 public:
00135
00136 #define SET_OCCUPIED(D,H) (occupied[H]|=(1<<D))
00137 #define CLR_OCCUPIED(D,H) (occupied[H]&=~(1<<D))
00138 #define IS_OCCUPIED(D,H) ((occupied[H]&(1<<D))?1:0)
00139 char occupied[24];
00140 complex *pVoltage;
00141 complex *pCurrent;
00142 ZONEDATA zone;
00143 private:
00144 double TcoolOn, TcoolOff;
00145 double TheatOn, TheatOff;
00146 double cop;
00147 double Qi, Qh, Qs, Qz;
00148 double Teq, Tevent;
00149 double r1, r2, k1, k2;
00150 double c1, c2, c3, c4, c5, c6, c7, dTi;
00151 void update_control_setpoints();
00152 TIMESTAMP update_lighting(TIMESTAMP t0,TIMESTAMP t1);
00153 TIMESTAMP update_plugs(TIMESTAMP t0,TIMESTAMP t1);
00154 double update_hvac();
00155 public:
00156 static CLASS *oclass;
00157 static office *defaults;
00158 office(MODULE *module);
00159 int create();
00160 int init(OBJECT *parent);
00161 TIMESTAMP presync(TIMESTAMP t0, TIMESTAMP t1);
00162 TIMESTAMP sync(TIMESTAMP t0, TIMESTAMP t1);
00163 TIMESTAMP postsync(TIMESTAMP t0, TIMESTAMP t1);
00164 TIMESTAMP plc(TIMESTAMP t0, TIMESTAMP t1);
00165
00166 friend class multizone;
00167 };
00168
00169 #endif
00170