00001
00007 #ifndef _PW_RECORDER_H_
00008 #define _PW_RECORDER_H_
00009
00010 #include "gridlabd.h"
00011 #include "network.h"
00012 #include "pw_model.h"
00013
00014 #ifdef HAVE_POWERWORLD
00015 #ifndef PWX64
00016
00017 #ifdef int64
00018 #undef int64
00019 #endif
00020
00021 #include <WTypes.h>
00022 #include <comutil.h>
00023
00024
00025 #ifndef int64
00026 #ifdef WIN32
00027 #define int64 __int64
00028 #endif
00029 #endif
00030
00031
00032 class pw_recorder : public gld_object {
00033 public:
00034 pw_recorder(MODULE *module);
00035
00036 static CLASS *oclass;
00037 static pw_recorder *defaults;
00038 int create();
00039 int init(OBJECT *parent);
00040 int precommit(TIMESTAMP t1);
00041 TIMESTAMP presync(TIMESTAMP t1);
00042 TIMESTAMP sync(TIMESTAMP t1);
00043 TIMESTAMP postsync(TIMESTAMP t1);
00044 TIMESTAMP commit(TIMESTAMP t1, TIMESTAMP t2);
00045 int isa(char *classname);
00046
00047 int build_keys();
00048 int get_pw_values();
00049 int GPSE();
00050 int write_header();
00051 int write_line(TIMESTAMP t1);
00052
00053 public:
00054 GL_ATOMIC(OBJECT *, model);
00055 GL_STRING(char1024, outfile_name);
00056 GL_STRING(char256, obj_classname);
00057 GL_STRING(char1024, key_strings);
00058 GL_STRING(char1024, key_values);
00059 GL_STRING(char1024, properties);
00060 GL_STRING(char1024, line_output);
00061 GL_ATOMIC(int64, interval);
00062 GL_ATOMIC(int64, limit);
00063 private:
00064
00065 char1024 last_line_output;
00066 int64 last_write;
00067 int write_ct;
00068 bool interval_write;
00069 pw_model *cModel;
00070 FILE *outfile;
00071 int key_count;
00072 int prop_count;
00073 char1024 key_strings_copy, key_values_copy, props_copy;
00074 BSTR type_bstr;
00075 SAFEARRAYBOUND bounds[1];
00076 _variant_t fields, values;
00077 char **out_values;
00078 bool is_ready;
00079 };
00080 #endif //PWX64
00081 #endif //HAVE_POWERWORLD
00082 #endif // _PW_RECORDER_H_