00001
00009 #include <stdlib.h>
00010 #include <stdio.h>
00011 #include <errno.h>
00012 #include <math.h>
00013 #include <iostream>
00014 using namespace std;
00015
00016 #include "line.h"
00017
00018 CLASS* triplex_line_configuration::oclass = NULL;
00019 CLASS* triplex_line_configuration::pclass = NULL;
00020 triplex_line_configuration *triplex_line_configuration::defaults = NULL;
00021
00022 triplex_line_configuration::triplex_line_configuration(MODULE *mod) : line_configuration(mod)
00023 {
00024 if(oclass == NULL)
00025 {
00026 pclass = line_configuration::oclass;
00027
00028 oclass = gl_register_class(mod,"triplex_line_configuration",0x00);
00029 if(oclass == NULL)
00030 GL_THROW("unable to register object class implemented by %s",__FILE__);
00031
00032 if(gl_publish_variable(oclass,
00033 PT_object, "l1_conductor",PADDR(phaseA_conductor),
00034 PT_object, "l2_conductor",PADDR(phaseB_conductor),
00035 PT_object, "lN_conductor",PADDR(phaseC_conductor),
00036 PT_double, "insulation_thickness", PADDR(ins_thickness),
00037 PT_double, "diameter",PADDR(diameter),
00038 PT_object, "line_spacing",PADDR(line_spacing),
00039 NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__);
00040
00041
00042 defaults = this;
00043 phaseA_conductor = NULL;
00044 phaseB_conductor = NULL;
00045 phaseC_conductor = NULL;
00046 phaseN_conductor = NULL;
00047 ins_thickness = 0.0;
00048 diameter = 0.0;
00049 line_spacing = NULL;
00050 }
00051 }
00052
00053 int triplex_line_configuration::create(void)
00054 {
00055 int result = line_configuration::create();
00056 memcpy(this,defaults,sizeof(triplex_line_configuration));
00057 return result;
00058 }
00059
00060 int triplex_line_configuration::isa(char *classname)
00061 {
00062 return strcmp(classname,"triplex_line_configuration")==0 || line_configuration::isa(classname);
00063 }
00065
00067
00075 EXPORT int create_triplex_line_configuration(OBJECT **obj, OBJECT *parent)
00076 {
00077 try
00078 {
00079 *obj = gl_create_object(triplex_line_configuration::oclass,sizeof(triplex_line_configuration));
00080 if (*obj!=NULL)
00081 {
00082 triplex_line_configuration *my = OBJECTDATA(*obj,triplex_line_configuration);
00083 gl_set_parent(*obj,parent);
00084 return my->create();
00085 }
00086 }
00087 catch (char *msg)
00088 {
00089 gl_error("create_triplex_line_configuration: %s", msg);
00090 }
00091 return 0;
00092 }
00093 EXPORT TIMESTAMP sync_triplex_line_configuration(OBJECT *obj, TIMESTAMP t1, PASSCONFIG pass)
00094 {
00095 return TS_NEVER;
00096 }
00097
00098 EXPORT int isa_triplex_line_configuration(OBJECT *obj, char *classname)
00099 {
00100 return OBJECTDATA(obj,triplex_line_configuration)->isa(classname);
00101 }
00102