Skip to content

Commit 936f76d

Browse files
author
David P. Chassin
committed
Cleanup docs and refactor code
Signed-off-by: David P. Chassin <[email protected]>
1 parent c419df4 commit 936f76d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+9566
-9342
lines changed

converters/autotest/test_csvgeodata2kml.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class,pole_length,pole_depth,ground_diameter,fiber_strength,name,tilt_angle,tilt_direction,latitude,longitude,configuration,weather,flags
1+
class,pole_length,pole_depth,ground_diameter,fiber_strength,name,tilt_degree,tilt_direction,latitude,longitude,configuration,weather,flags
22
pole_configuration,40.0 ft,5.5 ft,9.87 in,8000 psi,pole_configuration_267462S,,,,,,,
33
pole_configuration,50.0 ft,7.5 ft,,8000 psi,pole_configuration_280565E,,,,,,,
44
pole_configuration,45.0 ft,6.5 ft,12.41 in,8000 psi,pole_configuration_306771E,,,,,,,

converters/autotest/test_xls-spida2csv-geodata.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class,pole_length,pole_depth,ground_diameter,fiber_strength,name,tilt_angle,tilt_direction,latitude,longitude,configuration,wind_speed,flags
1+
class,pole_length,pole_depth,ground_diameter,fiber_strength,name,tilt_degree,tilt_direction,latitude,longitude,configuration,wind_speed,flags
22
pole_configuration,40.0 ft,5.5 ft,9.87 in,8000 psi,pole_configuration_267462S,,,,,,,
33
pole_configuration,50.0 ft,7.5 ft,12.18 in,8000 psi,pole_configuration_280565E,,,,,,,
44
pole_configuration,45.0 ft,6.5 ft,12.41 in,8000 psi,pole_configuration_306771E,,,,,,,

converters/autotest/test_xls-spida2csv-network.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class,pole_length,pole_depth,ground_diameter,fiber_strength,name,tilt_angle,tilt_direction,latitude,longitude,configuration,wind_speed,flags,equipment,parent,height,direction,pole_spacing,// cable_type,offset,area,weight,// equipment_type,phases,bustype,nominal_voltage,diameter,resistance,strength,distance_AE,conductor_A,spacing,from,to,length,connect_type,install_type,power_rating,primary_voltage,secondary_voltage,reactance
1+
class,pole_length,pole_depth,ground_diameter,fiber_strength,name,tilt_degree,tilt_direction,latitude,longitude,configuration,wind_speed,flags,equipment,parent,height,direction,pole_spacing,// cable_type,offset,area,weight,// equipment_type,phases,bustype,nominal_voltage,diameter,resistance,strength,distance_AE,conductor_A,spacing,from,to,length,connect_type,install_type,power_rating,primary_voltage,secondary_voltage,reactance
22
pole_configuration,40.0 ft,5.5 ft,9.87 in,8000 psi,pole_configuration_267462S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
33
pole_configuration,50.0 ft,7.5 ft,12.18 in,8000 psi,pole_configuration_280565E,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
44
pole_configuration,45.0 ft,6.5 ft,12.41 in,8000 psi,pole_configuration_306771E,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

converters/mdb-cyme2glm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,7 @@ def add_photovoltaic(self, photovoltaic_id, photovoltaic, version, **kwargs):
22262226
"panel_type": "MULTI_CRYSTAL_SILICON",
22272227
"efficiency": panel_efficiency,
22282228
"area": panel_area,
2229-
"tilt_angle": "45",
2229+
"tilt_degree": "45",
22302230
"orientation_azimuth": "180",
22312231
"orientation": "FIXED_AXIS",
22322232
}

converters/xls-spida2csv-geodata.py

Lines changed: 130 additions & 103 deletions
Large diffs are not rendered by default.

