00001
00010 #include <stdlib.h>
00011 #include <stdio.h>
00012 #include <errno.h>
00013 #include <math.h>
00014 #include <iostream>
00015 using namespace std;
00016
00017 #include "regulator.h"
00018 #include "node.h"
00019
00021
00023
00024 CLASS* regulator_configuration::oclass = NULL;
00025 CLASS* regulator_configuration::pclass = NULL;
00026 regulator_configuration *regulator_configuration::defaults = NULL;
00027
00028 regulator_configuration::regulator_configuration(MODULE *mod)
00029 {
00030 if (oclass==NULL)
00031 {
00032
00033 oclass = gl_register_class(mod,"regulator_configuration",0x00);
00034 if (oclass==NULL)
00035 GL_THROW("unable to register object class implemented by %s",__FILE__);
00036
00037
00038 if (gl_publish_variable(oclass,
00039 PT_int16, "connect_type",PADDR(connect_type),
00040 PT_double, "band_center",PADDR(band_center),
00041 PT_double, "band_width",PADDR(band_width),
00042 PT_double, "time_delay",PADDR(time_delay),
00043 PT_int16, "raise_taps",PADDR(raise_taps),
00044 PT_int16, "lower_taps",PADDR(lower_taps),
00045 PT_double, "CT_ratio",PADDR(CT_ratio),
00046 PT_double, "PT_ratio",PADDR(PT_ratio),
00047 PT_double, "ldc_R_V",PADDR(ldc_R_V),
00048 PT_double, "ldc_X_V",PADDR(ldc_X_V),
00049 PT_set, "CT_phase",PADDR(CT_phase),
00050 PT_KEYWORD, "A",PHASE_A,
00051 PT_KEYWORD, "B",PHASE_B,
00052 PT_KEYWORD, "C",PHASE_C,
00053 PT_set, "PT_phase",PADDR(PT_phase),
00054 PT_KEYWORD, "A",PHASE_A,
00055 PT_KEYWORD, "B",PHASE_B,
00056 PT_KEYWORD, "C",PHASE_C,
00057 PT_double, "regulation",PADDR(regulation),
00058 PT_double, "V_high",PADDR(V_high),
00059 PT_int16, "tap_pos",PADDR(tap_pos),
00060 NULL)<1) GL_THROW("unable to publish properties in %s",__FILE__);
00061
00062
00063 defaults = this;
00064 memset(this,0,sizeof(regulator_configuration));
00065 }
00066 }
00067
00068 int regulator_configuration::isa(char *classname)
00069 {
00070 return strcmp(classname,"regulator_configuration")==0;
00071 }
00072
00073 int regulator_configuration::create(void)
00074 {
00075 memcpy(this,defaults,sizeof(regulator_configuration));
00076 band_center = 0.0;
00077 band_width = 0.0;
00078 time_delay = 0.0;
00079 raise_taps = 0;
00080 lower_taps = 0;
00081 CT_ratio = 0;
00082 PT_ratio = 0;
00083 ldc_R_V = 0.0;
00084 ldc_X_V = 0.0;
00085 CT_phase = PHASE_ABC;
00086 PT_phase = PHASE_ABC;
00087 regulation = 0.0;
00088 V_high = 0.0;
00089 tap_pos[0] = tap_pos[1] = tap_pos[2] = 0;
00090 return 1;
00091 }
00092
00094
00096
00104 EXPORT int create_regulator_configuration(OBJECT **obj, OBJECT *parent)
00105 {
00106 try
00107 {
00108 *obj = gl_create_object(regulator_configuration::oclass,sizeof(regulator_configuration));
00109 if (*obj!=NULL)
00110 {
00111 regulator_configuration *my = OBJECTDATA(*obj,regulator_configuration);
00112 gl_set_parent(*obj,parent);
00113 return my->create();
00114 }
00115 }
00116 catch (char *msg)
00117 {
00118 gl_error("create_regulator_configuration: %s", msg);
00119 }
00120 return 1;
00121 }
00122
00123 EXPORT TIMESTAMP sync_regulator_configuration(OBJECT *obj, TIMESTAMP t1, PASSCONFIG pass)
00124 {
00125 return TS_NEVER;
00126 }
00127
00128 EXPORT int isa_regulator_configuration(OBJECT *obj, char *classname)
00129 {
00130 return OBJECTDATA(obj,regulator_configuration)->isa(classname);
00131 }
00132