Skip to content

Commit

Permalink
Documentation... and refactoring (#517)
Browse files Browse the repository at this point in the history
* Major dev documentation update
* Refactor: Simplify LegBusSet
* Refactor: renaming of LegBusSet/HorizontalBusLane/LBSCluster/VBSClusterSide to VerticalBusSet/HorizontalBusList/BSCluster/BSClusterSide
* Refactor: renaming PositionFromExtension into PositionPredefined 
* Refactor: create new packages layout.position, layout.position.clustering and layout.position.predefined: new packages to separate the PositionFinder implementations from the rest of the layout package
* Refactor: Clarify PositionFinder interface by transferring some of particulars methods to AbstractPositionFinder
* Refactor: HorizontalBusListManager functional interface is now directly within PositionPredefined and PositionByClustering which should reduce the complexity...
* Refactor: Remove cyclic dependency between Links and BSClusterSide.
  • Loading branch information
BenoitJeanson authored Apr 5, 2024
1 parent 1c56723 commit 6b08e09
Show file tree
Hide file tree
Showing 55 changed files with 4,331 additions and 3,618 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import com.powsybl.sld.cgmes.dl.conversion.CgmesDLExporter;
import com.powsybl.sld.cgmes.dl.conversion.CgmesDLUtils;
import com.powsybl.sld.layout.*;
import com.powsybl.sld.layout.positionbyclustering.PositionByClustering;
import com.powsybl.sld.layout.positionfromextension.PositionFromExtension;
import com.powsybl.sld.layout.position.clustering.PositionByClustering;
import com.powsybl.sld.layout.position.predefined.PositionPredefined;
import com.powsybl.tools.Command;
import com.powsybl.tools.Tool;
import com.powsybl.tools.ToolOptions;
Expand Down Expand Up @@ -46,7 +46,7 @@ public class LayoutToCgmesDlExporterTool implements Tool {
private static final String DIAGRAM_NAME = "diagram-name";

private final Map<String, VoltageLevelLayoutFactory> voltageLevelsLayouts
= Map.ofEntries(Map.entry("auto-extensions", new PositionVoltageLevelLayoutFactory(new PositionFromExtension())),
= Map.ofEntries(Map.entry("auto-extensions", new PositionVoltageLevelLayoutFactory(new PositionPredefined())),
Map.entry(DEFAULT_VOLTAGE_LAYOUT, new PositionVoltageLevelLayoutFactory(new PositionByClustering())));

private final Map<String, SubstationLayoutFactory> substationsLayouts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.powsybl.sld.cgmes.dl.conversion.CgmesDLUtils;
import com.powsybl.sld.cgmes.dl.iidm.extensions.*;
import com.powsybl.sld.layout.*;
import com.powsybl.sld.layout.positionbyclustering.PositionByClustering;
import com.powsybl.sld.layout.position.clustering.PositionByClustering;
import com.powsybl.sld.library.ComponentTypeName;
import com.powsybl.sld.model.coordinate.Orientation;
import com.powsybl.sld.model.graphs.*;
Expand Down
43 changes: 43 additions & 0 deletions single-line-diagram/single-line-diagram-core/doc/BSCluster.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
= `BSCluster`

== Definition
`BSCluster` (`BusNode` Sets Cluster) are used by implementations of `PositionFinder`.

****
It is composed of 2 kinds of sets of `BusNode` Sets that present an horizontal and a vertical view of the structure of a `VoltageLevel`:
- `List<VerticalBusSet> verticalBusSets` see link:VerticalBusSet.adoc[VerticalBusSet]
- `List<HorizontalBusList> horizontalBusLists` see link:HorizontalBusList.adoc[HorizontalBusList]
****


[IMPORTANT]
====
`VerticalBusSet` is a `Set` as it is important to have no duplicate `BusNodes` whereas, it is possible to have duplicate `BusNodes` in the `HorizontalBusList`.
The rules are as follow:
- for `VerticalBusSet`, a `BusNode` may appear:
* in multiple `VerticalBusSets`,
* but only once in a `VerticalBusSet`;
- for `HorizontalBusList`, a `BusNode` may appear:
* multiple times in a `HorizontalBusList`, in that case the occurences shall have contiguous indexes,
* shall appear only in one single `HorizontalBusList`.
====

The goal is at the end to be able to merge the `VoltageLevel` into a single `BSCluster` having to this kind of pattern:

image::images/BSClusterFinal.svg[align="center"]

== Key methods

=== Build
A `BSCluster` is initiated with one `VerticalBusSet` that:

- is put as is as first element `verticalBusSets`,
- inititiates one `HorizontalBusList` for each of its `BusNode`

Each `PositionFinder` using `BSCluster` implementation provides a strategy to merge them together in order to get a single `BSCluster`.

=== Merge
The merge of 2 `BSClusters` is done by calling the `merge` method giving it a `HorizontalBusListManager`. Indeed if the merging of the `verticalBusSets` is just a concatenation, the merging of the `horizontalBusLists` differs from one `PositionFinder` to another.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,3 @@ Last, the second `ExternCell` cell is build with the second `SHUNT` node and the

.Descrimination of a `SHUNT` cell
image::images/rawGraphExternShunt.svg[align="center"]

'''
==== The `PatternCellDetector` class

This detector is based on pattern matching algorithm. The patterns are described in `/resources/pattern.xml`.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `HorizontalBusList`
Loading

0 comments on commit 6b08e09

Please sign in to comment.