docs/Converters/Import/Spida_data.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[[/Converters/Import/Spida_data]] -- SPIDACalc data import
2+
3+
# Synopis
4+
5+
GLM:
6+
~~~
7+
#convert SPIDACALC.xls GEODATA.csv -f xls-spida -t csv-geodata [precision=2] [extract_equipment=yes] [include_network=yes]
8+
~~~
9+
10+
# Description
11+
12+
This converter extracts pole geodata from a SPIDAcalc pole asset report spreadsheet and generates a GriDLAB-D geodata CSV file.
13+
14+
15+
# Options
16+
17+
- `precision=2`: specify the number of digits in a number and function ROUND will be used (default 2)
18+
19+
- `extract_equipment=yes`: enable the conversion of pole-mounted equipment, dummy values will be used for equipment properties (default None)
20+
21+
- `include_network=yes`: enable the generation of a bus-type feeder, dummy values will be used for properties of feeder and equipment (default None)
22+
23+
- `include_weather=NAME`: name the weather object and do not use dummy values for weather data (default None)
24+
25+
# Input
26+
27+
[SPIDAcalc](https://www.spidasoftware.com/spidacalc/) is proprietarty pole loading and line design software that some utilities use to model the forces on transmission and distribution systems. The data includes detailed specifications and location data for poles, mounted equipment and lines.
28+
29+
The input .xls must include a sheet called 'Design - Pole'.
30+
If `extract_equipment=yes`, then it must also include a sheet called 'Design - Structure'
31+
32+
This SPIDACalc API documentation explains data in the pole asset report spreadsheet:
33+
https://github.com/spidasoftware/schema/blob/66cb5d102dde5bf23b487dbddb261d3a88fc0907/doc/wfs.md
34+
https://github.com/spidasoftware/schema/blob/master/doc/calc.md
35+
36+
For quick reference, some of the less obvious meanings are included below:
37+
In 'Design - Pole':
38+
* `AGL` means Above Ground Length
39+
* `GLC` means GroundLine Circumference
40+
41+
In 'Design - Structure':
42+
* `Direction` is a bearing for the mounted equipment, measured in degrees clockwise from North.
43+
* A WEP is a Wire End Point, indicating the pole or building at the other end of a wire. Here `Offset/Lead` corresponds to the length of wire between the pole and this Wire End Point.
44+
* For Insulators: "If on pole, then `offest` is attach height. If on cross arm, then `offset` is the distance from one end of the cross arm." - (SPIDAcalc docs)[https://github.com/spidasoftware/schema/blob/66cb5d102dde5bf23b487dbddb261d3a88fc0907/doc/wfs.md]
45+
* For CrossArms: "Crossarm bearing is the direction the end of the crossarm points, not the direction of the bolt attachment." - (SPIDAcalc docs)[https://github.com/spidasoftware/schema/blob/66cb5d102dde5bf23b487dbddb261d3a88fc0907/doc/wfs.md]
46+
47+
48+
# Output
49+
50+
A csv where each row represents a GridLAB-D object, columns are properties for that object.
51+
**See the documentation for the respective GridLAB-D objects to interpret the properties.**
52+
53+
The following objects can be included in the output:
54+
`pole`, `pole_configuration`
55+
If `extract_equipment=yes`, it will also include `pole_mount`.
56+
57+
58+
# See also
59+
60+
* [[/Converters/Import/Csv_files]]

docs/Converters/Import/Table_data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This converter allows for any arbitrary object to be imported via CSV-formatted
88

99
Any arbitrary objects can be listed in a CSV file and convertered to GLM-formatted object. The table format is as below :
1010

11-
class | name | tilt_angle | tilt_direction | weather | configuration | equipment_area | equipment_height | install_year | repair_time | latitude | longitude | phases | nominal_voltage | tmyfile
11+
class | name | tilt_degree | tilt_direction | weather | configuration | equipment_area | equipment_height | install_year | repair_time | latitude | longitude | phases | nominal_voltage | tmyfile
1212
--- | --- | --- | --- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |---
1313
powerflow.pole | pole1 | 5 deg | 270 | weather | WOOD-C-45/5 | | | 1990 | 1 h | 37.4275 | 122.1697 | ABC | 12470
1414
powerflow.pole | pole2 | 8 deg | 270 | weather | WOOD-C-45/5 | | | 2000 | 8 h | 37.127 | 122.1646 | ABC | 12470

docs/Converters/Import/Xls_files.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ There are many different types of XLS files that can be imported. Each is docume
1717
* [[/Converters/Import/Ceus_data]]
1818
* [[/Converters/Import/Rbsa_data]]
1919
* [[/Converters/Import/Scada_data]]
20+
* [[/Converters/Import/Spida_data]]
2021
* GLM models
2122
* [[/Converters/Import/Config_data]]
2223
* [[/Converters/Import/Ica_data]]

docs/Developer/reading-the-code.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# C++ code files
2+
3+
The 'PT_' preffix for variable names means "Property Type".
4+
5+
oclass means object class
6+
pclass means parent class
7+
8+
## get_<property>_offset()
9+
These functions return offsets in memory location. Every object attribute is listed sequentially in memory (I believe in the order that they are declared?). This function returns the difference in the memory address of an attribute from the start of the object in memory. It's defined by a macro, `GL_ATOMIC(type, attribute name)` which generates a callable function specific to every attribute it's applied to.
10+
11+
The code looks like this:
12+
`static inline size_t get_##X##_offset(void) { return (char*)&(defaults->X)-(char*)defaults; };`
13+
14+
`defaults` is a class attribute, a pointer to an object of the same type as the class it's a part of. Say we are looking at the `pole` class. `defaults` will be a pointer to a pole object. Confusingly, `defaults` is never inititialized to anything beyond NULL. How does this work? Back when this program was written in C, `defaults` pointed to a chunk of memory holding an object with all attributes initilized to default values. In C you could create a new object by simply copying this memory chunk. In C++ you need to declare all the attributes within an object, not just the object itself. The old method of setting defaults stopped working, so it's done differently now. The `defaults` pointer was retained as an attribute in the class declaration. The get offset function uses it for pointer math, finding the differences in memory location between the start of an object and all of it's attributes. Because a class declaration includes the type of all attributes, the compiler can figure out how much space they will take up in memory. (In C++ all types have a fixed size.) 'defaults' never needs to be initialized.

docs/Module/Generators/Solar.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class solar {
4040
complex VA_Out[VA];
4141
object weather;
4242
double shading_factor[pu];
43-
double tilt_angle[deg];
43+
double tilt_degree[deg];
4444
double orientation_azimuth[deg];
4545
bool latitude_angle_fix;
4646
enumeration {DEFAULT=0,FIXED_AXIS=1,ONE_AXIS=2,TWO_AXIS=3,AZIMUTH_AXIS=4}orientation;
@@ -239,9 +239,9 @@ Reference to a climate object from which temperature, humidity, and solar flux a
239239
double shading_factor[pu]
240240
~~~
241241
Shading factor for scaling solar power to the array.
242-
### tilt_angle
242+
### tilt_degree
243243
~~~
244-
double tilt_angle[deg]
244+
double tilt_degree[deg]
245245
~~~
246246
Tilt angle of PV array.
247247
### orientation_azimuth

docs/Module/Powerflow/Pole.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
object pole
77
{
88
status "OK";
9-
tilt_angle "0 deg";
9+
tilt_degree "0 deg";
1010
tilt_direction 0 deg";
1111
weather "<climate-object>";
12-
configuration "<pole-configuration-object>";
13-
install_year "1970";
12+
configuration "<pole-configuration-object>"; *
13+
install_year "1970"; *
1414
repair_time "24 h";
1515
wind_speed 0.0 m/s;
1616
wind_direction 0.0 deg;
@@ -23,19 +23,22 @@ object pole
2323
total_moment "0 ft*lb";
2424
resisting_moment "0 ft*lb";
2525
pole_moment "0 ft*lb";
26-
pole_moment_nowind "0 ft*lb";
26+
pole_moment_per_wind "0 ft*lb";
2727
equipment_moment "0 ft*lb";
28-
equipment_moment_nowind "0 ft*lb";
28+
equipment_moment_per_wind "0 ft*lb";
2929
critical_wind_speed "0 m/s";
3030
wire_moment "0 ft*lb";
3131
wire_tension "0 ft*lb";
3232
guy_height "0 ft";
3333
}
3434
~~~
3535

36+
\* Starred attributes are required.
37+
38+
3639
# Description
3740

38-
The pole object models poles in powerflow network. The current pole object models pole failure by overstress at the base the pole from wind pressure on the equipment, wire, and tilt. The model does not model failures from ice loading on the lines or from foundation failure.
41+
The pole object models poles in powerflow network. The current pole object models pole failure by overstress at the base the pole from wind pressure on the equipment, wire, and tilt. Ice on the line is modeled as an increase in the conductor diameter for respect to wind loading. The added weight is calculated assuming a cylindrically symmetric ice accumulation with constant density. The model does not model foundation failure.
3942

4043
Generally, any link object in a powerflow model can be mounted on a pole by creating a `pole_mount` object that uses the pole as a parent, and providing just the `weather` and `pole_configuration` object references to the pole. The `pole_mount` object specifies the position, size, and weight of the equipment on the pole to model the effect of wind give the aerodynamic cross-section.
4144

@@ -49,10 +52,10 @@ Generally, any link object in a powerflow model can be mounted on a pole by crea
4952

5053
The status of the pole.
5154

52-
### `tilt_angle`
55+
### `tilt_degree`
5356

5457
~~~
55-
double tilt_angle[deg];
58+
double tilt_degree[deg];
5659
~~~
5760

5861
The tilt angle of the pole.
@@ -95,7 +98,7 @@ Year the pole was installed.
9598
double repair_time[h];
9699
~~~
97100

98-
Time required to repair or replace the pole after failure.
101+
Time required to repair or replace the pole after failure. Includes time to identify the failure and reach the site.
99102

100103
### `wind_speed`
101104

@@ -130,7 +133,7 @@ The wind gusts at the location of the pole. This is automatically set is the
130133
double pole_stress[pu];
131134
~~~
132135

133-
Ratio of actual stress to critical stress.
136+
Ratio of actual (applied) moment to resisting moment (highest the pole can handle). When this reaches 1.0 or higher, the pole failes.
134137

135138
### `pole_stress_polynomial_a`
136139

@@ -162,55 +165,56 @@ Constant c of the pole stress polynomial function.
162165
double susceptibility[pu*s/m];
163166
~~~
164167

165-
Susceptibility of pole to wind stress (derivative of pole stress w.r.t wind speed).
168+
Susceptibility of pole to wind stress (derivative of pole stress with respect to wind speed).
166169

167170
### `total_moment`
168171

169172
~~~
170173
double total_moment[ft*lb];
171174
~~~
172175

173-
The total moment on the pole.
176+
The total moment on the pole. This results from wind loads, gravitational loads, and potentially a transverse (perpendicular to the wires) load due to an angle in the conductors. There is wind pressure on the pole itself, the conductors attached to the pole, and the equipment mounted on the pole. Wind on equipment is usually much less signinficant than wind on the conductors. There are also gravitaional loads based on the pole tilt, it's weight and that of the mounted equipment and lines.
177+
174178

175179
### `resisting_moment`
176180

177181
~~~
178182
double resisting_moment[ft*lb];
179183
~~~
180184

185+
Maximum moment the pole can withstand before snapping. This is calculated based on the fiber strength of the wood species and the pole diameter where it is supported - either at ground line or where guy wire(s) are attached.
186+
181187
### `pole_moment`
182188

183189
~~~
184190
double pole_moment[ft*lb];
185191
~~~
186192

187-
The moment of the pole.
193+
Moment on the pole due to it's own weight and tilt.
188194

189-
### `pole_moment_nowind`
195+
### `pole_moment_per_wind`
190196

191197
~~~
192-
double pole_moment_nowind[ft*lb];
198+
double pole_moment_per_wind[ft*lb];
193199
~~~
194200

195-
The moment of the pole without wind.
201+
The components of the equation for moment due to wind on the pole, except for wind pressure, i.e. moment per unit wind pressure. Accounts for the pole's cross-sectional area (for calculating the force of wind on the pole) and height (torque raduis).
196202

197203
### `equipment_moment`
198204

199205
~~~
200206
double equipment_moment[ft*lb];
201207
~~~
202208

203-
The moment of the equipment.
209+
Moments on the pole due to gravitational load (equipment weight, pole tilt) and wind load (based on cross-sectional area of equipment).
204210

205-
### `equipment_moment_nowind`
211+
### `equipment_moment_per_wind`
206212

207213
~~~
208-
double equipment_moment_nowind[ft*lb];
214+
double equipment_moment_per_wind[ft*lb];
209215
~~~
210216

211-
The moment of the equipment without wind.
212-
213-
The resisting moment on the pole.
217+
The components of the equation for moment due to wind on equipment, all except the wind pressure, i.e. moment per unit wind pressure.
214218

215219
### `critical_wind_speed`
216220

@@ -226,7 +230,7 @@ Wind speed at pole failure.
226230
double wire_moment[ft*lb];
227231
~~~
228232

229-
Wire moment due to conductor weight.
233+
Moments due to line tension, weight, and wind on the lines.
230234

231235
### `wire_tension`
232236

@@ -248,10 +252,10 @@ Guy wire attachment height.
248252

249253
The pole failure model is described in [Pole Loading Model](https://source.gridlabd.us/raw/master/module/powerflow/docs/pole_loading.pdf).
250254

251-
The pole reaches end of life status based on a degradation rate that is defined by minimum shell thickness of 2". See [Pole Degradation Model](https://www.sciencedirect.com/science/article/pii/S0167473005000457) details.
255+
[Out of date, change this:] The pole reaches end of life status based on a degradation rate that is defined by minimum shell thickness of 2". See [Pole Degradation Model](https://www.sciencedirect.com/science/article/pii/S0167473005000457) details.
252256

253257
# See also
254258

255-
* [[/Module/Powerflow/Pole_configuration]]
259+
* [[/Module/Powerflow/Pole_configuration]](https://github.com/arras-energy/gridlabd/blob/master/docs/Module/Powerflow/Pole_configuration.md)
256260
* [Pole Loading Model](https://source.gridlabd.us/raw/master/module/powerflow/docs/pole_loading.pdf)
257261
* [Pole Degradation Model](https://www.sciencedirect.com/science/article/pii/S0167473005000457)

docs/Module/Powerflow/Pole_mount.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ object pole
5151
}
5252
~~~
5353

54+
## Properties
55+
56+
### `direction`
57+
58+
~~~
59+
double direction;
60+
~~~
61+
62+
Bearing of the mounted equipment, an angle measured clockwise from North in degrees with vertex at the pole centerline.
63+
5464
# See also
5565

5666
* [[/Module/Powerflow/Pole.md]]

docs/User manual/2 - Designing GridLAB-D Models/2 - Modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ In addition, modules generally should be able to implement the following
3131
It turns out that implementing these capabilities is not as easy as it
3232
at first seems. In particular, the synchronization has typically been one
3333
of the most challenging concepts for programmers to understand. Given
34-
the amount of time spend in sync calls, it is recommended that
34+
the amount of time spent in sync calls, it is recommended that
3535
considerable time and effort be put into its design.
3636

3737
= Basic Synchronization =

docs/Utilities/Create_poles.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ on using libraries.
5959
Some network models include latitude and longitude information. When this information is present,
6060
the line length information checked. If there is a discrepancy between these, a warning is printed
6161
and the latitude/longitude information is used. The `--ignore_length` option will suppress this
62-
warning. The `--ignore_location` warning will cause the model to use the line length data instead.
62+
warning. The `--ignore_location` option will cause the model to use the line length data instead.
6363

6464
The `--include_network` adds a `#include "FILENAME"` directive in the output to ensure that the
6565
resulting GLM file contains all the objects required to run the simulation, e.g.,
@@ -85,7 +85,7 @@ Pole and pole_mount objects are created with the following default properties:
8585

8686
* pole
8787
- install_year: 2000
88-
- tilt_angle: 0 deg
88+
- tilt_degree: 0 deg
8989
- tilt_direction: 0 deg
9090
* pole_mount
9191
height: 40 ft

geodata/geodata_elevation.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def apply(data, options=default_options, config=default_config, warning=print):
134134
# Elevation data processing
135135
#
136136

137-
def get_elevation(pos,repourl=default_config["repourl"],cachedir=default_config["cachedir"]):
137+
def get_elevation(pos,repo_url=default_config["repourl"],cachedir=default_config["cachedir"]):
138138
"""Compute the elevations at the locations specified
139139
140140
Elevations are obtained for each entry in the args list. If the
@@ -148,21 +148,22 @@ def get_elevation(pos,repourl=default_config["repourl"],cachedir=default_config[
148148
DataFrame Pandas dataframe containing the latitudes, longitudes,
149149
and elevations.
150150
"""
151-
n,e = get_imagedata(pos,repourl,cachedir)
151+
# elev_data (nparray) The elevation data from the image
152+
_, elev_data = get_imagedata(pos,repo_url,cachedir)
152153
row,col = get_rowcol(pos)
153154
dx = 1.0-math.modf(abs(pos[1])*3600)[0]
154155
dy = 1.0-math.modf(abs(pos[0])*3600)[0]
155-
e00 = float(e[row][col])
156+
e00 = float(elev_data[row][col])
156157
if row > 0:
157-
e10 = float(e[row-1][col])
158+
e10 = float(elev_data[row-1][col])
158159
else:
159160
e10 = e00
160161
if col > 0:
161-
e01 = float(e[row][col-1])
162+
e01 = float(elev_data[row][col-1])
162163
else:
163164
e01 = e00
164165
if row > 0 and col > 0:
165-
e11 = float(e[row-1][col-1])
166+
e11 = float(elev_data[row-1][col-1])
166167
else:
167168
e11 = e00
168169
e0 = dx*e00 + (1-dx)*e01

geodata/geodata_powerline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def TODO(value=float('nan')):
196196
}
197197

198198
default_config = {
199-
"cabletype_file" : f"{GLD_ETC}/geodata_powerline_cabletypes.csv",
199+
"cabletype_file" : f"{GLD_ETC}/gridlabd/geodata_powerline_cabletypes.csv",
200200
}
201201

202202
OPTIONS = default_options

0 commit comments

Comments
 (0)