Skip to content

Commit

Permalink
lat-->latitude and long-->longitude
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGensollen committed Oct 15, 2018
1 parent d5818d1 commit faef7c9
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 71 deletions.
8 changes: 3 additions & 5 deletions ditto/metrics/network_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,8 @@ def analyze_object(self, obj, feeder_name):
# then we add the points to the list of points for the feeder
if hasattr(obj, "positions") and obj.positions is not None:
for position in obj.positions:
X = position.long
Y = position.lat
X = position.longitude
Y = position.latitude
if X is not None and Y is not None:
if feeder_name in self.points:
self.points[feeder_name].append([X, Y])
Expand Down Expand Up @@ -1330,9 +1330,7 @@ def analyze_object(self, obj, feeder_name):
):
self.results[feeder_name][
"sum_distribution_transformer_mva"
] += (
obj.windings[0].rated_power * 10 ** -6
) # DiTTo in va
] += (obj.windings[0].rated_power * 10 ** -6) # DiTTo in va

if (
hasattr(obj.windings[0], "phase_windings")
Expand Down
4 changes: 2 additions & 2 deletions ditto/models/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
class Position(DiTToHasTraits):
# NOTE: We are not really using lat/long I believe, but mostly coordinates in various format
# TODO: Build the conversion to parse to lat/long from given inputs...
long = Float(help="""Decimal Longitude""", unit=M)
lat = Float(help="""Decimal Latitude""", unit=M)
longitude = Float(help="""Decimal Longitude""", unit=M)
latitude = Float(help="""Decimal Latitude""", unit=M)
elevation = Float(help="""Decimal elevation (meters)""", unit=M)

def build(self, model):
Expand Down
24 changes: 13 additions & 11 deletions ditto/modify/system_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def set_missing_coords_recur(self):
and (
i.positions is None
or len(i.positions) == 0
or i.positions[0].lat == 0
or i.positions[0].long == 0
or i.positions[0].latitude == 0
or i.positions[0].longitude == 0
)
and (hasattr(i, "name") and i.name is not None)
):
Expand All @@ -136,10 +136,12 @@ def set_missing_coords_recur(self):
hasattr(j, "positions")
and j.positions is not None
and len(j.positions) != 0
and j.positions[0].lat != 0
and j.positions[0].long != 0
and j.positions[0].latitude != 0
and j.positions[0].longitude != 0
):
adj_lats_longs.append((j.positions[0].lat, j.positions[0].long))
adj_lats_longs.append(
(j.positions[0].latitude, j.positions[0].longitude)
)

if len(adj_lats_longs) == 0:
next_recur.append(i)
Expand All @@ -154,8 +156,8 @@ def set_missing_coords_recur(self):
av_lat = av_lat / float(num)
av_long = av_long / float(num)
computed_pos = Position(self.model)
computed_pos.lat = av_lat
computed_pos.long = av_long
computed_pos.latitude = av_lat
computed_pos.longitude = av_long
self.model[i].positions = [computed_pos]
if len(next_recur) == len(recur_nodes):
for i in recur_nodes:
Expand Down Expand Up @@ -327,13 +329,13 @@ def set_load_coordinates(self, **kwargs):
position_obj = self.model[obj.connecting_element].positions
obj.positions = []
for po in position_obj:
_long = po.long
_lat = po.lat
_long = po.longitude
_lat = po.latitude
_elev = po.elevation

load_position = Position()
load_position.long = _long + delta_longitude
load_position.lat = _lat + delta_latitude
load_position.longitude = _long + delta_longitude
load_position.latitude = _lat + delta_latitude
load_position.elevation = _elev + delta_elevation

obj.positions.append(load_position)
Expand Down
20 changes: 10 additions & 10 deletions ditto/readers/cyme/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -1270,8 +1270,8 @@ def parse_nodes(self, model):
# Set the coordinates
try:
position = Position(model)
position.long = float(node["coordx"])
position.lat = float(node["coordy"])
position.longitude = float(node["coordx"])
position.latitude = float(node["coordy"])
position.elevation = 0
api_node.positions.append(position)
except:
Expand Down Expand Up @@ -2288,8 +2288,8 @@ def parse_lines(self, model):
# Set the position
try:
position = Position(model)
position.long = float(settings["coordx"])
position.lat = float(settings["coordy"])
position.longitude = float(settings["coordx"])
position.latitude = float(settings["coordy"])
position.elevation = 0
new_line["position"] = position
except:
Expand Down Expand Up @@ -3800,8 +3800,8 @@ def parse_capacitors(self, model):
# Position
try:
position = Position(model)
position.long = float(settings["coordx"])
position.lat = float(settings["coordy"])
position.longitude = float(settings["coordx"])
position.latitude = float(settings["coordy"])
position.elevation = 0
api_capacitor.position.append(position)
except:
Expand Down Expand Up @@ -4403,8 +4403,8 @@ def parse_transformers(self, model):
# Set the position
try:
position = Position(model)
position.long = float(settings["coordx"])
position.lat = float(settings["coordy"])
position.longitude = float(settings["coordx"])
position.latitude = float(settings["coordy"])
position.elevation = 0
api_transformer.positions.append(position)
except:
Expand Down Expand Up @@ -4921,8 +4921,8 @@ def parse_regulators(self, model):

try:
position = Position(model)
position.long = float(reg_set["coordx"])
position.lat = float(reg_set["coordy"])
position.longitude = float(reg_set["coordx"])
position.latitude = float(reg_set["coordy"])
position.elevation = 0
api_regulator.positions.append(position)
except:
Expand Down
8 changes: 6 additions & 2 deletions ditto/readers/dew/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,12 @@ def parse(self, model, **kwargs):
# Posiiton information can be used if required (not stored and not included in ditto)
try:
position = Position(model)
position.lat = float(entries[13][:-1]) # X position in EDD DEW
position.long = float(entries[14][:-1]) # Y posiiton in EDD
position.latitude = float(
entries[13][:-1]
) # X position in EDD DEW
position.longitude = float(
entries[14][:-1]
) # Y posiiton in EDD
position.elevation = 0
api_node.positions.append(position)
except AttributeError:
Expand Down
8 changes: 6 additions & 2 deletions ditto/readers/dew/read_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ def parse(self, model, inputfile, databasepath):
# Posiiton information can be used if required (not stored and not included in ditto)
try:
position = Position(model)
position.lat = float(entries[13][:-1]) # X position in EDD DEW
position.long = float(entries[14][:-1]) # Y posiiton in EDD
position.latitude = float(
entries[13][:-1]
) # X position in EDD DEW
position.longitude = float(
entries[14][:-1]
) # Y posiiton in EDD
position.elevation = 0
api_node.positions.append(position)
except AttributeError:
Expand Down
4 changes: 2 additions & 2 deletions ditto/readers/opendss/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,8 @@ def parse_nodes(self, model, **kwargs):

try:
node_pos = Position(model)
node_pos.long = data["positions"][0]
node_pos.lat = data["positions"][1]
node_pos.longitude = data["positions"][0]
node_pos.latitude = data["positions"][1]
api_node.positions.append(node_pos)
except:
pass
Expand Down
4 changes: 2 additions & 2 deletions ditto/readers/synergi/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ def parse(self, model):
pos = Position(model)

# Set the coordinates
pos.long = NodeY[i]
pos.lat = NodeX[i]
pos.longitude = NodeY[i]
pos.latitude = NodeX[i]

# Add the Position to the node's positions
api_node.positions.append(pos)
Expand Down
Loading

0 comments on commit faef7c9

Please sign in to comment.