-
Notifications
You must be signed in to change notification settings - Fork 6
Warn instead of crash when network contains voltage level without substation #4127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,16 +172,31 @@ export const NetworkMapPanel = memo(function NetworkMapPanel({ | |
| const [isInitialized, setIsInitialized] = useState(false); | ||
| const mapBoxToken = useMapBoxToken(); | ||
|
|
||
| const { snackError } = useSnackMessage(); | ||
| const { snackError, snackWarning } = useSnackMessage(); | ||
|
|
||
| const [filteredNominalVoltages, setFilteredNominalVoltages] = useState<number[]>(); | ||
| const [geoData, setGeoData] = useState<GeoData>(); | ||
| const geoDataRef = useRef<any>(null); | ||
|
|
||
| const basicDataReady = mapEquipments && geoData; | ||
|
|
||
| const voltageLevelIdsWithoutSubstation = useMemo(() => { | ||
| if (!mapEquipments) { | ||
| return []; | ||
| } | ||
|
|
||
| const voltageLevelIds = new Set([ | ||
| ...mapEquipments.getLines().flatMap((line) => [line.voltageLevelId1, line.voltageLevelId2]), | ||
| ...mapEquipments.getTieLines().flatMap((line) => [line.voltageLevelId1, line.voltageLevelId2]), | ||
| ...mapEquipments.getHvdcLines().flatMap((line) => [line.voltageLevelId1, line.voltageLevelId2]), | ||
| ]); | ||
|
|
||
| return Array.from(voltageLevelIds).filter((voltageLevelId) => !mapEquipments.getVoltageLevel(voltageLevelId)); | ||
| }, [mapEquipments]); | ||
|
Comment on lines
+183
to
+195
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 8 'updateLines|updateTieLines|updateHvdcLines' --glob '*.ts' --glob '*.tsx'
rg -n -C 8 'isMapEquipmentsInitialized|resetMapEquipment|mapEquipments' --glob '*.ts' --glob '*.tsx'Repository: gridsuite/gridstudy-app Length of output: 161 🏁 Script executed: #!/bin/bash
set -u
echo "Files matching network-map-panel:"
fd -a 'network-map-panel\.tsx$' . || true
echo
echo "Matching files count:"
git ls-files | grep 'network-map-panel\.tsx$' || true
echo
echo "Source snippets if file exists:"
if [ -f src/components/network/network-map-panel.tsx ]; then
wc -l src/components/network/network-map-panel.tsx
sed -n '1,230p' src/components/network/network-map-panel.tsx | cat -n
echo "---- update methods context ----"
rg -n -C 5 'updateLines|updateTieLines|updateHvdcLines|isMapEquipmentsInitialized|mapEquipments|setMapEquipments|useMemo' src/components/network/network-map-panel.tsx || true
else
echo "src/components/network/network-map-panel.tsx not found"
fi
echo
echo "All occurrences in tracked files:"
rg -n -C 5 'updateLines|updateTieLines|updateHvdcLines|isMapEquipmentsInitialized|mapEquipments|voltageLevelIdsWithoutSubstation' --unrestricted . || trueRepository: gridsuite/gridstudy-app Length of output: 50380 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Repository files for target component:"
git ls-files src/components/network/network-map-panel.tsx || true
if git ls-files src/components/network/network-map-panel.tsx | grep -q .; then
wc -l src/components/network/network-map-panel.tsx
echo "---- top 220 lines ----"
sed -n '1,220p' src/components/network/network-map-panel.tsx | cat -n
echo "---- lines 640-740 ----"
sed -n '640,740p' src/components/network/network-map-panel.tsx | cat -n
else
echo "target file absent"
fi
echo
echo "target identifiers in this file only:"
rg -n -C 4 'voltageLevelIdsWithoutSubstation|mapEquipments|useMemo|updateLines|updateTieLines|updateHvdcLines|isMapEquipmentsInitialized|getLines|getTieLines|getHvdcLines|getVoltageLevel|resetMapEquipment|setMapEquipments' src/components/network/network-map-panel.tsx || true
echo
echo "target identifiers in tracked ts/tsx files (limited matches):"
rg -n -C 3 'voltageLevelIdsWithoutSubstation|updateLines|updateTieLines|updateHvdcLines|isMapEquipmentsInitialized|resetMapEquipment|setMapEquipments' -g '*.ts' -g '*.tsx' --max-count 80 || trueRepository: gridsuite/gridstudy-app Length of output: 35982 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Locate GSMapEquipments:"
fd -a 'gs-map-equipments\.(ts|tsx)$' . | sed 's#^\./##' || true
if git ls-files | grep -q 'gs-map-equipments\.(ts|tsx)$'; then
file="$(git ls-files | grep 'gs-map-equipments\.\(ts\|tsx\)$' | head -n 1)"
echo "Selected file: $file"
wc -l "$file"
echo "---- outline ----"
ast-grep outline "$file" --view compact || true
echo "---- relevant methods ----"
rg -n -C 12 'class GSMapEquipments|constructor|reloadImpactedSubstationsEquipments|updateLines|updateTieLines|updateHvdcLines|updateSubstations|getLines\(|getTieLines\(|getHvdcLines\(|linesById|tieLinesById|hvdcLinesById|voltageLevelsById|checkAndGetValues' "$file" || true
fi
echo
echo "Relevant lines 720-960 in target component:"
if git ls-files src/components/network/network-map-panel.tsx | grep -q .; then
sed -n '720,960p' src/components/network/network-map-panel.tsx | cat -n
fi
echo
echo "Static invariant for useMemo deps vs known update actions in target component:"
python3 - <<'PY'
from pathlib import Path
import re
p = Path('src/components/network/network-map-panel.tsx')
s = p.read_text()
# Extract React useHook call contents and assignment-like direct calls from source text.
usememo = re.search(r"useMemo\s*\(\s*\(\)\s*=>\s*\{((?:[^}]|\n)*?)\};?\s*,\s*\[([^\]]*)\]\s*\)", s, re.S)
direct_calls = [
m.group(0)
for m in [
*re.finditer(r"mapEquipments\.(reset|removeEquipment|updateLines|updateTieLines|updateHvdcLines)\s*\(", s),
*re.finditer(r"updateEquipmentsByImpact\s*\(", s),
]
] if False else []
direct_calls += re.findall(r"mapEquipments\.(reset|removeEquipment|updateLines|updateTieLines|updateHvdcLines)\s*\(", s)
print("useMemo dependencies:", re.search(r"useMemo\s*\(\s*\(\)\s*=>\s*\{((?:[^}]|\n)*?)\},\s*\[([^\]]*)\]\s*\)", s, re.S).group(2).strip() if usememo else None)
print("mapEquipments mutation-looking direct calls:", list(set(direct_calls)))
start = s.find('// The component receives the MapEquipment') if s.find('// The component receives the MapEquipment') != -1 else 640
print(s[start:start+1200])
PYRepository: gridsuite/gridstudy-app Length of output: 13857 🏁 Script executed: #!/bin/bash
set -u
echo "Extract and inspect gs-map-equipments update methods:"
python3 - <<'PY'
from pathlib import Path
import re
p = Path('src/components/network/gs-map-equipments.ts')
text = p.read_text()
print('path', p)
print('lines', text.count('\n')+1)
methods = ['updateLines', 'updateTieLines', 'updateHvdcLines', 'updateSubstations', 'removeEquipment', 'checkAndGetValues', 'reset']
for name in methods:
m = re.search(
r'regex' if False else rf'{re.escape(name)}\s*[:=]?\s*(?:async\s+)?(?:function\s+)?[^(]*\(([^)]*)\)[^{{]*\{{(?:(?!\n\}}.)*|\n(?!\}}))*\n\}}',
text,
re.S
)
# Simpler line-oriented capture by class methods/callables
print('---', name, '---')
idx = text.find(f'{name}')
if idx == -1:
print('not found')
continue
start = text.rfind('\n',0,idx)+1
end = text.find('\n}', idx)
print(end-start if end!=-1 else (len(text)-start), 'chars around first occurrence')
snippet = '\n'.join(text[start:end].split('\n')[:160])
print(snippet)
PY
echo
echo "Search all tracked files for GSMapEquipments mutation body fragments:"
rg -n -C 4 '\.updateLines\s*\(|\.updateTieLines\s*\(|\.updateHvdcLines\s*\(|\.updateSubstations\s*\(|\.removeEquipment\s*\(|mapEquipments\.(linesById|tieLinesById|hvdcLinesById|substationsById|checkAndGetValues)\s*=' -g '*.ts' -g '*.tsx' --max-count 120 || trueRepository: gridsuite/gridstudy-app Length of output: 572 🌐 Web query:
💡 Result: The requested functions (updateLines, updateTieLines, updateHvdcLines, removeEquipment) are not part of a standard or widely known public API or library named src/components/network/gs-map-equipments.ts. Research indicates that this file path is likely specific to a private or custom-developed codebase. While there are similarly named methods in the Powsybl project (e.g., pypowsybl.network.Network.update_lines, update_tie_lines, update_hvdc_lines), these are part of a power system simulation framework and not a frontend mapping component [1][2][3][4][5]. The GSMap library mentioned in search results is a separate Google Maps wrapper and does not contain these specific equipment management functions [6]. If you are working within a specific project, these functions are likely custom methods implemented to manage the state of network equipment on a map visualization, such as updating line geometries or statuses and handling equipment removal from the application state [7][8]. I recommend checking the local source code definition of the gs-map-equipments.ts file in your project repository to understand the specific implementation details, parameters, and state management logic being used. Citations:
Recompute the missing voltage-level list after in-place map updates.
🤖 Prompt for AI Agents |
||
|
|
||
| const lineFullPathRef = useRef<boolean>(null); | ||
| const [isDialogSearchOpen, setIsDialogSearchOpen] = useState(false); | ||
| const voltageLevelWarningShownRef = useRef(false); | ||
|
|
||
| const { getBaseVoltageInterval } = useBaseVoltages(); | ||
|
|
||
|
|
@@ -210,6 +225,25 @@ export const NetworkMapPanel = memo(function NetworkMapPanel({ | |
| const currentNodeRef = useRef<CurrentTreeNode | null>(null); | ||
| const currentRootNetworkUuidRef = useRef<UUID | null>(null); | ||
|
|
||
| useEffect(() => { | ||
| if (!isInitialized) { | ||
| voltageLevelWarningShownRef.current = false; | ||
| } else if (voltageLevelIdsWithoutSubstation.length > 0 && !voltageLevelWarningShownRef.current) { | ||
| const voltageLevelIds = | ||
| voltageLevelIdsWithoutSubstation.length > 3 | ||
| ? voltageLevelIdsWithoutSubstation.slice(0, 3).join(', ') + ', ...' | ||
| : voltageLevelIdsWithoutSubstation.join(', '); | ||
| snackWarning({ | ||
| messageId: 'networkMapVoltageLevelsWithoutSubstation', | ||
| messageValues: { | ||
| voltageLevelCount: voltageLevelIdsWithoutSubstation.length, | ||
| voltageLevelIds: voltageLevelIds, | ||
| }, | ||
| }); | ||
| voltageLevelWarningShownRef.current = true; | ||
| } | ||
| }, [isInitialized, snackWarning, voltageLevelIdsWithoutSubstation]); | ||
|
Comment on lines
+228
to
+245
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 10 'NetworkMapPanel' --glob '*.ts' --glob '*.tsx'
rg -n -C 8 'setIsInitialized|currentNode' src/components/network/network-map-panel.tsxRepository: gridsuite/gridstudy-app Length of output: 161 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Tracked files around network map panel:\n'
git ls-files | rg '(^|/)network-map-panel\.tsx$|network' | sed -n '1,120p'
printf '\nCandidate NetworkMapPanel files:\n'
fd -a 'network-map-panel\.tsx$|NetworkMapPanel' . | sed -n '1,80p'
printf '\nSearch for network-map-panel.tsx text (case-insensitive filenames/symbol):\n'
rg -n 'NetworkMapPanel|network-map-panel|useEffect\(\(\) =>|voltageLevelWarningShownRef|voltageLevelIdsWithoutSubstation' . --glob '*.ts' --glob '*.tsx' | sed -n '1,200p'Repository: gridsuite/gridstudy-app Length of output: 32920 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'NetworkMapPanel outline:\n'
ast-grep outline src/components/network/network-map-panel.tsx --view compact | sed -n '1,220p'
printf '\nNetworkMapPanel relevant source slices:\n'
sed -n '1,260p' src/components/network/network-map-panel.tsx
printf '\n---\n'
sed -n '820,935p' src/components/network/network-map-panel.tsx
printf '\nMapPanelContent and remount prop/key evidence:\n'
sed -n '1,80p' src/components/workspace/panel-contents/map-panel-content.tsx
printf '\nAll NetworkMapPanel references with file context:\n'
rg -n -C 8 'NetworkMapPanel|isInitialized|currentNode|studyUuid|currentRootNetworkUuid' --glob '*.ts' --glob '*.tsx' . | sed -n '1,260p'Repository: gridsuite/gridstudy-app Length of output: 337 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'NetworkMapPanel outline:\n'
ast-grep outline src/components/network/network-map-panel.tsx --view signatures | sed -n '1,220p'
printf '\nNetworkMapPanel relevant source slices:\n'
sed -n '1,260p' src/components/network/network-map-panel.tsx
printf '\n---\n'
sed -n '820,935p' src/components/network/network-map-panel.tsx
printf '\nMapPanelContent and remount prop/key evidence:\n'
sed -n '1,80p' src/components/workspace/panel-contents/map-panel-content.tsx
printf '\nAll NetworkMapPanel references with file context:\n'
rg -n -C 8 'NetworkMapPanel|isInitialized|currentNode|studyUuid|currentRootNetworkUuid' --glob '*.ts' --glob '*.tsx' . | sed -n '1,260p'Repository: gridsuite/gridstudy-app Length of output: 36637 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'NetworkMapPanel node reload slices:\n'
sed -n '820,965p' src/components/network/network-map-panel.tsx
printf '\nRead-only probe of reset/currentId flow from source text:\n'
python3 - <<'PY'
from pathlib import Path
import re
p = Path('src/components/network/network-map-panel.tsx')
s = p.read_text()
warning_effect = re.search(
r'const voltageLevelWarningShownRef = useRef\(false\);[\s\S]*?useEffect\(\(\) => \{\n([\s\S]*?)\n }, \[isInitialized, snackWarning, voltageLevelIdsWithoutSubstation\]\);',
s
)
reload_effect = re.search(
r'useEffect\(let previousCurrentNode = currentNodeRef\.current;([\s\S]*?)\n \],\n\s*\[\s*([^\]]+)\]',
s[s.index('useEffect(let previousCurrentNode'):]
)
print('Warning effect uses voltageLevelWarningShownRef.current reset only when isInitialized:', bool(warning_effect and '!isInitialized' in warning_effect.group(1)))
print('Node effect references setIsInitialized explicitly:', bool(re.findall(r'isInitialized|setIsInitialized', reload_effect.group(1))))
print('MapPanelContent keys NetworkMapPanel:', bool(re.search(r'<NetworkMapPanel\s+[^>]*key\s=', Path('src/components/workspace/panel-contents/map-panel-content.tsx').read_text())))
print('Component memoized:', '<NetworkMapPanel' in s)
PYRepository: gridsuite/gridstudy-app Length of output: 6255 Reset the voltage-level warning when the selected node changes.
🤖 Prompt for AI Agents |
||
|
|
||
| const [updatedLines, setUpdatedLines] = useState<MapLineWithType[]>([]); | ||
| const [updatedTieLines, setUpdatedTieLines] = useState<MapTieLineWithType[]>([]); | ||
| const [updatedHvdcLines, setUpdatedHvdcLines] = useState<MapHvdcLineWithType[]>([]); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,7 @@ | |
| "svgNotFound": "Diagram has not been found: {error}; {svgUrl}", | ||
| "networkLoadingFail": "Network of study with id \"{studyUuid}\" couldn't be loaded", | ||
| "geoDataLoadingFail": "An error occurred while loading geographical data.", | ||
| "networkMapVoltageLevelsWithoutSubstation": "{voltageLevelCount} voltage levels are not attached to a substation and therefore are not displayed. Examples: {voltageLevelIds}", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Use plural-aware translations for the warning.
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
| "parameters": "Parameters", | ||
| "close": "Close", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: gridsuite/gridstudy-app
Length of output: 161
🏁 Script executed:
Repository: gridsuite/gridstudy-app
Length of output: 50382
🏁 Script executed:
Repository: gridsuite/gridstudy-app
Length of output: 471
🏁 Script executed:
Repository: gridsuite/gridstudy-app
Length of output: 28355
🏁 Script executed:
Repository: gridsuite/gridstudy-app
Length of output: 14972
🌐 Web query:
@powsybl/network-viewer 3.6.0 MapEquipments getVoltageLevel source💡 Result:
In the
@powsybl/network-viewer3.6.0 library, MapEquipments is a type/interface used in the network map component, primarily for managing network data structures [1]. It is not a class containing a getVoltageLevel method. If you are encountering a getVoltageLevel method in relation to PowSyBl, it is likely part of the underlying IIDM (Integrated Interoperability Data Model) API, which is the Java-based data model library used by PowSyBl for grid network modeling [2][3]. In the IIDM Java API, Network and Bus objects have getVoltageLevel methods to retrieve voltage level information [2][4]. For TypeScript/JavaScript development with@powsybl/network-viewer, if you are looking for how to access voltage levels for map equipment, you should check the metadata and data structures passed to the viewer, which are typically generated by the powsybl-diagram tool [5]. The network viewer library itself is primarily focused on rendering SVG diagrams and map layers [5][6].Citations:
🌐 Web query:
github powsybl network-viewer MapEquipments getVoltageLevel💡 Result:
In the PowSyBl ecosystem, MapEquipments and getVoltageLevel do not refer to a single combined method, but rather to distinct concepts used across different libraries: 1. MapEquipments: This is a type (or interface) primarily used within the powsybl-network-viewer library [1][2]. It represents a collection of network equipment used for map visualizations. It is often passed to functions that handle map-based network data, such as calculating line positions or filtering equipment [1][2]. 2. getVoltageLevel(s): This is an API method found in the PowSyBl IIDM (Interface for Integrated Data Model) core Java library [3]. It is used to retrieve voltage level information from a network model. Specifically: - In the Java API, the Network interface provides methods such as getVoltageLevel(String id) to retrieve a specific voltage level [3] and getVoltageLevels to retrieve an Iterable of all voltage levels [3]. - In PyPowSyBl (the Python wrapper), there is a corresponding method net.get_voltage_levels [4][5] used to interact with these network objects, often returning data as a pandas DataFrame [5]. There is no standard method named getVoltageLevel on a MapEquipments object. If you are encountering these terms together, it is likely that your code is using MapEquipments to manage the view layer (e.g., in a TypeScript/React network-map-viewer) while separately calling getVoltageLevel from the underlying IIDM/network model to fetch technical data [3][6]. Note: The search results also identified a MapEquipment function in the demoinfocs-golang project [7][8], which is an unrelated Go library for parsing Counter-Strike demo files; this should be disregarded if you are working within the PowSyBl energy grid simulation framework.
Citations:
🌐 Web query:
site:github.com/powsybl/powsybl-network-viewer "getVoltageLevel" "MapEquipments"💡 Result:
Based on the Powsybl network viewer documentation and repository, getVoltageLevel is not a standard method or property associated with a class named MapEquipments. The term MapEquipments appears in the
@powsybl/network-map-layerspackage as a type or data structure for handling network equipment on a map [1][2]. In the Powsybl ecosystem: 1. Voltage levels are typically managed through objects that track metadata such as voltage level ID, bus values (ID, voltage, angle), and state updates [3][4]. 2. Methods for interacting with voltage level information are usually named setVoltageLevelStates or similar, found within diagram viewer components [4][5]. 3. MapEquipments is a type used in the context of Deck.gl layers for map visualization, rather than a class with a getVoltageLevel retrieval method [1][2]. If you are encountering an error regarding a missing getVoltageLevel method, it is likely that the method is not defined on the MapEquipments object, or the object is not the correct type intended to hold voltage-specific metadata. You may need to verify the interface of the object you are interacting with in your TypeScript project [1].Citations:
🌐 Web query:
"getVoltageLevel" "@powsybl/network-viewer" "3.6.0"💡 Result:
There is no function or method named getVoltageLevel within the
@powsybl/network-viewer(or@powsybl/network-viewer-core) library version 3.6.0 [1][2][3]. The@powsybl/network-viewerpackage is a TypeScript/JavaScript frontend library designed to render network diagrams (such as Network Area Diagrams and Single Line Diagrams) using SVG data generated by the powsybl-diagram backend [1][2]. It does not contain the IIDM (Common Grid Model) network data processing logic, where methods like getVoltageLevel typically reside [1][4]. If you are looking for getVoltageLevel, it is a method found in the backend Java PowSyBl core library (com.powsybl:powsybl-core) used to interact with the IIDM network model [5][6][7]. In the context of Python-based PowSyBl tools, similar functionality is available through pypowsybl [8]. If you are developing a frontend application and need information about voltage levels that are being displayed, you would typically access the metadata JSON files associated with the SVGs generated by the powsybl-diagram backend, rather than calling a specific getVoltageLevel function in the viewer library [1][2].Citations:
🌐 Web query:
npm view@powsybl/network-viewer@3.6.0 dist.tarball💡 Result:
The tarball URL for
@powsybl/network-viewerversion 3.6.0 is https://registry.npmjs.org/@powsybl/network-viewer/-/network-viewer-3.6.0.tgz [1]. This package is a TypeScript library used to integrate PowSyBl network viewers into JavaScript projects [1]. Version 3.6.0 was published on July 10, 2026 [1]. As per standard npm registry conventions, the dist.tarball for a scoped package is located at the URL pattern: https://registry.npmjs.org/@scope/package-name/-/package-name-version.tgz [1].Citations:
🌐 Web query:
registry.npmjs.org/@powsybl/network-viewer/-/network-viewer-3.6.0.tgz getVoltageLevel💡 Result:
The term getVoltageLevel is not a direct method or function in the
@powsybl/network-viewerTypeScript library [1][2][3].@powsybl/network-vieweris a TypeScript library used for integrating PowSyBl network diagrams (such as Network Area Diagrams and Single-Line Diagrams) and network maps into JavaScript projects [1][2]. Its core functionality focuses on rendering and visualization rather than the direct server-side or data-model management of the power network itself [1][3]. However, the method getVoltageLevel is a standard and widely used function within the core PowSyBl Java-based IIDM (Interface for Integrated Data Models) API [4][5][6]. In the Java backend, this method is implemented across various components to retrieve parent or related voltage level information [7]: - Network class: Retrieves a specific substation voltage level by ID [4]. - Bus class: Retrieves the voltage level to which a bus belongs [8][6]. - Terminal class: Retrieves the substation to which a terminal belongs [5]. - Switch class: Retrieves the parent voltage level of the switch [7]. If you are encountering this term in the context of your project, it is likely that you are either referring to the Java backend data model that provides the metadata used by the network viewer [2][3], or you may be confusing the network viewer's client-side API (which includes methods like setVoltageLevelStates to update legend information) with the backend IIDM API [9][10]. The TypeScript library does provide setVoltageLevelStates to customize or update values (such as voltage and angle) within the default voltage level legend of the diagrams [9][10].Citations:
🌐 Web query:
api@powsybl/network-viewerMapEquipments newGSMapEquipmentForUpdate💡 Result:
Based on the available documentation and codebase for the
@powsybl/network-viewerproject, there is no public API or documented function named newGSMapEquipmentForUpdate [1][2][3]. The string "newGSMapEquipmentForUpdate" appears to be highly specific or potentially internal to the library, as it does not appear in the public API exports, TypeScript definitions, or official documentation for@powsybl/network-viewer[1][2][4]. If you are encountering this term in a specific file or context, it is likely part of the library's internal test utilities or private helper methods, such as those found within packages/network-map-layers/src/testUtils/network-fixtures.ts [5]. It is not a supported method for end-users to interact with the network map or equipment objects. For official ways to manage and update network equipment, users are encouraged to refer to the standard Pypowsybl or PowSyBl Core APIs, which support network data updates via standard patterns like Network.update_from_file [6][7].Citations:
🌐 Web query:
"exports":{"mapEquipments"@powsybl/network-viewer``💡 Result:
In the context of the
@powsybl/network-viewerTypeScript library, MapEquipments is a type/interface used to structure network data (such as substations and lines) for map visualization [1][2][3]. It is not an export function itself, but rather a data type used as a parameter or dependency within the library's internal components, such as when processing selected network elements or preparing network fixtures [1][2]. If you are looking for how to export network data within the broader PowSyBl ecosystem, please note the distinction between the visualization library (@powsybl/network-viewer) and the core network processing frameworks (Powsybl Core/Pypowsybl): 1.@powsybl/network-viewer: This library is designed for integrating network diagrams (NAD, SLD) and map visualizations into web applications [4][5][6]. It does not provide general-purpose network file export functionality; its exported types (like MapEquipments) are used for internal data handling within the frontend components [1][4]. 2. Powsybl Core (Java) & Pypowsybl (Python): These frameworks are responsible for loading, manipulating, and exporting network data [7][8]. If you need to export a network, you should use the methods provided by the Network object in these libraries [7][8]: - Pypowsybl: Use network.save('filename.format', format='FORMAT') [8]. Supported formats include XIIDM, BIIDM, JIIDM, CGMES, and PSS/E [8]. - Powsybl Core (Java): Use n.write(FORMAT, properties, path) or NetworkSerDe.write(n, options, path) [7]. In summary, MapEquipments is a type defined in@powsybl/network-viewerto support map rendering [1][2], whereas network export operations are handled by the Powsybl backend libraries via dedicated save or write methods [7][8].Citations:
Add a missing local fallback for
getVoltageLevel.GSMapEquipmentsand@powsybl/network-viewerdo not define this method, so!mapEquipments.getVoltageLevel(...)will fail at runtime for this warning path.🤖 Prompt for AI Agents