00001
00002
00003
00004
00005
00006 #ifndef _RESIDENTIAL_H
00007 #define _RESIDENTIAL_H
00008
00009 #include "gridlabd.h"
00010 #include "module.h"
00011
00012 #ifdef _RESIDENTIAL_CPP
00013 #define GLOBAL
00014 #define INIT(A) = (A)
00015 #else
00016 #define GLOBAL extern
00017 #define INIT(A)
00018 #endif
00019
00020
00021 #define RHOWATER (62.4) // lb/cf
00022 #define CFPGAL (0.133681) // cf/gal
00023 #define GALPCF (7.4805195) // gal/cf
00024 #define CWATER (0.9994) // BTU/lb/F
00025 #define BTUPHPW (3.4120) // BTUPH/W
00026 #define BTUPHPKW (1e3 * 3.4120) // BTUPH/kW
00027 #define KWPBTUPH (1e-3/BTUPHPW) // kW/BTUPH
00028 #define MWPBTUPH (1e-6/BTUPHPW) // MW/BTUPH
00029 #define ROUNDOFF 1e-6 // numerical accuracy for zero in float comparisons
00030
00031 const double pi = 3.1415926535897931;
00032 const double Cp = 1;
00033 #define TSNVRDBL 9223372036854775808.0 //TS_NEVER in double form - for deltamode
00034
00035
00036 #define AEQ(A,B,C) (fabs(A-B)<C)
00037 #define ANE(A,B,C) (fabs(A-B)>=C)
00038 #define ALT(A,B,C) (A<=B+C)
00039 #define AGT(Ak,B,C) (A>=B-C)
00040
00041 #define MAX(A,B) ((A)>(B)?(A):(B))
00042 #define MIN(A,B) ((A)<(B)?(A):(B))
00043
00044 typedef enum { BRK_OPEN=0,
00045 BRK_CLOSED=1,
00046 BRK_FAULT=-1,
00047 } BREAKERSTATUS;
00048 typedef enum { X12=0,
00049 X23=1,
00050 X13=2,
00051 } CIRCUITTYPE;
00052
00053 typedef struct s_circuit {
00054 CIRCUITTYPE type;
00055 enduse *pLoad;
00056 gld_property *pfrequency;
00057 gld_property *pV;
00058 double max_amps;
00059 int id;
00060 BREAKERSTATUS status;
00061 TIMESTAMP reclose;
00062 unsigned short tripsleft;
00063 struct s_circuit *next;
00064
00065 } CIRCUIT;
00066
00067 typedef struct s_panel {
00068 double max_amps;
00069 BREAKERSTATUS status;
00070 TIMESTAMP reclose;
00071 CIRCUIT *circuits;
00072 } PANEL;
00073
00074 typedef CIRCUIT *(*ATTACHFUNCTION)(OBJECT *, enduse *, double , int is220);
00075
00076 typedef enum {HORIZONTAL, NORTH, NORTH_EAST, EAST, SOUTH_EAST, SOUTH, SOUTH_WEST, WEST, NORTH_WEST,N_SOLAR_SURFACES} ORIENTATION;
00077
00078
00079 GLOBAL double default_line_voltage INIT(120.0);
00080 GLOBAL bool ANSI_voltage_check INIT(true);
00081 GLOBAL double default_outdoor_temperature INIT(74.0);
00082 GLOBAL double default_humidity INIT(75.0);
00083 GLOBAL int64 default_etp_iterations INIT(100);
00084 GLOBAL double default_horizontal_solar INIT(0.0);
00085 GLOBAL double default_grid_frequency INIT(60.0);
00086
00087
00088 GLOBAL bool enable_subsecond_models INIT(false);
00089 GLOBAL bool all_house_delta INIT(false);
00090 GLOBAL double deltamode_timestep_publish INIT(10000000.0);
00091 GLOBAL unsigned long deltamode_timestep INIT(10000000);
00092 GLOBAL OBJECT **delta_objects INIT(NULL);
00093 GLOBAL FUNCTIONADDR *delta_functions INIT(NULL);
00094 GLOBAL FUNCTIONADDR *post_delta_functions INIT(NULL);
00095 GLOBAL int res_object_count INIT(0);
00096 GLOBAL int res_object_current INIT(-1);
00097 GLOBAL TIMESTAMP deltamode_starttime INIT(TS_NEVER);
00098
00099
00100 void schedule_deltamode_start(TIMESTAMP tstart);
00101 void allocate_deltamode_arrays(void);
00102
00103
00104 #endif
00105