Skip to content

Commit

Permalink
Read network area diagram metadata from JSON format (#103)
Browse files Browse the repository at this point in the history
Signed-off-by: Massimo Ferraro <massimo.ferraro@soft.it>
  • Loading branch information
massimo-ferraro authored and flo-dup committed Nov 4, 2024
1 parent d046ef4 commit 0a3c2a9
Show file tree
Hide file tree
Showing 19 changed files with 2,155 additions and 636 deletions.
17 changes: 15 additions & 2 deletions demo/src/diagram-viewers/add-diagrams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
*/

import NadSvgExample from './data/nad-eurostag-tutorial-example1.svg';
import NadSvgExampleMeta from './data/nad-eurostag-tutorial-example1_metadata.json';
import NadSvgPstHvdcExample from './data/nad-four-substations.svg';
import NadSvgPstHvdcExampleMeta from './data/nad-four-substations_metadata.json';
import NadSvgMultibusVLNodesExample from './data/nad-ieee9-zeroimpedance-cdf.svg';
import NadSvgMultibusVLNodesExampleMeta from './data/nad-ieee9-zeroimpedance-cdf_metadata.json';
import NadSvgMultibusVLNodes14Example from './data/nad-ieee14cdf-solved.svg';
import NadSvgTrheeWTDanglingLineUnknownBusExample from './data/nad-scada.svg';
import NadSvgMultibusVLNodes14ExampleMeta from './data/nad-ieee14cdf-solved_metadata.json';
import NadSvgThreeWTDanglingLineUnknownBusExample from './data/nad-scada.svg';
import NadSvgThreeWTDanglingLineUnknownBusExampleMeta from './data/nad-scada_metadata.json';
import NadSvgPartialNetworkExample from './data/nad-ieee300cdf-VL9006.svg';
import NadSvgPartialNetworkExampleMeta from './data/nad-ieee300cdf-VL9006_metadata.json';
import SldSvgExample from './data/sld-example.svg';
import SldSvgExampleMeta from './data/sld-example-meta.json';
import SldSvgSubExample from './data/sld-sub-example.svg';
Expand All @@ -37,6 +43,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad')!,
svgContent,
NadSvgExampleMeta,
500,
600,
1000,
Expand All @@ -62,6 +69,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-no-moving')!,
svgContent,
NadSvgExampleMeta,
500,
600,
1000,
Expand All @@ -87,6 +95,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-multibus-vlnodes')!,
svgContent,
NadSvgMultibusVLNodesExampleMeta,
500,
600,
1000,
Expand All @@ -112,6 +121,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-multibus-vlnodes14')!,
svgContent,
NadSvgMultibusVLNodes14ExampleMeta,
500,
600,
1000,
Expand All @@ -137,6 +147,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-pst-hvdc')!,
svgContent,
NadSvgPstHvdcExampleMeta,
500,
600,
1000,
Expand All @@ -156,12 +167,13 @@ export const addNadToDemo = () => {
.setAttribute('style', 'border:2px; border-style:solid;');
});

