powerflow/triplex_line_conductor.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* triplex_line_conductor::oclass = NULL;
00019 CLASS* triplex_line_conductor::pclass = NULL;
00020 triplex_line_conductor *triplex_line_conductor::defaults = NULL;
00021 
00022 triplex_line_conductor::triplex_line_conductor(MODULE *mod)
00023 {
00024     if(oclass == NULL)
00025     {
00026         oclass = gl_register_class(mod,"triplex_line_conductor",0x00);
00027         if(oclass == NULL)
00028             GL_THROW("unable to register triplex_line_conductor class implemented by %s",__FILE__);
00029         
00030         if(gl_publish_variable(oclass,
00031             PT_double, "resistance",PADDR(resistance),
00032             PT_double, "geometric_mean_radius", PADDR(geometric_mean_radius),
00033             NULL) < 1) GL_THROW("unable to publish triplex_line_conductor properties in %s",__FILE__);
00034         
00035         // Set up defaults
00036         defaults = this;
00037         resistance = 0.0;
00038         geometric_mean_radius = 0.0;
00039     }   
00040 }
00041 
00042 int triplex_line_conductor::create(void)
00043 {
00044     memcpy(this,defaults,sizeof(triplex_line_conductor));
00045     return 1;
00046 }
00047 
00048 int triplex_line_conductor::isa(char *classname)
00049 {
00050     return strcmp(classname,"triplex_line_conductor")==0;
00051 
00052 }
00053 
00055 // IMPLEMENTATION OF CORE LINKAGE: triplex_line_conductor
00057 
00065 EXPORT int create_triplex_line_conductor(OBJECT **obj, OBJECT *parent)
00066 {
00067     try
00068     {
00069         *obj = gl_create_object(triplex_line_conductor::oclass,sizeof(triplex_line_conductor));
00070         if (*obj!=NULL)
00071         {
00072             triplex_line_conductor *my = OBJECTDATA(*obj,triplex_line_conductor);
00073             gl_set_parent(*obj,parent);
00074             return my->create();
00075         }
00076     }
00077     catch (char *msg)
00078     {
00079         gl_error("create_triplex_line_conductor: %s", msg);
00080     }
00081     return 1;
00082 }
00083 
00084 EXPORT TIMESTAMP sync_triplex_line_conductor(OBJECT *obj, TIMESTAMP t1, PASSCONFIG pass)
00085 {
00086     return TS_NEVER;
00087 }
00088 
00089 EXPORT int isa_triplex_line_conductor(OBJECT *obj, char *classname)
00090 {
00091     return OBJECTDATA(obj,triplex_line_conductor)->isa(classname);
00092 }
00093 

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