Skip to content

Feature/fixed pole positions#20

Draft
CelinaKellinghaus wants to merge 2 commits into
mainfrom
feature/fixed-pole-positions
Draft

Feature/fixed pole positions#20
CelinaKellinghaus wants to merge 2 commits into
mainfrom
feature/fixed-pole-positions

Conversation

@CelinaKellinghaus

Copy link
Copy Markdown
Collaborator

Adds an initial implementation to keep manually moved poles (is_fixed = 1.0) in place after grid optimization.
This avoids changes to the core optimization logic.

Fixed pole coordinates are:

  1. stored before optimization
  2. reassigned afterward by moving the nearest optimized poles to those positions

Limitations / TODOs:

  • No handling of conflicts (e.g. multiple fixed positions using the same pole)
  • No checks for insufficient number of poles
  • No distance threshold applied yet

@paulapreuss paulapreuss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there is still the links missing for this implementation to fully do its thing. In general, I think we can keep it quite simple, so if we test around a bit and it works fine, that's good by me. What I am most concerned about currently is the link lengths getting a bit out of control without any safeguards. In a parallel PR, I am working on the poles along roads feature, and here the approach will more likely be to place the poles first and then run the optimization. However, this is also still WIP here

def _extract_fixed_poles(self):
fixed = self.nodes[
(self.nodes["node_type"] == "pole") &
(self.nodes["is_fixed"] == 1.0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(self.nodes["is_fixed"] == 1.0)
(self.nodes["is_fixed"] == True)

Isn't this usually a boolean? It evaluates correctly but just for clarity

Comment on lines +1811 to +1813
if nearest_pole_label is not None:
self.nodes.loc[nearest_pole_label, "latitude"] = lat_fixed
self.nodes.loc[nearest_pole_label, "longitude"] = lon_fixed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works so far for the nodes but the links are missing, so the cables still point to the old coordinates (where there is now no pole)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants