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* underground_line_conductor::oclass = NULL;
00020 CLASS* underground_line_conductor::pclass = NULL;
00021
00022 underground_line_conductor::underground_line_conductor(MODULE *mod) : powerflow_library(mod)
00023 {
00024 if(oclass == NULL)
00025 {
00026 oclass = gl_register_class(mod,"underground_line_conductor",sizeof(underground_line_conductor),0x00);
00027 if (oclass==NULL)
00028 throw "unable to register class underground_line_conductor";
00029 else
00030 oclass->trl = TRL_PROVEN;
00031
00032 if(gl_publish_variable(oclass,
00033 PT_double, "outer_diameter[in]",PADDR(outer_diameter),PT_DESCRIPTION,"Outer diameter of conductor and sheath",
00034 PT_double, "conductor_gmr[ft]", PADDR(conductor_gmr),PT_DESCRIPTION,"Geometric mean radius of the conductor",
00035 PT_double, "conductor_diameter[in]",PADDR(conductor_diameter),PT_DESCRIPTION,"Diameter of conductor",
00036 PT_double, "conductor_resistance[Ohm/mile]",PADDR(conductor_resistance),PT_DESCRIPTION,"Resistance of conductor in ohm/mile",
00037 PT_double, "neutral_gmr[ft]",PADDR(neutral_gmr),PT_DESCRIPTION,"Geometric mean radius of an individual neutral conductor/strand",
00038 PT_double, "neutral_diameter[in]",PADDR(neutral_diameter),PT_DESCRIPTION,"Diameter of individual neutral conductor/strand of concentric neutral",
00039 PT_double, "neutral_resistance[Ohm/mile]",PADDR(neutral_resistance),PT_DESCRIPTION,"Resistance of an individual neutral conductor/strand in ohm/mile",
00040 PT_int16, "neutral_strands",PADDR(neutral_strands),PT_DESCRIPTION,"Number of cable strands in neutral conductor",
00041 PT_double, "shield_thickness[in]",PADDR(shield_thickness),PT_DESCRIPTION,"The thickness of Tape shield in inches",
00042 PT_double, "shield_diameter[in]",PADDR(shield_diameter),PT_DESCRIPTION,"The outside diameter of Tape shield in inches",
00043 PT_double, "insulation_relative_permitivitty[unit]", PADDR(insulation_rel_permitivitty), PT_DESCRIPTION, "Permitivitty of insulation, relative to air",
00044 PT_double, "shield_gmr[ft]",PADDR(shield_gmr),PT_DESCRIPTION,"Geometric mean radius of shielding sheath",
00045 PT_double, "shield_resistance[Ohm/mile]",PADDR(shield_resistance),PT_DESCRIPTION,"Resistance of shielding sheath in ohms/mile",
00046 PT_double, "rating.summer.continuous[A]", PADDR(summer.continuous),PT_DESCRIPTION,"amp rating in summer, continuous",
00047 PT_double, "rating.summer.emergency[A]", PADDR(summer.emergency),PT_DESCRIPTION,"amp rating in summer, short term",
00048 PT_double, "rating.winter.continuous[A]", PADDR(winter.continuous),PT_DESCRIPTION,"amp rating in winter, continuous",
00049 PT_double, "rating.winter.emergency[A]", PADDR(winter.emergency),PT_DESCRIPTION,"amp rating in winter, short term",
00050 NULL) < 1) GL_THROW("unable to publish underground_line_conductor properties in %s",__FILE__);
00051 }
00052 }
00053 int underground_line_conductor::create(void)
00054 {
00055 int result = powerflow_library::create();
00056 outer_diameter = conductor_gmr = conductor_diameter = 0.0;
00057 conductor_resistance = neutral_gmr = neutral_diameter = 0.0;
00058 neutral_resistance = shield_gmr = 0.0;
00059 neutral_strands = 0;
00060 shield_resistance = 0.0;
00061 shield_thickness = 0.0;
00062 shield_diameter = 0.0;
00063 insulation_rel_permitivitty = 1.0;
00064 summer.continuous = winter.continuous = 1000;
00065 summer.emergency = winter.emergency = 2000;
00066 return result;
00067 }
00068
00069 int underground_line_conductor::init(OBJECT *parent)
00070 {
00071 if (outer_diameter < conductor_diameter)
00072 {
00073 GL_THROW("outer_diameter was specified as less than or equal to the conductor_diameter");
00074
00075
00076
00077
00078 }
00079 if (outer_diameter < neutral_diameter)
00080 {
00081 GL_THROW("outer_diameter was specified as less than or equal to the neutral_diameter");
00082
00083
00084
00085
00086 }
00087 if (shield_diameter < shield_thickness)
00088 {
00089 GL_THROW("shield_diameter was specified as less than or equal to the tapeshield_thickness");
00090
00091
00092
00093 }
00094
00095 if ((neutral_gmr > 0.0) && (shield_gmr > 0.0 ))
00096 {
00097 GL_THROW("Both neutral GMR and shield GMR are larger than zero, it should be specified which type of cable (concentric neutral or tape-shielded) is selected");
00098
00099
00100
00101 }
00102
00103 if ((shield_gmr > 0.0) && (neutral_gmr == 0.0 ))
00104 {
00105
00106
00107
00108 if (shield_resistance <= 0 || shield_thickness <=0 || shield_diameter <=0 )
00109 {
00110 GL_THROW("this cable is tape-shielded, the following four parameters need to be specified: shield_gmr, shield_resistance, shield_thickness, shield_diameter");
00111
00112
00113
00114
00115 }
00116 }
00117
00118 if ((shield_gmr == 0.0) && (neutral_gmr > 0.0 ))
00119 {
00120 if ((neutral_resistance <= 0.0) || (neutral_diameter <= 0.0) || (neutral_strands <=0) )
00121 {
00122 GL_THROW("this is a concentric neutral cable, the following four parameters need to be specified: neutral_gmr, neutral_resistance, neutral_diameter, neutral_strands");
00123
00124
00125
00126
00127 }
00128 }
00129
00130 return 1;
00131 }
00132
00133 int underground_line_conductor::isa(char *classname)
00134 {
00135 return strcmp(classname,"underground_line_conductor")==0;
00136 }
00137
00138
00140
00142
00150 EXPORT int create_underground_line_conductor(OBJECT **obj, OBJECT *parent)
00151 {
00152 try
00153 {
00154 *obj = gl_create_object(underground_line_conductor::oclass);
00155 if (*obj!=NULL)
00156 {
00157 underground_line_conductor *my = OBJECTDATA(*obj,underground_line_conductor);
00158 gl_set_parent(*obj,parent);
00159 return my->create();
00160 }
00161 else
00162 return 0;
00163 }
00164 CREATE_CATCHALL(underground_line_conductor);
00165 }
00166
00167 EXPORT int init_underground_line_conductor(OBJECT *obj)
00168 {
00169 try {
00170 underground_line_conductor *my = OBJECTDATA(obj,underground_line_conductor);
00171 return my->init(obj->parent);
00172 }
00173 INIT_CATCHALL(underground_line_conductor);
00174 }
00175
00176 EXPORT TIMESTAMP sync_underground_line_conductor(OBJECT *obj, TIMESTAMP t1, PASSCONFIG pass)
00177 {
00178 return TS_NEVER;
00179 }
00180
00181 EXPORT int isa_underground_line_conductor(OBJECT *obj, char *classname)
00182 {
00183 return OBJECTDATA(obj,underground_line_conductor)->isa(classname);
00184 }
00185