powerflow/line_spacing.cpp

Go to the documentation of this file.
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* line_spacing::oclass = NULL;
00019 CLASS* line_spacing::pclass = NULL;
00020 line_spacing  *line_spacing::defaults = NULL;
00021 
00022 line_spacing::line_spacing(MODULE *mod)
00023 {
00024     if(oclass == NULL)
00025     {
00026         oclass = gl_register_class(mod,"line_spacing",0x00);
00027         if(oclass == NULL)
00028             GL_THROW("unable to register line_spacing class implemented by %s",__FILE__);
00029         
00030         if(gl_publish_variable(oclass,
00031             PT_double, "distance_AtoB[ft]",PADDR(distance_AtoB),   
00032             PT_double, "distance_BtoC[ft]",PADDR(distance_BtoC),   
00033             PT_double, "distance_AtoC[ft]",PADDR(distance_AtoC),   
00034             PT_double, "distance_AtoN[ft]",PADDR(distance_AtoN),   
00035             PT_double, "distance_BtoN[ft]",PADDR(distance_BtoN),   
00036             PT_double, "distance_CtoN[ft]",PADDR(distance_CtoN),   
00037             NULL) < 1) GL_THROW("unable to publish line_spacing properties in %s",__FILE__);
00038         
00039         // Set up defaults
00040         defaults = this;
00041         distance_AtoB = 0.0;
00042         distance_BtoC = 0.0;
00043         distance_AtoC = 0.0;
00044         distance_AtoN = 0.0;
00045         distance_BtoN = 0.0;
00046         distance_CtoN = 0.0;
00047         
00048     }
00049 }
00050 
00051 int line_spacing::create()
00052 {
00053     memcpy(this,defaults,sizeof(line_spacing));
00054     return 1;
00055 }
00056 
00057 int line_spacing::isa(char *classname)
00058 {
00059     return strcmp(classname,"line_spacing")==0;
00060 }
00061 
00063 // IMPLEMENTATION OF CORE LINKAGE: line_spacing
00065 
00073 EXPORT int create_line_spacing(OBJECT **obj, OBJECT *parent)
00074 {
00075     try
00076     {
00077         *obj = gl_create_object(line_spacing::oclass,sizeof(line_spacing));
00078         if (*obj!=NULL)
00079         {
00080             line_spacing *my = OBJECTDATA(*obj,line_spacing);
00081             gl_set_parent(*obj,parent);
00082             return my->create();
00083         }
00084     }
00085     catch (char *msg)
00086     {
00087         gl_error("create_line_spacing: %s", msg);
00088     }
00089     return 1;
00090 }
00091 EXPORT TIMESTAMP sync_line_spacing(OBJECT *obj, TIMESTAMP t1, PASSCONFIG pass)
00092 {
00093     return TS_NEVER;
00094 }
00095 
00096 EXPORT int isa_line_spacing(OBJECT *obj, char *classname)
00097 {
00098     return strcmp(classname,"line_spacing") == 0;
00099 }
00100 

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