powerflow/line_configuration.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 
00020 // line_configuration CLASS FUNCTIONS
00022 
00023 CLASS* line_configuration::oclass = NULL;
00024 CLASS* line_configuration::pclass = NULL;
00025 line_configuration  *line_configuration::defaults = NULL;
00026 CLASS *line_configuration_class = NULL;
00027 
00028 line_configuration::line_configuration(MODULE *mod)
00029 {
00030     if(oclass == NULL)
00031     {
00032         line_configuration_class = oclass = gl_register_class(mod,"line_configuration",0x00);
00033         if(oclass == NULL)
00034             GL_THROW("unable to register line_configuration class implemented by %s",__FILE__);
00035         
00036         if(gl_publish_variable(oclass,
00037             PT_object, "phaseA_conductor",PADDR(phaseA_conductor),
00038             PT_object, "phaseB_conductor",PADDR(phaseB_conductor),
00039             PT_object, "phaseC_conductor",PADDR(phaseC_conductor),
00040             PT_object, "phaseN_conductor",PADDR(phaseN_conductor),
00041             PT_object, "line_spacing",PADDR(line_spacing),
00042             NULL) < 1) GL_THROW("unable to publish line_configuration properties in %s",__FILE__);
00043         
00044         // Set up defaults
00045         defaults = this;
00046         phaseA_conductor = NULL; 
00047         phaseB_conductor = NULL;
00048         phaseC_conductor = NULL;
00049         phaseN_conductor = NULL;
00050         line_spacing = NULL;
00051     }
00052 }
00053 
00054 int line_configuration::create(void)
00055 {
00056     memcpy(this,defaults,sizeof(line_configuration));
00057     return 1;
00058 }
00059 
00060 int line_configuration::isa(char *classname)
00061 {
00062     return strcmp(classname,"line_configuration")==0;
00063 }
00064 
00066 // IMPLEMENTATION OF CORE LINKAGE: line_configuration
00068 
00076 EXPORT int create_line_configuration(OBJECT **obj, OBJECT *parent)
00077 {
00078     try
00079     {
00080         *obj = gl_create_object(line_configuration::oclass,sizeof(line_configuration));
00081         if (*obj!=NULL)
00082         {
00083             line_configuration *my = OBJECTDATA(*obj,line_configuration);
00084             gl_set_parent(*obj,parent);
00085             return my->create();
00086         }
00087     }
00088     catch (char *msg)
00089     {
00090         gl_error("create_line_configuration: %s", msg);
00091     }
00092     return 1;
00093 }
00094 EXPORT TIMESTAMP sync_line_configuration(OBJECT *obj, TIMESTAMP t1, PASSCONFIG pass)
00095 {
00096     return TS_NEVER;
00097 }
00098 
00099 EXPORT int isa_line_configuration(OBJECT *obj, char *classname)
00100 {
00101     return strcmp(classname,"line_configuration") == 0;
00102 }
00103 

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