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 "line.h"
00018
00019 CLASS* line_spacing::oclass = NULL;
00020 CLASS* line_spacing::pclass = NULL;
00021
00022 line_spacing::line_spacing(MODULE *mod) : powerflow_library(mod)
00023 {
00024 if(oclass == NULL)
00025 {
00026 oclass = gl_register_class(mod,"line_spacing",sizeof(line_spacing),0x00);
00027 if (oclass==NULL)
00028 throw "unable to register class line_spacing";
00029 else
00030 oclass->trl = TRL_PROVEN;
00031
00032 if(gl_publish_variable(oclass,
00033 PT_double, "distance_AB[ft]",PADDR(distance_AtoB),
00034 PT_double, "distance_BC[ft]",PADDR(distance_BtoC),
00035 PT_double, "distance_AC[ft]",PADDR(distance_AtoC),
00036 PT_double, "distance_AN[ft]",PADDR(distance_AtoN),
00037 PT_double, "distance_BN[ft]",PADDR(distance_BtoN),
00038 PT_double, "distance_CN[ft]",PADDR(distance_CtoN),
00039 PT_double, "distance_AE[ft]",PADDR(distance_AtoE), PT_DESCRIPTION, "distance between phase A wire and earth",
00040 PT_double, "distance_BE[ft]",PADDR(distance_BtoE), PT_DESCRIPTION, "distance between phase B wire and earth",
00041 PT_double, "distance_CE[ft]",PADDR(distance_CtoE), PT_DESCRIPTION, "distance between phase C wire and earth",
00042 PT_double, "distance_NE[ft]",PADDR(distance_NtoE), PT_DESCRIPTION, "distance between neutral wire and earth",
00043 NULL) < 1) GL_THROW("unable to publish line_spacing properties in %s",__FILE__);
00044 }
00045 }
00046
00047 int line_spacing::create()
00048 {
00049
00050 distance_AtoB = 0.0;
00051 distance_BtoC = 0.0;
00052 distance_AtoC = 0.0;
00053 distance_AtoN = 0.0;
00054 distance_BtoN = 0.0;
00055 distance_CtoN = 0.0;
00056
00057 distance_AtoE = 0.0;
00058 distance_BtoE = 0.0;
00059 distance_CtoE = 0.0;
00060 distance_NtoE = 0.0;
00061
00062 return 1;
00063 }
00064
00065 int line_spacing::isa(char *classname)
00066 {
00067 return strcmp(classname,"line_spacing")==0;
00068 }
00069
00071
00073
00081 EXPORT int create_line_spacing(OBJECT **obj, OBJECT *parent)
00082 {
00083 try
00084 {
00085 *obj = gl_create_object(line_spacing::oclass);
00086 if (*obj!=NULL)
00087 {
00088 line_spacing *my = OBJECTDATA(*obj,line_spacing);
00089 gl_set_parent(*obj,parent);
00090 return my->create();
00091 }
00092 else
00093 return 0;
00094 }
00095 CREATE_CATCHALL(line_spacing);
00096 }
00097 EXPORT TIMESTAMP sync_line_spacing(OBJECT *obj, TIMESTAMP t1, PASSCONFIG pass)
00098 {
00099 return TS_NEVER;
00100 }
00101
00102 EXPORT int isa_line_spacing(OBJECT *obj, char *classname)
00103 {
00104 return strcmp(classname,"line_spacing") == 0;
00105 }
00106