core/cmex.h

00001 // etp.h
00002 //
00003 // Equivalent Thermal Parameters
00004 // Concept by Rob G. Pratt
00005 //
00006 // Nov 26 2002
00007 // DP Chassin
00008 //
00009 // Copyright (C) 2002
00010 // Pacific Northwest National Laboratory
00011 //
00012 // This work was completed under FY03 LDRD
00013 // Cost account #: K38478
00014 //
00015 
00016 #ifndef _ETP_H
00017 #define _ETP_H
00018 
00019 #ifdef WIN32
00020 // this is ok
00021 #define BINDIR "\\bin\\win32\\"
00022 #define ETPDIR "\\toolbox\\etp\\"
00023 #define EXEFORMAT "%s\\%s.exe"
00024 #else
00025 #error only WIN32 is supported
00026 #endif
00027 
00028 // maximum size of a string passed in from MATLAB
00029 #define MAXNAME 32
00030 
00031 #ifdef DEBUG_TRACE
00032 #include <stdio.h>
00033 #define TRACE(M) mexPrintf(M);
00034 #define TRACE1(M,A) mexPrintf(M,A);
00035 #define TRACE2(M,A,B) mexPrintf(M,A,B);
00036 #define TRACE2(M,A,B) mexPrintf(M,A,B);
00037 #define TRACE3(M,A,B,C) mexPrintf(M,A,B,C);
00038 #else
00039 #define TRACE(M)
00040 #define TRACE1(M,A)
00041 #define TRACE2(M,A,B)
00042 #define TRACE3(M,A,B,C)
00043 #endif
00044 
00045 // useful constants
00046 #define RHOWATER    (61.82)         // lb/cf
00047 #define CFPGAL      (0.133681)      // cf/gal
00048 #define CWATER      (0.9994)        // BTU/lb/F
00049 #define BTUPHPW     (3.4120)        // BTUPH/W
00050 #define MWPBTUPH    (1e-6/BTUPHPW)  // MW/BTUPH
00051 
00052 // random distribution functions
00053 #define RANDU(L,H) (((double)rand()/(double)RAND_MAX)*((H)-(L))+(L))
00054 
00055 // approximate tests
00056 #define AEQ(A,B,C) (fabs(A-B)<C)
00057 #define ANE(A,B,C) (fabs(A-B)>=C)
00058 #define ALT(A,B,C) (A<=B+C)
00059 #define AGT(A,B,C) (A>=B-C)
00060 
00061 #define MAX(A,B) ((A)>(B)?(A):(B))
00062 #define MIN(A,B) ((A)<(B)?(A):(B))
00063 
00064 typedef struct
00065 {
00066     double *data;
00067     double time;
00068     double value;
00069 } EVENT;
00070 
00071 typedef enum {INTEGER, REAL} PROPERTYTYPE;
00072 typedef struct {
00073     PROPERTYTYPE type;
00074     union {
00075         double *real;
00076         int *integer;
00077         void *addr;
00078     };
00079     int limit;
00080 } PROPERTY;
00081 
00082 #include "market.h"
00083 #include "house.h"
00084 #include "solvers.h"
00085 
00086 #endif

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