diff --git a/ditto/metrics/network_analysis.py b/ditto/metrics/network_analysis.py index cf9ea6e1..252354c7 100644 --- a/ditto/metrics/network_analysis.py +++ b/ditto/metrics/network_analysis.py @@ -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]) @@ -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") diff --git a/ditto/models/position.py b/ditto/models/position.py index 0f3c93c3..f8c914db 100644 --- a/ditto/models/position.py +++ b/ditto/models/position.py @@ -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): diff --git a/ditto/modify/system_structure.py b/ditto/modify/system_structure.py index 5ec1f79b..05c34610 100644 --- a/ditto/modify/system_structure.py +++ b/ditto/modify/system_structure.py @@ -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) ): @@ -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) @@ -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: @@ -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) diff --git a/ditto/readers/cyme/read.py b/ditto/readers/cyme/read.py index 4ede5bf1..010f0f98 100644 --- a/ditto/readers/cyme/read.py +++ b/ditto/readers/cyme/read.py @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/ditto/readers/dew/read.py b/ditto/readers/dew/read.py index 699483c8..6ba31672 100644 --- a/ditto/readers/dew/read.py +++ b/ditto/readers/dew/read.py @@ -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: diff --git a/ditto/readers/dew/read_new.py b/ditto/readers/dew/read_new.py index ee66f47f..f4866c18 100644 --- a/ditto/readers/dew/read_new.py +++ b/ditto/readers/dew/read_new.py @@ -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: diff --git a/ditto/readers/opendss/read.py b/ditto/readers/opendss/read.py index 897c9a3a..25677406 100644 --- a/ditto/readers/opendss/read.py +++ b/ditto/readers/opendss/read.py @@ -664,8 +664,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 diff --git a/ditto/readers/synergi/read.py b/ditto/readers/synergi/read.py index 76142755..96097831 100644 --- a/ditto/readers/synergi/read.py +++ b/ditto/readers/synergi/read.py @@ -572,8 +572,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) diff --git a/ditto/writers/cyme/write.py b/ditto/writers/cyme/write.py index b18025db..1f8c0e2b 100644 --- a/ditto/writers/cyme/write.py +++ b/ditto/writers/cyme/write.py @@ -444,13 +444,13 @@ def write_network_file(self, model, **kwargs): # CoordX and CoordY if hasattr(i, "positions") and i.positions is not None: try: - new_node_string += "," + str(i.positions[0].long) + new_node_string += "," + str(i.positions[0].longitude) except: new_node_string += ",0" pass try: - new_node_string += "," + str(i.positions[0].lat) + new_node_string += "," + str(i.positions[0].latitude) except: new_node_string += ",0" pass @@ -578,8 +578,8 @@ def write_network_file(self, model, **kwargs): [ new_sectionID, seg_number, - position.long, - position.lat, + position.longitude, + position.latitude, ] ) @@ -1588,8 +1588,8 @@ def write_network_file(self, model, **kwargs): if i.name not in self.nodeID_list: if hasattr(i, "positions") and i.positions is not None: try: - X = i.positions[0].long - Y = i.positions[0].lat + X = i.positions[0].longitude + Y = i.positions[0].latitude except: X = 0 Y = 0 @@ -1911,10 +1911,10 @@ def write_network_file(self, model, **kwargs): if hasattr(i, "positions") and i.positions is not None: try: new_transformer_line += "," + str( - i.positions[0].long + i.positions[0].longitude ) new_transformer_line += "," + str( - i.positions[0].lat + i.positions[0].latitude ) except: new_transformer_line += ",," @@ -2133,8 +2133,8 @@ def write_network_file(self, model, **kwargs): # CoordX and CoordY if hasattr(i, "positions") and i.positions is not None: try: - new_regulator_string += "," + str(i.positions[0].long) - new_regulator_string += "," + str(i.positions[0].lat) + new_regulator_string += "," + str(i.positions[0].longitude) + new_regulator_string += "," + str(i.positions[0].latitude) except: new_regulator_string += ",," pass @@ -2469,10 +2469,10 @@ def write_network_file(self, model, **kwargs): ): try: new_transformer_line += "," + str( - transformer_object.positions[0].long + transformer_object.positions[0].longitude ) new_transformer_line += "," + str( - transformer_object.positions[0].lat + transformer_object.positions[0].latitude ) except: new_transformer_line += ",," @@ -2833,10 +2833,10 @@ def write_network_file(self, model, **kwargs): ): try: new_transformer_line += "," + str( - transformer_object.positions[0].long + transformer_object.positions[0].longitude ) new_transformer_line += "," + str( - transformer_object.positions[0].lat + transformer_object.positions[0].latitude ) except: new_transformer_line += ",," @@ -3333,11 +3333,11 @@ def write_network_file(self, model, **kwargs): isinstance(obj, Node) and len(obj.positions) > 0 and obj.positions[0] is not None - and obj.positions[0].lat is not None - and obj.positions[0].long is not None + and obj.positions[0].latitude is not None + and obj.positions[0].longitude is not None ): - all_coordsX.append(obj.positions[0].long) - all_coordsY.append(obj.positions[0].lat) + all_coordsX.append(obj.positions[0].longitude) + all_coordsY.append(obj.positions[0].latitude) # (CASE 1) - Since we don't know what the LV value is beforehand, we store all coordinates by nominal voltage # in the dictionaries by_nominal_voltage_X and by_nominal_voltage_Y. if ( @@ -3351,8 +3351,8 @@ def write_network_file(self, model, **kwargs): and obj.positions[0] is not None ): if ( - obj.positions[0].lat is not None - and obj.positions[0].long is not None + obj.positions[0].latitude is not None + and obj.positions[0].longitude is not None ): if ( obj.nominal_voltage @@ -3362,17 +3362,17 @@ def write_network_file(self, model, **kwargs): ): by_nominal_voltage_X[ obj.nominal_voltage - ].append(obj.positions[0].long) + ].append(obj.positions[0].longitude) by_nominal_voltage_Y[ obj.nominal_voltage - ].append(obj.positions[0].lat) + ].append(obj.positions[0].latitude) else: by_nominal_voltage_X[ obj.nominal_voltage - ] = [obj.positions[0].long] + ] = [obj.positions[0].longitude] by_nominal_voltage_Y[ obj.nominal_voltage - ] = [obj.positions[0].lat] + ] = [obj.positions[0].latitude] # (CASE 2) - If the nominal voltage was None, then add the coordinates to the default list else: if ( @@ -3380,11 +3380,11 @@ def write_network_file(self, model, **kwargs): and obj.positions[0] is not None ): if ( - obj.positions[0].lat is not None - and obj.positions[0].long is not None + obj.positions[0].latitude is not None + and obj.positions[0].longitude is not None ): - defaultX.append(obj.positions[0].long) - defaultY.append(obj.positions[0].lat) + defaultX.append(obj.positions[0].longitude) + defaultY.append(obj.positions[0].latitude) # (CASE 1) if len(list(by_nominal_voltage_X.keys())) > 0: low_voltage = min(list(by_nominal_voltage_X.keys())) @@ -3445,8 +3445,8 @@ def write_network_file(self, model, **kwargs): # We also need the coordinates of this connection. # Use the coordinates of the Node if obj.positions is not None and len(obj.positions) > 0: - X = obj.positions[0].long - Y = obj.positions[0].lat + X = obj.positions[0].longitude + Y = obj.positions[0].latitude # If we don't have coordinates, then set to (0,0).... else: X = 0 @@ -3980,8 +3980,8 @@ def write_load_file(self, model, **kwargs): self.nodeID_list.append(i.name) if hasattr(i, "positions") and i.positions is not None: try: - X = i.positions[0].long - Y = i.positions[0].lat + X = i.positions[0].longitude + Y = i.positions[0].latitude except: X = 0 Y = 0 diff --git a/ditto/writers/ephasor/write.py b/ditto/writers/ephasor/write.py index de5f3f04..52d81e6d 100644 --- a/ditto/writers/ephasor/write.py +++ b/ditto/writers/ephasor/write.py @@ -125,8 +125,8 @@ def write_bus_coordinates(self, **kwargs): logger.debug( "{name} {X} {Y}\n".format( name=i.name.lower(), - X=i.positions[0].lat, - Y=i.positions[0].long, + X=i.positions[0].latitude, + Y=i.positions[0].longitude, ) ) diff --git a/ditto/writers/opendss/write.py b/ditto/writers/opendss/write.py index fada3a0c..9dd8634e 100644 --- a/ditto/writers/opendss/write.py +++ b/ditto/writers/opendss/write.py @@ -342,7 +342,9 @@ def write_bus_coordinates(self, model): txt = feeder_text_map[substation_name + "_" + feeder_name] txt += "{name} {X} {Y}\n".format( - name=i.name.lower(), X=i.positions[0].lat, Y=i.positions[0].long + name=i.name.lower(), + X=i.positions[0].latitude, + Y=i.positions[0].longitude, ) feeder_text_map[substation_name + "_" + feeder_name] = txt