### Build Project Executable Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/simulator/build.md Configures the main project, installs the executable, and specifies build type and installation prefix. ```bash $> cd .. $> cmake .. -DCMAKE_INSTALL_PREFIX= -DCMAKE_BUILD_TYPE= $> cmake --build . --target install ``` -------------------------------- ### Install Build Dependencies on Ubuntu 20.04+ Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/simulator/build.md Installs essential packages for building the Metrix simulator on Ubuntu 20.04 and later versions. ```bash $> apt install -y cmake g++ git libboost-all-dev libxml2-dev make ``` -------------------------------- ### Build Documentation Locally Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/README.md Install dependencies and build the documentation locally. Open the generated HTML file in your browser to preview. ```bash pip install -r docs/requirements.txt sphinx-build -a docs ./build-docs ``` -------------------------------- ### Install Build Dependencies on Ubuntu 18.04 Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/simulator/build.md Installs necessary build tools and libraries for Ubuntu 18.04, including a manual CMake installation. ```bash $> apt install -y g++ git libboost-all-dev libxml2-dev make wget ``` -------------------------------- ### METRIX Network Topology Example Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/tests_reference/groupes/limitation_curatif/metrixOut.txt Illustrates the network topology used in the METRIX simulation, showing connections between nodes. ```text Lancement de METRIX sans curatif topologique Mode de calcul : OPF Noeud bilan : 0 0(5) <-> 5 [FVERGE11_L](4) <-> 1(5) <-> 3 [FSSV.O11_L](4) <-> 2(4) |=| 4 [FVALDI11_L, FVALDI11_L2](4) <-> 6(2) <-> 1(5) ``` -------------------------------- ### Java Metrix Analysis Setup Source: https://github.com/powsybl/powsybl-metrix/blob/main/README.md This Java code demonstrates how to set up and run a Metrix analysis using various Powsybl components. It requires network sources, time series stores, contingency providers, mapping scripts, Metrix configuration, remedial actions, and result listeners. ```java ComputationManager computationManager = LocalComputationManager.getDefault(); // Network NetworkSource networkSource = new DefaultNetworkSourceImpl(Paths.get("/path/to/case.xiidm"), computationManager) // Timeseries InMemoryTimeSeriesStore store = new InMemoryTimeSeriesStore(); store.importTimeSeries(Collections.singletonList(Paths.get("/path/to/timeseries.csv"))); // Contingencies ContingenciesProvider contingenciesProvider = new GroovyDslContingenciesProvider(Paths.get("/path/to/contingencies.groovy")); // Mapping Supplier mappingReader = () -> Files.newBufferedReader(Paths.get("/path/to/mapping.groovy"), StandardCharsets.UTF_8); // Metrix config Supplier metrixDslReader = () -> Files.newBufferedReader(Paths.get("/path/to/metrixConfig.groovy"), StandardCharsets.UTF_8); // Remedial actions Supplier remedialActionsReader = () -> Files.newBufferedReader(Paths.get("/path/to/remedialActions.txt"), StandardCharsets.UTF_8); // Result timeseries store FileSystemTimeSeriesStore resultStore = new FileSystemTimeSeriesStore(Paths.get("/path/to/outputdir")); // Result listener ResultListener listener = new ResultListener() { @Override public void onChunkResult(int version, int chunk, List timeSeriesList, Network networkPoint){ resultStore.importTimeSeries(timeSeriesList, version, false); } } // Run metrix configuration analysis MetrixAnalysis metrixAnalysis = new MetrixAnalysis(networkSource, mappingReader, metrixDslReader, remedialActionsReader, contingenciesProvider, store, logger, computationRange); MetrixAnalysisResult analysisResult = metrixAnalysis.runAnalysis("extern tool"); // Run metrix Metrix metrix = new Metrix(remedialActionsReader, store, resultStore, logArchive, computationManager, logger, analysisResult) MetrixRunParameters runParams = new MetrixRunParameters(firstVariant, variantCount, versions, chunkSize, true, true, false); metrix.run(runParams, listener); ``` -------------------------------- ### Install Build Dependencies on CentOS 8 Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/simulator/build.md Installs required development packages and tools for building on CentOS 8. ```bash $> yum install -y boost-devel gcc-c++ git libxml2-devel make wget ``` -------------------------------- ### Powsybl Metrix Specific Parameter Configuration Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/metrix.md Example of configuring specific parameters for the Powsybl Metrix solver, overriding default values. Note that negative values must be enclosed in parentheses. ```groovy parameters { computationType OPF_WITHOUT_REDISPATCHING nbMaxCurativeAction 3 preCurativeResults true withAdequacyResults true nbThreatResults 5 } ``` -------------------------------- ### Configure Intersphinx Mapping Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/README.md Add external documentation repositories to the Sphinx configuration. Use the same naming convention as the version in pom.xml for keys. URLs must start with 'https://' and end with '/'. ```python # This parameter might already be present, just add the new value intersphinx_mapping = { "powsyblcore": ("https://powsybl-core.readthedocs.io/en/latest/", None), } ``` -------------------------------- ### Example Remedial Actions Configuration Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/metrix.md An example illustrating the definition of multiple remedial actions for a contingency, including variations in actions and counts. ```text NB;4; FS.BIS1 FSSV.O1 1;1;FS.BIS1_FS.BIS1_DJ_OMN; FS.BIS1 FSSV.O1 1;1;FSSV.O1_FSSV.O1_DJ_OMN; FS.BIS1 FSSV.O1 1;2;FS.BIS1_FS.BIS1_DJ_OMN;FSSV.O1_FSSV.O1_DJ_OMN; FS.BIS1 FSSV.O1 1;1;FS.BIS1 FSSV.O1 2; ``` -------------------------------- ### Download Sirius Solver using ExternalProject Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/external/CMakeLists.txt Configures the download, build, and installation of the Sirius solver using CMake's ExternalProject module. It specifies the Git repository, tag, and build arguments. ```cmake ExternalProject_Add(sirius_solver INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/sirius_solver TMP_DIR ${TMP_DIR} STAMP_DIR ${DOWNLOAD_DIR}/sirius_solver-stamp SOURCE_DIR ${DOWNLOAD_DIR}/sirius_solver BINARY_DIR ${DOWNLOAD_DIR}/sirius_solver-build GIT_REPOSITORY ${sirius_solver_url} GIT_TAG origin/metrix CMAKE_CACHE_ARGS -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} ) ``` -------------------------------- ### Create itools Alias for Independent Use Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/index.md If you have multiple versions of itools installed, create an alias to use a specific version independently. Replace the placeholder with the actual path to your itools-metrix installation. ```shell alias itoolsmetrix='/bin/itools' ``` -------------------------------- ### Manual CMake Installation for Ubuntu 18.04 Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/simulator/build.md Installs a specific version of CMake manually on Ubuntu 18.04, as the default version is too old. ```bash $> wget https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz $> tar xzf cmake-3.12.0-Linux-x86_64.tar.gz $> export PATH=$PWD/cmake-3.12.0-Linux-x86_64/bin:$PATH ``` -------------------------------- ### Download SuiteSparse using ExternalProject Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/external/CMakeLists.txt Configures the download, build, and installation of the SuiteSparse library using CMake's ExternalProject module. It specifies the Git repository, tag, patch command, and build arguments. ```cmake ExternalProject_Add(suitesparse INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/suitesparse TMP_DIR ${TMP_DIR} STAMP_DIR ${DOWNLOAD_DIR}/suitesparse-stamp SOURCE_DIR ${DOWNLOAD_DIR}/suitesparse BINARY_DIR ${DOWNLOAD_DIR}/suitesparse-build GIT_REPOSITORY ${suitesparse_url} GIT_TAG refs/tags/${suitesparse_tag_version} PATCH_COMMAND ${suitesparse_patch} CMAKE_CACHE_ARGS -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} ) ``` -------------------------------- ### Run Metrix Simulator Help Source: https://github.com/powsybl/powsybl-metrix/blob/main/README.md Displays the usage instructions and available options for the metrix-simulator command-line tool. Ensure the METRIX_ETC environment variable is set. ```bash $> ./metrix-simulator --help Usage: metrix-simulator = "parades.csv" by default [options] Metrix options: -h [ --help ] Display help message --log-level arg Logger level (allowed values are critical, error, warning, info, debug, trace): default is info -p [ --print-log ] Print developer log in standard output --verbose-config Activate debug/trace logs relative to configuration --verbose-constraints Activate debug/trace logs relative to constraint detection --write-constraints Write the constraints in a dedicated file --print-constraints Trace in logs the constraints matrix (time consuming even if trace logs are not active), log level at trace is required --write-sensitivity Write the sensivity matrix in a dedicated file --write-report Write the rate matrix report in a dedicated file --check-constraints-level arg Check adding constraints: 0: no check (default) 1: When adding a constraint, perform a load flow to check transit (more time consuming) 2: When adding a constraint, run every incident to check that we didn't forget a constraint (even more time consuming --compare-reports Compare load flow reports after application of report factors to check trigger of coupling --no-incident-group Ignore incident if a group of N-K is not available --all-outputs Display all values in results files --mps-file Export MPS file ``` -------------------------------- ### Display Metrix Simulator Help Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/metrix-simulator.md Run the metrix-simulator with the --help option to display all available command-line arguments and their descriptions. Ensure the METRIX_ETC environment variable is set. ```default $> ./metrix-simulator --help ``` -------------------------------- ### METRIX Variant 0 - Economic Dispatch Start Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/tests_reference/groupes/limitation_curatif/metrixOut.txt Details the economic dispatch start for variant 0, including global consumption, production, and available power. ```text Demarrage des groupes par empilement économique : Consommation globale = 1000.0000 MW Production démarrée = 1000.0000 MW Puissance à ajuster = 0.0000 MW Puissance disponible à la hausse (hors Pimp) = 1000.0000 MW Puissance disponible à la baisse (hors Pimp) = -1000.0000 MW Bilans par zones synchrones : Zone synchrone 0 (noeud bilan 0), bilan = 0.0000 MW ``` -------------------------------- ### Configure PowSyBl-Metrix Environment Variables Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/index.md Add these lines to your .bashrc file to make the itools command available and set the POWSYBL_METRIX_HOME environment variable. This is necessary for command-line usage. ```shell # PowSyBl-Metrix itools repository export POWSYBL_METRIX_HOME= # Add the repository to the path export PATH=$POWSYBL_METRIX_HOME/bin:$PATH ``` -------------------------------- ### Configure and Run Time Series Mapping Source: https://github.com/powsybl/powsybl-metrix/blob/main/README.md This Java snippet demonstrates how to configure and execute time series mapping. It involves setting up a time series store, loading a mapping file and network, defining computation parameters, and applying the mapping to the network with various observers for logging and exporting results. ```java // Entry timeseries InMemoryTimeSeriesStore store = new InMemoryTimeSeriesStore(); store.importTimeSeries(Collections.singletonList(Paths.get("/path/to/timeseries.csv"))); // Mapping file Path mappingFile = Paths.get("path/to/mappingFile"); // Network Network network = NetworkXml.read(Paths.get("/path/to/network.xiidm")); // Computation parameters MappingParameters mappingParameters = MappingParameters.load(); int firstVariant = ... int maxVariantCount = ... ComputationRange computationRange = new ComputationRange(store.getTimeSeriesDataVersions(), firstVariant, maxVariantCount); // Generate mapping configuration TimeSeriesMappingConfig config; try (Reader reader = Files.newBufferedReader(mappingFile, StandardCharsets.UTF_8)) { TimeSeriesDslLoader dslLoader = new TimeSeriesDslLoader(reader, mappingFile.getFileName().toString()); config = dslLoader.load(network, mappingParameters, store, new DataTableStore(), computationRange); } // Export result in csv TimeSeriesMappingConfigCsvWriter csvWriter = new TimeSeriesMappingConfigCsvWriter(config, network, store, computationRange, mappingParameters.getWithTimeSeriesStats()); csvWriter.writeMappingCsv(Paths.get("/path/to/output")); // Compute mapping on network TimeSeriesMappingLogger logger = new TimeSeriesMappingLogger(); List observers = new ArrayList<>(); // Add network generation computation DataSource dataSource = DataSourceUtil.createDataSource(Paths.get("/path/to/networkOutputDir"), network.getId(), null); observers.add(new NetworkPointWriter(network, dataSource)); // Add timeseries mapping export TimeSeriesIndex index = new TimeSeriesMappingConfigTableLoader(config,store).checkIndexUnicity(); int lastPoint = Math.min(firstVariant + maxVariantCount, index.getPointCount()) - 1; Range range = Range.closed(firstVariant, lastPoint); observers.add(new EquipmentTimeSeriesWriterObserver(network, config, maxVariantCount, range, Paths.get("/path/to/equipmentTimeSeriesDir"))); observers.add(new EquipmentGroupTimeSeriesWriterObserver(network, config, maxVariantCount, range, Paths.get("/path/to/equipmentTimeSeriesDir"))); // Apply mapping to network TimeSeriesMapperParameters parameters = new TimeSeriesMapperParameters(store.getTimeSeriesDataVersions(), range, true, true, false, mappingParameters.getToleranceThreshold()); TimeSeriesMapper mapper = new TimeSeriesMapper(config, parameters, network, logger); mapper.mapToNetwork(store, observers); ``` -------------------------------- ### Clone Project Repository Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/simulator/build.md Clones the powsybl-metrix repository and navigates to the metrix-simulator directory. ```bash $> git clone https://github.com/powsybl/powsybl-metrix.git $> cd powsybl-metrix/metrix-simulator ``` -------------------------------- ### METRIX Variant 0 - Cost Calculation and Constraints Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/tests_reference/groupes/limitation_curatif/metrixOut.txt Shows the cost calculation process and constraint detection for variant 0, including micro-iteration steps and solver results. ```text Prise en compte des couts avec reseau Micro itération 1 (nombre de contraintes 1) -------------------- : Des contraintes ont été détectées : 1 Nb termes dans la matrice : 12 (taille de la matrice : 12) Ajout de 1 contraintes dans le probleme Micro itération 2 (nombre de contraintes 9) -------------------- : Appel du solveur linéaire en nombre entier Solution optimale trouvée pour la variante 0 (code retour = 1) Résultats en volume (MW) Volume de production = 979.9795 MW Volume de délestage = 20.0205 MW Résultats sur les couts Cout associé aux groupes : 10.0102 Cout associé au délestage : 260266.2963 Cout de pénalisation TD & HVDC : 4.9500 Cout des écarts de transit : 0.0000 Valeur de la fonction objectif : 260281.2566 Des contraintes ont été détectées : 0 Nb termes dans la matrice : 41 (taille de la matrice : 41) Pas de contraintes ``` -------------------------------- ### METRIX Variant 1 - Cost Calculation and Constraints Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/tests_reference/groupes/limitation_curatif/metrixOut.txt Shows the cost calculation process and constraint detection for variant 1, including micro-iteration steps and solver results. ```text Prise en compte des couts avec reseau Micro itération 1 (nombre de contraintes 1) -------------------- : Des contraintes ont été détectées : 1 Nb termes dans la matrice : 12 (taille de la matrice : 12) Ajout de 1 contraintes dans le probleme Micro itération 2 (nombre de contraintes 9) -------------------- : Appel du solveur linéaire en nombre entier Solution optimale trouvée pour la variante 1 (code retour = 1) Résultats en volume (MW) Volume de production = 979.9795 MW Volume de délestage = 20.0205 MW Résultats sur les couts Cout associé aux groupes : 10.0102 Cout associé au délestage : 260266.2963 Cout de pénalisation TD & HVDC : 4.0500 Cout des écarts de transit : 0.0000 Valeur de la fonction objectif : 260280.3566 Des contraintes ont été détectées : 0 Nb termes dans la matrice : 41 (taille de la matrice : 41) Pas de contraintes ``` -------------------------------- ### Build Third-Party Dependencies Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/simulator/build.md Configures and builds external libraries required by the Metrix simulator using CMake. ```bash $> mkdir build $> mkdir build/external $> cd build/external $> cmake ../../external -DCMAKE_BUILD_TYPE= $> cmake --build . ``` -------------------------------- ### Dynamic Mapping of Time Series to Generators by Region and Type Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/mapping.md Dynamically maps time series to generators based on region and production type. This example iterates through multiple areas and production types to create mappings. ```groovy for (area in ['05', '08', '09', '13', '14', '17', '24', '25', '28']) { // on définit des couples "AA" / "BB" pour mapper pour chaque zone, les chroniques contenant "AA" sur les générateurs de la zone de type "BB" for (prod_type in ['SOLAR', 'WIND', 'HYDRO', 'PSP', 'MISC', 'COAL', 'NUCLEAR', 'GAS']) { //on sélectionne la chronique de nom "nomDelaZone_AA" mapToGenerators { timeSeriesName area + '_fr_' + prod_type filter { // on mappe chaque chronique sélectionnée sur les générateurs qui sont dans la bonne région DI et de type "BB" substation.region == area && generator.genre == prod_type } distributionKey { generator.maxP } } } } ``` -------------------------------- ### Define and Build Metrix Log Static Library Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/log/CMakeLists.txt Defines the source files for the Metrix log library and creates a static library target named 'log'. It also sets up public and private include directories, linking against Boost libraries. ```cmake set(LOG_SOURCES src/logger.cpp ) add_library(log STATIC ${LOG_SOURCES}) target_include_directories(log PUBLIC $ $ Boost::system Boost::log Boost::filesystem PRIVATE src ) target_link_libraries(log Boost::system Boost::log Boost::filesystem ) add_library(metrix::log ALIAS log) ``` -------------------------------- ### itools Command Usage Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/index.md This output shows the available commands and options for the itools command after it has been added to the PATH. It lists functionalities for computation, data conversion, Metrix operations, and script execution. ```default $ itools usage: itools [OPTIONS] COMMAND [ARGS] Available options are: --config-name Override configuration file name Available commands are: Computation: loadflow Run loadflow Data conversion: convert-network convert a network from one format to another Metrix: mapping Time series to network mapping tool metrix Run Metrix metrix-die Generate Metrix DIE files Misc: generate-completion-script Generates a bash autocompletion script plugins-info List the available plugins Script: run-script run script (only groovy is supported) ``` -------------------------------- ### Powsybl Metrix General Parameters Configuration Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/metrix.md Defines all available tunable parameters for the Powsybl Metrix solver. Parameters control simulation modes, costs, constraints, and output details. All parameters are optional and have default values. ```groovy parameters { adequacyCostOffset // (0) : enable to define an identical cost change for all generators in the balancing step to avoid unrealistic opportunities analogousRemedialActionDetection // (false) detect similar topology remedial actions. Allow to improve the speed of the simulation but can hide non strictly equivalent remedial actions. computationType // (LF) Simulation Mode : LF, OPF_WITHOUT_REDISPATCHING, OPF contingenciesProbability // (0.001) Contingency probability gapVariableCost // (10) Gap variable cost hvdcCostPenality // (0.01) Penality cost for HVDC usage lossDetailPerCountry // (false) Output the loss detail per country lossOfLoadCost // (13000) Cost of the load shedding marginalVariationsOnBranches // (false) Output the marginal variation on branches marginalVariationsOnHvdc // (false) Output the marginal variation on HVDC maxSolverTime // (0) Max time allowed to solve one micro-iteration (0 is infinite) nbMaxIteration // (30) Max number of micro-iterations per variation nbMaxCurativeAction // (-1) Max number of remedial actions per contingency (-1 is infinite) nbThreatResults // (1) Number of N-k results to output outagesBreakingConnexity // (false) : allow to simulate the outages that breaks network connectivity (automatically set to true if propagateBranchTripping is set) overloadResultsOnly // (false) Only output results on constrained items preCurativeResults // (false) Use the threshold value before remedial actions (automatically activated if a threshold before action is filled in) propagateBranchTripping // (false) Propagate contingencies if no breaker is present pstCostPenality // (0.001) Penality cost of the PST usage redispatchingCostOffset // (0) : enable to define an identical cost change for all generators in the redispatching step to avoid unrealistic opportunities remedialActionsBreakingConnexity // (false) Allow remedial actions to cut pockets withAdequacyResults // (false) Outputs for the initial balancing step withRedispatchingResults // (false) Detailed outputs for the preventive and curative redispatching steps } ``` -------------------------------- ### Rebuild Documentation with Cache Clear Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/README.md If the documentation build fails, try rebuilding with the `-E` option to clear the Sphinx cache. ```bash sphinx-build -a -E docs ./build-docs ``` -------------------------------- ### METRIX Variant 2 - Cost Calculation and Constraints Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/tests_reference/groupes/limitation_curatif/metrixOut.txt Shows the cost calculation process and constraint detection for variant 2, including micro-iteration steps. ```text Prise en compte des couts avec reseau Micro itération 1 (nombre de contraintes 1) -------------------- : ``` -------------------------------- ### Define Test Directory Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/tests/connexite/CMakeLists.txt Sets up the directory structure for connexite tests and expected results. ```cmake set(TEST_DIR_NAME connexite) set(TEST_DIR ${MAIN_TEST_DIR}/${TEST_DIR_NAME}) set(EXPECTED_TEST_DIR ${MAIN_TEST_DIR}_reference/${TEST_DIR_NAME}) ``` -------------------------------- ### General Syntax for Time Series Mapping Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/mapping.md Illustrates the general syntax for mapping time series data to network elements. This includes specifying the time series name, optional filters, and distribution keys. ```groovy mapToXXX { variable variableName //optional, the name of the element variable to map the time series with. Each element have a default mapped variable (defined below) timeSeriesName 'timeseriesName' // name of the time series to map filter { /* ... */ } // a filter predicate allowing to select which item of the element type we wish to map distributionKey { /* ... */ } // optional, a repartition key that will define how the time serie values will be distributed for each selected items (default is equipartition : val / N) } ``` -------------------------------- ### Link to External Documentation Page Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/README.md Create links to entire pages in external documentation. Use the {doc} directive or the inv: syntax with the repository name and page path. ```markdown - Let's talk about the power of {doc}`powsyblcore:simulation/loadflow/loadflow`. - Let's talk about the power of {doc}`loadflow `. - Let's talk about the power of [Load Flow](inv:powsyblcore:std:doc#simulation/loadflow/loadflow). ``` -------------------------------- ### Run 'seuils_extremite_origine' Test Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/tests/seuils/CMakeLists.txt Executes the 'seuils_extremite_origine' test with an expected result of 9. ```cmake metrix_test("seuils_extremite_origine" 9) ``` -------------------------------- ### JSON Configuration for Grid and Computations Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/main.dox The fort.json file configures the grid and computation options in JSON format. It expects a 'files' array containing 'attributes', where each attribute has a 'name', 'type', and 'values'. ```json { "files": [ "attributes": [ { "name": "type": "INTEGER" or "FLOAT" or "DOUBLE" or "STRING" or "BOOLEAN" "values": [ ] } ] ] } ``` -------------------------------- ### Metrix Configuration in config.yml Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/index.md Configure Metrix settings in your PowSyBl config.yml file, typically located in ~/.itools. This includes paths to metrix-simulator, export versions, and various operational parameters. ```yaml metrix: home-dir: # required command: metrix-simulator iidm-export-version: "1.11" # default to latest available version constant-loss-factor: false # enable constant loss factor chunk-size: 10 # size of the batch processed by Metrix result-limit: 10000 # max allowed output count debug: false # enable debug mode log-level: 2 # Metrix log level, available values: 0 (trace), 1 (debug), 2 (info), 3 (warn), 4 (error), 5 (critical) debug-log-level: 0 # Metrix log level when debug mode is enabled, available values: 0 (trace), 1 (debug), 2 (info), 3 (warn), 4 (error), 5 (critical) mapping-default-parameters: tolerance-threshold: 0.0001f metrix-default-parameters: computation-type: LF # default computation type loss-factor: 0f # default loss factor value nominal-u: 100 # default nominal U ``` -------------------------------- ### Configure Load Shedding Parameters Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/metrix.md Define preventive and curative shedding percentages and costs for specific loads. Doctrine costs can also be specified for postprocessing. ```groovy load(load_id) { preventiveSheddingPercentage 20 // shedding max percentage for preventive actions preventiveSheddingCost 10000 // cost for preventive shedding action curativeSheddingPercentage 10 // optional shedding max percentage for curative actions curativeSheddingCost 40 // optional cost for curative shedding action onContingencies 'a', 'b' // optional contingency upon which curative action are operated preventiveSheddingDoctrineCost 10000 // doctrine cost for preventive shedding action (fixed value or time series name) curativeSheddingDoctrineCost 'ts_doctrine_cost' // doctrine cost for curative shedding action (fixed value or time series name) } ``` -------------------------------- ### General Parameters for Mapping Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/mapping.md Configure global mapping parameters like tolerance thresholds. The default tolerance threshold is 0.0001. ```groovy parameters { toleranceThreshold // Tolerance threshold when comparing the mapped power to the limit defined by the network element (default : 0.0001) } ``` -------------------------------- ### Configure Monitored/Observed Branches in Metrix Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/metrix.md Use this syntax to define whether a branch should be observed for flow results or monitored with specific thresholds. Thresholds can be fixed values or time series names, and can include directional constraints and contingency-specific settings. ```groovy branch('component_id') { baseCaseFlowResults true maxThreatFlowResults true contingencyFlowResults 'a', 'b' branchRatingsBaseCase 'tsName' branchRatingsBaseCaseEndOr 'tsName' branchRatingsOnContingency 'tsName' branchRatingsOnContingencyEndOr 'tsName' branchRatingsBeforeCurative 100 branchRatingsOnSpecificContingency 100 branchRatingsBeforeCurativeOnSpecificContingency 100 contingencyDetailedMarginalVariations 'a', 'b' branchAnalysisRatingsBaseCase 'tsName' branchAnalysisRatingsBaseCaseEndOr 'tsName' branchAnalysisRatingsOnContingency 'tsName' branchAnalysisRatingsOnContingencyEndOr 'tsName' } ``` -------------------------------- ### Configure Generator Ramping by Region and Type Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/metrix.md Conditionally configure generator ramping costs based on region and type properties from the IIDM network file. ```groovy for (g in network.generators) { if (g.terminal.voltageLevel.substation.regionDI=='04' & g.genreCvg=="TAC") { generator(g.id) { redispatchingDownCosts 'cost_TAC_down_AR' redispatchingUpCosts 'cost_TAC_up_AR' } } } ``` -------------------------------- ### Define Load Binding Constraints Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/metrix.md Use this syntax to define binding constraints for loads. The only reference variable available is the initial load. ```groovy loadsGroup("name of the sed") { filter { load.id == ... } // filter loads } ``` -------------------------------- ### Define SuiteSparse URL and Tag Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/external/CMakeLists.txt Sets the Git repository URL and tag for the SuiteSparse library. This is used for downloading and building the dependency. ```cmake set(suitesparse_url https://github.com/DrTimothyAldenDavis/SuiteSparse.git) set(suitesparse_tag_version v5.4.0) ``` -------------------------------- ### Link to Specific Part of External Documentation Page Source: https://github.com/powsybl/powsybl-metrix/blob/main/docs/README.md Link to specific sections or anchors within external documentation pages. Use the inv: syntax with the repository name and the anchor ID. Ensure corresponding references exist in the external documentation. ```markdown - Let's talk about the power of [time series](inv:#timeseries). - Let's talk about the power of [time series](inv:powsyblcore#timeseries). - Let's talk about the power of [calculated time series](inv:#calculated-timeseries). - Let's talk about the power of [calculated time series](inv:powsyblcore:std:label:#calculated-timeseries). - Let's talk about the power of [calculated time series](inv:powsyblcore:*:*:#calculated-timeseries). ``` -------------------------------- ### CMakeLists.txt: Define Test Directory Source: https://github.com/powsybl/powsybl-metrix/blob/main/metrix-simulator/tests/variables_couplees/CMakeLists.txt Sets the directory name for coupled variables tests and constructs the full path to the test directory. ```cmake set(TEST_DIR_NAME variables_couplees) set(TEST_DIR ${MAIN_TEST_DIR}/${TEST_DIR_NAME}) set(EXPECTED_TEST_DIR ${MAIN_TEST_DIR}_reference/${TEST_DIR_NAME}) ```