fetch(NadSvgTrheeWTDanglingLineUnknownBusExample)
fetch(NadSvgThreeWTDanglingLineUnknownBusExample)
.then((response) => response.text())
.then((svgContent) => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-threewt-dl-ub')!,
svgContent,
NadSvgThreeWTDanglingLineUnknownBusExampleMeta,
500,
600,
1000,
Expand All @@ -187,6 +199,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-partial-network')!,
svgContent,
NadSvgPartialNetworkExampleMeta,
500,
600,
1000,
Expand Down
30 changes: 0 additions & 30 deletions demo/src/diagram-viewers/data/nad-eurostag-tutorial-example1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
"layoutParameters" : {
"textNodesForceLayout" : false,
"springRepulsionFactorForceLayout" : 0.0,
"textNodeFixedShift" : {
"x" : 100.0,
"y" : -40.0
},
"maxSteps" : 1000,
"textNodeEdgeConnectionYShift" : 25.0
},
"svgParameters" : {
"diagramPadding" : {
"left" : 200.0,
"top" : 200.0,
"right" : 200.0,
"bottom" : 200.0
},
"insertNameDesc" : false,
"svgWidthAndHeightAdded" : false,
"cssLocation" : "INSERTED_IN_SVG",
"sizeConstraint" : "FIXED_SCALE",
"fixedWidth" : -1,
"fixedHeight" : -1,
"fixedScale" : 0.2,
"arrowShift" : 30.0,
"arrowLabelShift" : 19.0,
"converterStationWidth" : 70.0,
"voltageLevelCircleRadius" : 30.0,
"fictitiousVoltageLevelCircleRadius" : 15.0,
"transformerCircleRadius" : 20.0,
"nodeHollowWidth" : 15.0,
"edgesForkLength" : 80.0,
"edgesForkAperture" : 60.0,
"edgeStartShift" : 0.0,
"unknownBusNodeExtraRadius" : 10.0,
"loopDistance" : 120.0,
"loopEdgesAperture" : 60.0,
"loopControlDistance" : 40.0,
"edgeInfoAlongEdge" : true,
"edgeNameDisplayed" : true,
"interAnnulusSpace" : 5.0,
"svgPrefix" : "",
"idDisplayed" : false,
"substationDescriptionDisplayed" : false,
"arrowHeight" : 10.0,
"busLegend" : true,
"voltageLevelDetails" : false,
"languageTag" : "en",
"voltageValuePrecision" : 1,
"powerValuePrecision" : 0,
"angleValuePrecision" : 1,
"currentValuePrecision" : 0,
"edgeInfoDisplayed" : "ACTIVE_POWER",
"pstArrowHeadSize" : 8.0,
"undefinedValueSymbol" : ""
},
"busNodes" : [ {
"svgId" : "1",
"equipmentId" : "VLGEN_0",
"nbNeighbours" : 0,
"index" : 0,
"vlNode" : "0"
}, {
"svgId" : "3",
"equipmentId" : "VLHV1_0",
"nbNeighbours" : 0,
"index" : 0,
"vlNode" : "2"
}, {
"svgId" : "5",
"equipmentId" : "VLHV2_0",
"nbNeighbours" : 0,
"index" : 0,
"vlNode" : "4"
}, {
"svgId" : "7",
"equipmentId" : "VLLOAD_0",
"nbNeighbours" : 0,
"index" : 0,
"vlNode" : "6"
} ],
"nodes" : [ {
"svgId" : "0",
"equipmentId" : "VLGEN",
"x" : -452.59,
"y" : -274.01
}, {
"svgId" : "2",
"equipmentId" : "VLHV1",
"x" : -245.26,
"y" : 34.3
}, {
"svgId" : "4",
"equipmentId" : "VLHV2",
"x" : 140.33,
"y" : 58.61
}, {
"svgId" : "6",
"equipmentId" : "VLLOAD",
"x" : 430.9,
"y" : -174.05
} ],
"edges" : [ {
"svgId" : "8",
"equipmentId" : "NGEN_NHV1",
"node1" : "0",
"node2" : "2",
"busNode1" : "1",
"busNode2" : "3",
"type" : "TwoWtEdge"
}, {
"svgId" : "9",
"equipmentId" : "NHV1_NHV2_1",
"node1" : "2",
"node2" : "4",
"busNode1" : "3",
"busNode2" : "5",
"type" : "LineEdge"
}, {
"svgId" : "10",
"equipmentId" : "NHV1_NHV2_2",
"node1" : "2",
"node2" : "4",
"busNode1" : "3",
"busNode2" : "5",
"type" : "LineEdge"
}, {
"svgId" : "11",
"equipmentId" : "NHV2_NLOAD",
"node1" : "4",
"node2" : "6",
"busNode1" : "5",
"busNode2" : "7",
"type" : "TwoWtEdge"
} ],
"textNodes" : [ {
"svgId" : "0-textnode",
"equipmentId" : "VLGEN",
"vlNode" : "0",
"shiftX" : 100.0,
"shiftY" : -40.0,
"connectionShiftX" : 100.0,
"connectionShiftY" : -15.0
}, {
"svgId" : "2-textnode",
"equipmentId" : "VLHV1",
"vlNode" : "2",
"shiftX" : 100.0,
"shiftY" : -40.0,
"connectionShiftX" : 100.0,
"connectionShiftY" : -15.0
}, {
"svgId" : "4-textnode",
"equipmentId" : "VLHV2",
"vlNode" : "4",
"shiftX" : 100.0,
"shiftY" : -40.0,
"connectionShiftX" : 100.0,
"connectionShiftY" : -15.0
}, {
"svgId" : "6-textnode",
"equipmentId" : "VLLOAD",
"vlNode" : "6",
"shiftX" : 100.0,
"shiftY" : -40.0,
"connectionShiftX" : 100.0,
"connectionShiftY" : -15.0
} ]
}
34 changes: 0 additions & 34 deletions demo/src/diagram-viewers/data/nad-four-substations.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0a3c2a9

Please sign in to comment.