Overview
The Sensitivity Analysis module computes sensitivity factors that indicate how changes in one part of the network affect other parts. It calculates the relationship between variables (injections, tap positions, HVDC flows) and functions (branch flows, bus voltages).Creating Sensitivity Analysis
create_dc_analysis
Create a DC sensitivity analysis instance.A new DC sensitivity analysis instance
create_ac_analysis
Create an AC sensitivity analysis instance.A new AC sensitivity analysis instance
SensitivityAnalysis Classes
BothDcSensitivityAnalysis and AcSensitivityAnalysis inherit from the base SensitivityAnalysis class and share most methods.
Defining Factor Matrices
add_branch_flow_factor_matrix
Define sensitivity of branch active power flows to variables.IDs of branches (lines, transformers) for which to compute sensitivities
Variables that may impact branch flows. Can be:
- Network element IDs (generators, loads, PSTs, dangling lines, HVDC lines)
- Zone IDs (for zonal analysis)
- Tuple of two zone IDs for power transfer between zones
Unique identifier for the matrix, used to retrieve sensitivity values
add_precontingency_branch_flow_factor_matrix
Define sensitivities for the base case (N situation) only.add_branch_flow_factor_matrix.
add_postcontingency_branch_flow_factor_matrix
Define sensitivities for specific post-contingency states.IDs of branches to monitor
Variable IDs
List of contingency IDs for which to compute sensitivities
Matrix identifier
add_factor_matrix
Generic method to add any type of sensitivity factor matrix.IDs of network elements for which to compute sensitivity functions
IDs of variables
List of contingency IDs
When to compute sensitivities (ALL, NONE, SPECIFIC)
Type of function:
BRANCH_ACTIVE_POWER_1: Active power at side 1 of a branchBRANCH_ACTIVE_POWER_2: Active power at side 2 of a branchBRANCH_CURRENT_1: Current at side 1 of a branchBRANCH_CURRENT_2: Current at side 2 of a branchBUS_VOLTAGE: Bus voltage magnitude
Type of variable:
AUTO_DETECT: Automatically detect from element typeINJECTION_ACTIVE_POWER: Active power injectionINJECTION_REACTIVE_POWER: Reactive power injectionTRANSFORMER_PHASE: Phase shift angleBUS_TARGET_VOLTAGE: Bus target voltageHVDC_LINE_ACTIVE_POWER: HVDC active power
Matrix identifier
Zone Definition
set_zones
Define zones for zonal sensitivity analysis.List of Zone objects defining network zones
Adding Contingencies
Sensitivity analysis can include contingencies (inherited from ContingencyContainer).Running Analysis
run (DC and AC)
Run the sensitivity analysis.Network on which to run the sensitivity analysis
Sensitivity analysis parameters
Provider name. If empty, uses default
Reporter for execution reports
Sensitivity analysis result containing sensitivity matrices
Parameters
Parameters Class
Configure sensitivity analysis execution.Load flow parameters used for the analysis. See Load Flow Parameters
Provider-specific parameters as key-value pairs
Results
SensitivityAnalysisResult
Base result class for sensitivity analysis.get_sensitivity_matrix
Get the sensitivity matrix as a DataFrame.ID of the matrix to retrieve
DataFrame with sensitivity values. Rows represent functions (branches), columns represent variables (injections)
get_reference_matrix
Get the reference values (base case flows) as a DataFrame.ID of the matrix
DataFrame with reference flow values
DcSensitivityAnalysisResult
Result specific to DC sensitivity analysis.AcSensitivityAnalysisResult
Result specific to AC sensitivity analysis. Example:Zone Creation Utilities
create_empty_zone
Create an empty zone.Zone identifier
A new empty zone
create_country_zone
Create a zone containing all injections from a country.The network
Zone identifier
Country code (e.g., ‘FR’, ‘DE’)
A zone containing all injections from the specified country
create_zone_from_injections_and_shift_keys
Create a zone from specific injections with shift keys.Zone identifier
List of injection element IDs (generators, loads)
Distribution factors (should sum to 1.0). Defines how power changes are distributed across injections
A zone with the specified injections and distribution
create_zones_from_glsk_file
Create zones from a GLSK (Generation and Load Shift Keys) file.The network
Path to the GLSK file
List of zones defined in the GLSK file
Provider Management
get_provider_names
Get the list of available sensitivity analysis providers.List of available provider names
get_default_provider
Get the current default sensitivity analysis provider.Name of the default provider
set_default_provider
Set the default sensitivity analysis provider.Name of the provider to set as default
Enumerations
SensitivityFunctionType
BRANCH_ACTIVE_POWER_1: Active power at side 1 of a branchBRANCH_ACTIVE_POWER_2: Active power at side 2 of a branchBRANCH_CURRENT_1: Current magnitude at side 1BRANCH_CURRENT_2: Current magnitude at side 2BUS_VOLTAGE: Bus voltage magnitude
SensitivityVariableType
AUTO_DETECT: Automatically detect from element typeINJECTION_ACTIVE_POWER: Active power injectionINJECTION_REACTIVE_POWER: Reactive power injectionTRANSFORMER_PHASE: Phase shift transformer angleBUS_TARGET_VOLTAGE: Bus voltage setpointHVDC_LINE_ACTIVE_POWER: HVDC line active power
ContingencyContextType
ALL: For all contingenciesNONE: Only for base case (N situation)SPECIFIC: For specific contingencies
ZoneKeyType
Type of shift keys for zone definition:GENERATOR_TARGET_PGENERATOR_MAX_PLOAD_P0
See Also
- Security Analysis - N-1 security analysis
- Load Flow - Power flow calculations
