powerflow/underground_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* underground_line_conductor::oclass = NULL;
00019 CLASS* underground_line_conductor::pclass = NULL;
00020 underground_line_conductor  *underground_line_conductor::defaults = NULL;
00021 
00022 underground_line_conductor::underground_line_conductor(MODULE *mod)
00023 {
00024     if(oclass == NULL)
00025     {
00026         oclass = gl_register_class(mod,"underground_line_conductor",0x00);
00027         if(oclass == NULL)
00028             GL_THROW("unable to register underground_line_conductor class implemented by %s",__FILE__);
00029         
00030         if(gl_publish_variable(oclass,
00031             PT_double, "outer_diameter[in]",PADDR(outer_diameter),
00032             PT_double, "conductor_gmr[in]", PADDR(conductor_gmr),
00033             PT_double, "conductor_diameter[in]",PADDR(conductor_diameter),
00034             PT_double, "conductor_resistance[ohm/mile]",PADDR(conductor_resistance),
00035             PT_double, "neutral_gmr[in]",PADDR(neutral_gmr),
00036             PT_double, "neutral_diameter[in]",PADDR(neutral_diameter),
00037             PT_double, "neutral_resistance[ohm/mile]",PADDR(neutral_resistance),
00038             PT_int16,  "neutral_strands",PADDR(neutral_strands),
00039             PT_double, "shield_gmr[in]",PADDR(shield_gmr),
00040             PT_double, "shield_resistance[ohm/mile]",PADDR(shield_resistance),
00041             PT_double, "rating.summer.continuous[A]", PADDR(summer.continuous),
00042             PT_double, "rating.summer.emergency[A]", PADDR(summer.emergency),
00043             PT_double, "rating.winter.continuous[A]", PADDR(winter.continuous),
00044             PT_double, "rating.winter.emergency[A]", PADDR(winter.emergency),
00045             NULL) < 1) GL_THROW("unable to publish underground_line_conductor properties in %s",__FILE__);
00046         
00047         // Set up defaults
00048         defaults = this;
00049         outer_diameter = conductor_gmr = conductor_diameter = 0.0;
00050         conductor_resistance = neutral_gmr = neutral_diameter = 0.0;
00051         neutral_resistance = shield_gmr = 0.0;
00052         neutral_strands = 0;
00053         shield_resistance = 0.0;
00054         summer.continuous = winter.continuous = 1000;
00055         summer.emergency = winter.emergency = 2000;
00056     }
00057 }
00058 int underground_line_conductor::create(void)
00059 {
00060     memcpy(this,defaults,sizeof(underground_line_conductor));
00061     return 1;
00062 }
00063 
00064 int underground_line_conductor::isa(char *classname)
00065 {
00066     return strcmp(classname,"underground_line_conductor")==0;
00067 }
00068 
00069 
00071 // IMPLEMENTATION OF CORE LINKAGE: underground_line_conductor
00073 
00081 EXPORT int create_underground_line_conductor(OBJECT **obj, OBJECT *parent)
00082 {
00083     try
00084     {
00085         *obj = gl_create_object(underground_line_conductor::oclass,sizeof(underground_line_conductor));
00086         if (*obj!=NULL)
00087         {
00088             underground_line_conductor *my = OBJECTDATA(*obj,underground_line_conductor);
00089             gl_set_parent(*obj,parent);
00090             return my->create();
00091         }
00092     }
00093     catch (char *msg)
00094     {
00095         gl_error("create_underground_line_conductor: %s", msg);
00096     }
00097     return 1;
00098 }
00099 
00100 EXPORT TIMESTAMP sync_underground_line_conductor(OBJECT *obj, TIMESTAMP t1, PASSCONFIG pass)
00101 {
00102     return TS_NEVER;
00103 }
00104 
00105 EXPORT int isa_underground_line_conductor(OBJECT *obj, char *classname)
00106 {
00107     return OBJECTDATA(obj,underground_line_conductor)->isa(classname);
00108 }
00109 

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