Tool reference¶
Everything CONDUCTOR can do, it does through these tools: you ask in plain language and it chooses the tool and its arguments. You never call them yourself, but knowing them tells you what can be asked, and which arguments a question can set ("at 18:00", "with loads at 120 %", "on proposal dc_bus9", "with a 90 % line limit").
Most studies also take the arguments in Shared arguments.
- Reading the grid and the data:
locate_network_element,describe_network,get_current_timestamp,advance_timestamp,get_current_conditions,get_element_timeseries,get_data_quality - Security at one moment:
run_rsa,simulate_contingency,simulate_all_contingencies,compute_violation_attribution,investigate,test_prevention,look_ahead,record_investigation,compare_results - Over time, scenarios and risk:
scan_rsa_over_time,find_worst_case_timestamp,scan_scenarios,run_probabilistic_rsa,compute_historical_risk - Optimisation and flexibility:
optimize_flexibility,optimize_contingency,optimize_robust_flexibility,compute_flexibility_envelope,compute_hosting_capacity,flexibility_over_time - Key performance indicators:
evaluate_kpis,kpis_over_time - What-if proposals:
edit_proposal,compare_networks - Settings:
set_load_power_factor,set_generator_model,set_unit_costs,rename_elements,declare_network_facts
Reading the grid and the data¶
locate_network_element¶
Look up one bus, line or transformer by name: what it is, what it connects to, and the element_index each connection has. Use it BEFORE any tool that takes element_type/element_index — that index cannot be guessed from a name. Also answers what a substation is joined to. Topology only; does not depend on the timestamp.
| Argument | Type | Meaning |
|---|---|---|
element (required) |
text | Name of a bus, line or transformer, e.g. 'Golf' or 'OLS-ØST'. |
Also takes: network.
describe_network¶
What the network's elements are. Every fact has a basis: stated (by the network, a proposal or the operator), named (read from an element's name), inferred (by a rule it names) or unknown — never guessed. about='units': units by energy source (wind, solar, hydro, thermal, storage, condenser, unknown…) with their control; 'loads': loads by category (residential, industrial, data centre, a downstream network, unknown…); 'switches': each switch's class, normal and present state and role (a tie between feeders, a normally open loop point); 'feeders': each feeder with what it supplies and its ties; 'data': where each value of the present operating point comes from — measured, allocated (a share of its bus's measurement), derived (from an assumption such as the load power factor), solved, set or the case's own; 'voltage_levels'; 'substations'; 'external_grid': where it connects and which branches carry its power; 'summary'; 'around' with element: that element and everything connected to it in one answer — its substation (units, loads, branches leaving and where they lead), its supply route from the external grid and feeder, and what would be cut off without it (topology) with the open ties that could restore supply, each checked with a power flow at the current operating point (what closing it restores, the lowest voltage, the highest loading, any limit broken). Use it before saying what a unit or a load is, which units are renewable, what voltage level, substation or feeder something belongs to, or what an element supplies. about='select' with element: the units, loads or branches a phrase names by meaning ('the wind units on feeder Line 1-2'), each with its basis; studies that take units accept such a phrase too. about='issues': what in the network's own data looks inconsistent (a name its type contradicts, a line across voltage levels, loads cut off). about='changes' with network=
| Argument | Type | Meaning |
|---|---|---|
about |
summary / units / loads / voltage_levels / substations / external_grid / switches / feeders / data / around / select / issues / changes / model |
The aspect to describe (default summary). |
element |
text | For about='around': a bus, line, transformer, unit, load or substation, by name (for a CIM model also a busbar, a bus name or a voltage level as the model names it), or any object's mRID. For about='select': what to select, by meaning — 'solar units on feeder Line 1-2', 'industrial loads at 20 kV', 'units in substation Bus 5', 'unknown units', 'transformers'. |
Also takes: network.
get_current_timestamp¶
Retrieve the current simulation timestamp from the digital twin. Call this before any time-dependent analysis.
advance_timestamp¶
Advance the simulation clock by a given number of 15-minute ticks, or jump directly to a specific timestamp. Returns the list of timestamps traversed and the new current timestamp.
Effect: Moves the simulation clock.
| Argument | Type | Meaning |
|---|---|---|
steps |
whole number | Number of 15-minute ticks to advance. Default 1. Ignored if target_timestamp is provided. |
target_timestamp |
text | Jump directly to this timestamp instead of stepping forward. Accepts full timestamp strings (e.g. '2022-03-15 08:00' or '2022-03-15 08:00:00'). Prefix matching is supported so a partial string like '2022-03-15 08' resolves to the first matching tick. If provided, steps is ignored. |
get_current_conditions¶
Return the raw network state at the current timestamp: per-generator active power (MW), installed maximum capacity (Pg_max_mw), reactive power (MVAR), per-load consumption (MW/MVAR), external-grid import (MW), and network totals (generation, load, losses). Use this whenever the user asks about current generation levels, maximum generator capacity, load, losses, or external-grid import. Does NOT run an OPF — just a fast power flow snapshot.
| Argument | Type | Meaning |
|---|---|---|
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
get_element_timeseries¶
Focus tool: scan a time range and plot the evolution of a specific bus voltage (vm_pu), line loading (%), or transformer loading (%) over time. Does NOT advance the simulation clock. Use when the user asks: 'show me the voltage at Alpha over the last 24 hours', 'plot the loading of line X between Monday and Tuesday', 'how did transformer 5 behave this week', 'show me the bus voltage for [substation] in a time range'. Returns a time-series chart of the primary metric (vm_pu for buses, loading_percent for lines/trafos) plus the active power flow.
| Argument | Type | Meaning |
|---|---|---|
element_type (required) |
text | Type of network element to focus on. 'bus' → bus voltage profile, 'line' → line thermal loading, 'trafo' → transformer thermal loading. |
element_name (required) |
text | Name (or partial name) of the element to focus on. For buses use substation name fragments. Use the exact substation names listed under 'Substation names' in the system prompt; they describe the network currently loaded. Partial match is supported — a fragment such as 'Alpha' matches both 'Alpha 10.5 kV' and 'Alpha 60 kV'. For lines and trafos use the element name from the network (e.g. the name shown in the contingency results). |
start_timestamp |
text | Start of the scan window. ISO prefix matching: '2022-01-03' covers the whole day; '2022-01-03 08' covers 08:00–08:45. If omitted, starts at the current simulation timestamp. |
end_timestamp |
text | End of the scan window (inclusive). ISO prefix matching. If omitted (with n_steps also omitted), scans to the end of the dataset. |
n_steps |
whole number | Maximum number of 15-minute ticks to scan. 96 = 1 day, 672 = 1 week. Use with start_timestamp to define the window size precisely. |
step_size |
whole number | Sample every Nth tick for speed. Default 1 (every 15 min). Use 4 for hourly resolution, 96 for daily summary. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements' (actuals) or 'forecasts' (look-ahead). Omitted: measurements unless another was used earlier in this question. |
Also takes: network, load_power_factor.
get_data_quality¶
The quality report of the loaded data (measurements and forecasts): which columns they carry (measured reactive demand / generation), coverage, gaps and how each was filled (active power interpolated in time; missing reactive demand from the load power factor), implausible values (power factor below 0.7, values that look like kvar, all-zero columns), leading loads, and measured reactive generation that voltage-controlled units do not follow. Use it for any question about the data themselves. Reads the data; runs no study.
Security at one moment¶
run_rsa¶
Run a Real-time Security Assessment (RSA) on the active grid model. Returns voltage profiles for all buses, thermal loading for all lines and transformers, and a list of security violations. Use this to check the current operating point or a hypothetical load scenario.
| Argument | Type | Meaning |
|---|---|---|
option |
text | A corrective option's ref (e.g. 'S2:cheapest'): applied (its outage too); at a later timestamp, its instructions held. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
simulate_contingency¶
Simulate a single N-1 contingency (one line or transformer outage). Returns whether the system remains secure and any resulting violations. On a network loaded as CIM whose model states temporary limits, each overload says how long it may be held (temporary_limit) or that it is beyond them, and time_to_act_s the shortest — say it: how long the operator has to act.
| Argument | Type | Meaning |
|---|---|---|
option |
text | A corrective option's ref (e.g. 'S2:cheapest'): applied (its outage too); at a later timestamp, its instructions held. |
element_type (required) |
text | Network element type: 'line' for power lines or 'trafo' for transformers. Element indices depend on the currently loaded network. |
element_index (required) |
whole number | Zero-based index of the element to take out of service. Get it from locate_network_element; never guess it. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
simulate_all_contingencies¶
Run a full N-1 security sweep across all lines and transformers. Returns whether the system is N-1 secure, total outages tested, number causing violations, and the full violation table. Use this when the user asks 'which contingency is worst' or 'is the grid N-1 secure'. With option, it screens a corrective option instead of the schedule. With scope, only the outages of one feeder, substation or voltage level ('N-1 on the 20 kV level', 'on feeder Line 1-2'); violations are still looked for in the whole network. On a network loaded as CIM whose model states temporary limits, each overload says how long it may be held, and time_to_act_s the shortest over the sweep.
| Argument | Type | Meaning |
|---|---|---|
scope |
text | Only these outages, by the CIM layer: a voltage level ('20 kV'), a feeder by name (describe_network about='feeders') or a substation by name. Omitted: every line and transformer. |
option |
text | A corrective option's ref (e.g. 'S2:cheapest'): the sweep runs with its dispatch applied — after its outage too, if it had one (N-1-1); at a later timestamp, its instructions held. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
compute_violation_attribution¶
Rank which generators, renewable units and loads move each violated element now, at one operating point. Use it when the user asks which unit moves it, or what to move to fix the violations. (For WHY an element is outside its limits — what caused it — use investigate, which compares it with a state where it was fine.) Returns, per violated element, a ranked list of sources with their measured sensitivity (change in bus voltage or branch loading per MW or MVAr of that source) and the movement each would need to clear the violation on its own. Does NOT advance the simulation clock. Prefer this over inferring drivers from a violation table.
| Argument | Type | Meaning |
|---|---|---|
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
top_n_sources |
whole number | How many injections to test, largest first. Default 20. Each costs two power flows, so raise it only when the network is large and the expected driver may be a small unit. |
top_n_drivers |
whole number | Ranked drivers returned per violated element. Default 5. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
investigate¶
WHY an element is outside its limits (element 'all': the grid insecure), or why a voltage or loading changed. Compares it with a reference state where it was fine (default: the nearest earlier moment within limits) and divides the change among what changed — demand near it and elsewhere, units' output, set-points, lines out, a proposal's additions — by Shapley values over AC power flows (the shares add up to the change). Returns each factor's share and verdict (cause, contributes, ruled_out, counteracts), interactions, undo-alone counterfactuals, a cause's members and the levers to act on now. For a problem in the grid only — not a why about a method, a recommendation or physics, nor a what-if.
| Argument | Type | Meaning |
|---|---|---|
element |
text | The bus, line or transformer, named as results name it (a bus by its name, a branch by its label ' |
element_type |
text | 'bus', 'line' or 'trafo', if the name is ambiguous. |
reference_timestamp |
text | Compare with this moment (prefix, e.g. '2000-01-06 16') when the operator names one. Omitted: the nearest earlier moment within limits. |
reference_data_source |
text | Compare with the other dataset ('forecasts' or 'measurements'), same moment. |
reference_network |
text | Compare with another network ('base' or a proposal id), same moment. |
recurring |
true/false | Every episode outside the limits in a window (start/end_timestamp; the whole dataset by default), each investigated, and their main causes gathered: is the cause recurring (structural)? Element omitted: the one outside its limits most often. |
check_references |
true/false | Repeat against the other references (within limits, well inside them, the day before) and say whether the main cause holds. Default: on when the reference was chosen automatically. |
classical |
list of linear / tracing |
Classical views beside the exact shares, when useful: 'linear' — each factor estimated from sensitivities (LODF for a branch out), to see where linearity holds; 'tracing' — which sources feed and which loads draw an investigated branch's flow (Bialek). They inform; the verdicts stay the exact ones. |
reference_mode |
within_limits / comfortable / previous_day |
How to pick the reference when none is given: the nearest earlier moment within limits (default); 'comfortable' — well inside them, to see why it got close at all; 'previous_day' — the same moment a day earlier. |
outage |
text | A line or transformer out in BOTH states (N-1). 'Why is losing X critical at 18:00 and not at 15:00': outage=X, timestamp=18:00, reference_timestamp=15:00, reference_outage empty. |
reference_outage |
text | Leave empty to keep the same outage in the reference. Only to compare outages at the same moment: another line, or 'none' for the intact network. |
start_timestamp |
text | Only for a window of several moments (why this day or week is worse than the last): its first moment (prefix). Empty for one moment. |
end_timestamp |
text | The window's last moment (prefix, inclusive). |
reference_start_timestamp |
text | The window compared with; omitted, the window of the same length just before. |
reference_end_timestamp |
text | The compared window's last moment. |
hypotheses |
list of object | Your own hypotheses to test (up to 5), instead of the standard grouping: each a name and the elements it covers. A bus name covers the demand at it; a unit name its output and set-point; a line or transformer (name or tag, e.g. 'L38') its state; 'external grid' its voltage; 'demand' or 'units' all of them. Everything else that changed is 'Other changes'. The tool measures each one's share and verdict; one naming nothing that changed is ruled out. |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
test_prevention¶
Could an episode outside the limits have been avoided, and how early was it seen? From a moment in it: the episode, the warning before it (within a small margin of the limit) and, for each action you propose, whether holding it from the warning to the end keeps the element within its limits at every moment (AC power flows; no new violation, the unit within its range) and the smallest share that still does — or what stops it. Actions omitted: the attribution's levers.
| Argument | Type | Meaning |
|---|---|---|
element |
text | The bus, line or transformer; omitted, the only one outside its limits. |
element_type |
text | 'bus', 'line' or 'trafo'. |
actions |
list of object | Up to 4 candidate actions, each with a unit and exactly one of the three changes. |
combine |
true/false | Also try all the actions together. |
warning_margin |
number | How close to the limit counts as a warning (default 0.01 p.u. or 10 points). |
outage |
text | A line or transformer out throughout. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
look_ahead¶
What is coming, and what would prevent it. Over the forecast's next hours (24 by default): the episodes outside the limits and, for the most severe, when to decide (the warning's start), the main cause, the smallest sufficient action (AC power flows through the warning and the episode) and whether it holds if the forecast errs (demand higher, renewables lower). Expectations, not facts. For 'what should I watch for', 'anything to act on today'.
| Argument | Type | Meaning |
|---|---|---|
start_timestamp |
text | Where the horizon starts (a prefix). Omitted: the simulation clock, or the forecast's first moment. |
hours |
number | The horizon in hours (default 24, at most 72). |
elements |
list of text | Only these buses, lines or transformers. Omitted: the whole grid. |
uncertainty_pct |
number | Each action is checked again with demand this much above the forecast and renewables this much below it (default 5). |
max_episodes |
whole number | How many of the most severe episodes to work out in full (default 5). |
data_source |
text | 'forecasts' (default: what is expected) or 'measurements'. |
Also takes: network, load_power_factor.
record_investigation¶
Record what an investigation tested, before the answer. Once it is done (not when asking the operator first): every hypothesis — supported, refuted or untested. Supported or refuted: name the tools, called successfully in this question, that decide it (and the investigate factor; the verdicts must agree). Untested: only what no CONDUCTOR tool can test — say what would (missing_tool, missing_kind); a study not yet run is not untested. Refused otherwise. Shown to the operator; what untested ones need is collected for the developers.
| Argument | Type | Meaning |
|---|---|---|
symptom (required) |
text | What was investigated, e.g. 'Bus_29 below 0.95 p.u. at 2000-01-06 20:00'. |
hypotheses (required) |
list of object |
compare_results¶
Compare the last two comparable results from this turn and compute per-generator delta dispatch (ΔPg, ΔQg), per-bus voltage delta (ΔVm), and KPI delta. No backend call — pure client-side computation. Accepts two optimization results OR one run_rsa result followed by one optimize_flexibility result. RSA vs OPF usage: call run_rsa() first (captures the raw/violating state), then optimize_flexibility(), then compare_results() — this gives a true before/after diff. Two-optimizer usage: run two optimizer tools back-to-back, then compare_results(). Do NOT pass result_a / result_b — the tool retrieves the last two results automatically. Only supply label_a and label_b to name the two scenarios in the charts. Use when the user asks: 'what changed when...', 'compare X vs Y', 'show the difference between the violation state and the fix', 'effect of disabling a generator', 'difference between cable derated to 20 MW vs 70 MW', etc.
| Argument | Type | Meaning |
|---|---|---|
label_a |
text | Human-readable label for the first (baseline) run, e.g. 'Cable 70 MW' or 'Baseline'. Default: 'Baseline'. |
label_b |
text | Human-readable label for the second (scenario) run, e.g. 'Cable 1 MW'. Default: 'Scenario'. |
Over time, scenarios and risk¶
scan_rsa_over_time¶
Advance the simulation clock n_steps × 15 minutes, running an RSA at each tick, and return a time-series of key grid security metrics: voltage envelope (min/max), max thermal loading (lines and trafos), and violation counts. Use when the user asks about trends, evolution, or 'next N timesteps'.
Effect: Moves the simulation clock.
| Argument | Type | Meaning |
|---|---|---|
n_steps |
whole number | Number of 15-minute steps to scan. Default 4 (1 hour). 1 day = 96 steps, 7 days = 672 steps, full dataset = use get_current_timestamp to check how many ticks remain. Each step takes ~2-5 seconds; warn the user for large scans. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
Also takes: network, load_power_factor.
find_worst_case_timestamp¶
Scan forward through all (or n_steps) timestamps WITHOUT advancing the simulation clock, and find the worst-case operating point for a chosen stress metric. Returns the worst timestamp + value, per-metric worst summary, and a full time-series for charting. The simulation clock is unchanged after the call. Use when the user asks: 'when is the grid most stressed?', 'find the worst case', 'which timestamp has the most violations?', 'peak import moment', 'when is voltage lowest?', 'scan the whole dataset for the worst point'. Not for what a proposal changes at the worst hour: a change can move the worst moment, so compare the two over the window with compare_networks study='scan' instead of taking the base's worst hour.
| Argument | Type | Meaning |
|---|---|---|
metric |
text | The stress metric to find the worst timestamp for. One of: 'violations' (default — most security violations), 'slack_import' (highest external-grid import MW), 'max_voltage' (highest bus voltage p.u.), 'min_voltage' (lowest bus voltage p.u. — worst undervoltage), 'max_loading' (highest line loading %). All five are always returned in worst_per_metric regardless of choice. |
n_steps |
whole number | Number of ticks to scan from the current position. Omit to scan all remaining timestamps. 1 day = 96 ticks, 7 days = 672. Each tick ~0.1s; warn the user before scans > 200 steps. |
step_size |
whole number | Scan every Nth tick. Default 1 (every tick, full resolution). Use 3–6 for a fast preview (~3–6× faster, lower resolution). Recommend step_size=3 for scans over 200 steps. |
data_source |
text | Which dataset to scan. 'measurements' (default) = historical actuals, scanned forward from the current simulation time — use for 'worst case in the last week', past-event and historical questions. 'forecasts' = the look-ahead planning series, scanned from its start — use for 'worst case next week', planning and rescheduling questions. If forecasts are not loaded the call returns an error; do not assume they exist. |
vm_upper_pu |
number | Upper voltage limit in p.u. used to count violations while scanning. Pass the same value as the assessment that follows, or the scan searches against a different definition of 'worst' than the one you then report. Only affects the 'violations' metric; the voltage and loading extrema are threshold-independent. |
vm_lower_pu |
number | Lower voltage limit in p.u. for violation counting during the scan. |
max_line_loading_pct |
number | Line loading limit in % for violation counting during the scan. |
max_trafo_loading_pct |
number | Transformer loading limit in % for violation counting during the scan. |
Also takes: network, load_power_factor.
scan_scenarios¶
Run RSA across a time range for multiple renewable output scaling factors simultaneously and compare the results. Server-side parallel execution — does NOT advance the simulation clock. Use when the user asks: 'what happens to violations if wind drops 30%?', 'how sensitive is the grid to renewable uncertainty?', 'compare low / baseline / high wind over the next day', 'worst case if renewables are at 70%'. Returns per-scenario time-series of violations, Sweden import, and voltage envelope, plus a summary comparison table.
| Argument | Type | Meaning |
|---|---|---|
sgen_scales |
list of number | List of renewable output scaling factors to compare. Each value multiplies ALL sgen (wind/solar) p_mw and q_mvar before each power flow. 1.0 = measured baseline output. Choose one value below 1.0 (low renewables) and one above 1.0 (high renewables) plus 1.0 for the baseline, e.g. [0.7, 1.0, 1.3]. Keep the list short (2–4 values) for speed. |
start_timestamp |
text | Start of the scan window. ISO prefix matching (e.g. '2022-01-03' = full day). If omitted, starts at the current simulation timestamp. |
end_timestamp |
text | End of the scan window (inclusive). ISO prefix matching. If omitted together with n_steps, scans all remaining timestamps. |
n_steps |
whole number | Maximum ticks per scenario. 96 = 1 day, 672 = 1 week. Total server work = n_steps × len(sgen_scales) power flows, but scenarios run in parallel so wall time ≈ one scenario. |
step_size |
whole number | Sample every Nth tick. Default 1 (every 15 min). Use 4 for hourly, 96 for daily summary. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements' (actuals) or 'forecasts' (look-ahead). Omitted: measurements unless another was used earlier in this question. |
Also takes: network, load_power_factor.
run_probabilistic_rsa¶
Run a Monte Carlo probabilistic security assessment at the current timestamp. Draws n_samples Latin Hypercube samples of generation and load uncertainty, runs a power flow for each sample in parallel, and returns statistically grounded risk metrics. Interpretation: current sgen values are treated as forecast estimates of renewable availability; uncertainty is on available resource around that estimate (with capacity clipping and setpoint ceiling), while load uncertainty remains multiplicative. Use for the probability or expected number of violations under uncertainty, or P5/P50/P95 voltage envelopes. Does NOT advance the clock.
| Argument | Type | Meaning |
|---|---|---|
n_samples |
whole number | Number of Monte Carlo samples. Default 200. Use 50–100 for a quick preview, 500 for publication-quality results. Capped at 1000. Wall time ≈ n_samples/8 × single power flow time. |
sgen_sigma |
number | Relative standard deviation for renewable forecast error around the current sgen estimate. Default 0.00 (disabled unless explicitly requested). This represents uncertainty in available renewable resource, not uncertainty in the commanded setpoint itself. Use 0.10 for a tighter uncertainty band, 0.25 for high uncertainty. |
load_sigma |
number | Relative standard deviation for the load multiplier. Default 0.05 (±5%). Load is generally less uncertain than wind. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
compute_historical_risk¶
Computes empirical historical violation and near-miss statistics over a real SCADA window. Uses repeated RSA snapshots over a timestamp range and returns exceedance frequency/count, worst episodes, and a duration-curve-style summary. Supports conditional risk bins (hour/load/slack_import). The tool wrapper auto-expands date-only windows (YYYY-MM-DD -> YYYY-MM-DD 00:00:00), and when target names are misspelled it attempts a safe auto-correction from live RSA labels; if confidence is low it returns target suggestions so you can ask the user to confirm. Use when the user asks: 'how often does this violate?', 'what is the historical risk?', 'show empirical violation statistics', or 'how bad was this over the year?'.
| Argument | Type | Meaning |
|---|---|---|
target |
text | Target to analyze: 'all' or one of 'bus: |
window_start |
text | Start timestamp or unambiguous prefix. Prefer full timestamps ('YYYY-MM-DD HH:MM:SS'). Date-only values are auto-expanded to midnight. |
window_end |
text | End timestamp or unambiguous prefix. Prefer full timestamps ('YYYY-MM-DD HH:MM:SS'). Date-only values are auto-expanded to midnight. |
condition |
text | Optional conditioning variable for risk bins: hour, load (aliases: load_mw, total_load), slack_import (aliases: slack, slack_import_mw, cable_flow). |
n_bins |
whole number | Number of bins for continuous conditions (load/slack_import). Default 4. |
near_miss_band |
number | Near-miss margin band. Default 0.005 p.u. for buses; thermal branch near-miss uses a fixed 5%% buffer in the first slice. |
worst_n |
whole number | Number of worst episodes to return. Default 5. |
load_scaling_factor |
number | Optional load stress multiplier applied to each snapshot. Default 1.0. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
parallel |
true/false | Enable parallel snapshot evaluation across timestamps. Default false. |
max_workers |
whole number | Optional worker cap when parallel=true. If omitted, backend picks a safe default. |
data_source |
text | 'measurements' (actuals) or 'forecasts' (look-ahead). Omitted: measurements unless another was used earlier in this question. |
Also takes: network, load_power_factor.
Optimisation and flexibility¶
optimize_flexibility¶
Optimize local generator dispatch to resolve voltage or thermal violations in normal (N-0) operation using AC OPF (SMFAE). Returns generator setpoints and the optimization status. Use after run_rsa detects violations, or when the user asks about corrective actions, generator outages, or cable derating. options=true: several corrective dispatches instead (named strategies, or near_optimal alternatives), each meeting every limit, scored the same way and checked by a power flow.
| Argument | Type | Meaning |
|---|---|---|
options |
true/false | True: several corrective options to choose from, instead of the one least-disturbance dispatch. |
hold_units |
list of text | Units whose active power stays at its schedule — the operator's conditions ('without Gen 2', 'don't call the battery'). In service, unlike disabled_generators. With options=true, every option respects them. |
near_optimal |
true/false | With options=true: instead of the named strategies, the cheapest option and up to near_optimal_count (default 5) near-optimal alternatives, each costing at most near_optimal_pct above it and changing other units. |
near_optimal_pct |
number | How far above the cheapest an alternative may cost, %. Default 10. |
n1 |
preventive / corrective / both |
Options secure after the critical outages. preventive: nothing to do when one happens; corrective: a quick action after it (plan returned); both. |
n1_outages |
list of text | Outages to secure (names or tags). Default: the critical ones. |
n1_emergency_loading_pct |
number | Loading allowed after an outage, % of rating. Default: the network's limit. |
n1_reach_pct |
number | Corrective: MW a unit may move after an outage, % of capacity. Default 20. |
n1_load_reduction |
true/false | Corrective: load may be reduced after an outage too (default true). |
near_optimal_methods |
list of hsj / unit_ranges / objectives / random |
Which ways to find alternatives (default all). |
near_optimal_count |
whole number | Alternatives shown, 1–5 (default 5). |
from_option |
text | Start from a corrective option's ref instead of the schedule (its instructions held to this timestamp). |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
disabled_generators |
list of text | Units forced offline (generator loss, islanding), by unit name (under 'Units' in the system prompt). |
slack_max_mw |
number | External-grid exchange cap, MW, both directions. Omit for the network's own limit; 0.0 = islanded. For islanding or derating questions. |
slack_q_max_mvar |
number | External-grid reactive exchange cap, Mvar. Omit to use slack_max_mw. A cap makes local generators supply more Q. |
vm_upper_pu |
number | OPF voltage upper bound, p.u. Default: the network's own upper limit. A tighter bound forces more redispatch. |
vm_lower_pu |
number | OPF voltage lower bound, p.u. Default: the network's own lower limit. Lowering it widens the feasible region. |
opf_lambda_p |
number | OPF weight on squared active-power deviation. Default 0.01; higher keeps P closer to its base value. |
opf_lambda_q |
number | OPF weight on squared reactive-power deviation. Default 0.001; higher keeps Q closer to its base value. |
pg_max_overrides |
object | Per-unit maximum active power, MW: {unit name: MW}. Others keep their capacity. |
pg_min_overrides |
object | Per-unit minimum active power, MW: {unit name: MW}; positive = must-run. Others keep their minimum. |
fixed_setpoints |
object | Pins units to exact MW: {name: MW}; the rest redispatch freely. Keys are unit names (under 'Units' in the system prompt) or the external-grid slack, named under 'Grid domain knowledge' in the system prompt (0.0 isolates the external interface). |
opf_min_power_factor |
number | Minimum generator power factor in the OPF. Default 0.95; lower allows more reactive redispatch. |
opf_current_safety_margin |
number | Fraction of rated branch current the OPF may use (0–1). Default 0.9; 1.0 = full rating. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: branch_limits, network, load_power_factor.
optimize_contingency¶
Compute the corrective flexibility dispatch after a single contingency using AC OPF (SMFAE). Returns the generator setpoints before and after optimization. Use this when the user asks how to fix a specific outage. options, hold_units, near_optimal(_pct), branch_limits: as in optimize_flexibility, after the outage.
| Argument | Type | Meaning |
|---|---|---|
element_type (required) |
text | Network element type: 'line' for power lines or 'trafo' for transformers. Element indices depend on the currently loaded network. |
element_index (required) |
whole number | Zero-based index of the contingency element. Get it from locate_network_element; never guess it. |
options |
true/false | Several corrective options. |
hold_units |
list of text | Units ruled out: in service, no instruction. |
near_optimal |
true/false | Near-optimal alternatives instead. |
near_optimal_pct |
number | How far above the cheapest an alternative may cost, %. Default 10. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
vm_upper_pu |
number | OPF voltage upper bound, p.u. Default: the network's own upper limit. A tighter bound forces more redispatch. |
vm_lower_pu |
number | OPF voltage lower bound, p.u. Default: the network's own lower limit. Lowering it widens the feasible region. |
opf_lambda_p |
number | OPF weight on squared active-power deviation. Default 0.01; higher keeps P closer to its base value. |
opf_lambda_q |
number | OPF weight on squared reactive-power deviation. Default 0.001; higher keeps Q closer to its base value. |
pg_max_overrides |
object | Per-unit maximum active power, MW: {unit name: MW}. Others keep their capacity. |
pg_min_overrides |
object | Per-unit minimum active power, MW: {unit name: MW}; positive = must-run. Others keep their minimum. |
fixed_setpoints |
object | Pins units to exact MW: {name: MW}; the rest redispatch freely. Keys are unit names (under 'Units' in the system prompt) or the external-grid slack, named under 'Grid domain knowledge' in the system prompt (0.0 isolates the external interface). |
opf_min_power_factor |
number | Minimum generator power factor in the OPF. Default 0.95; lower allows more reactive redispatch. |
opf_current_safety_margin |
number | Fraction of rated branch current the OPF may use (0–1). Default 0.9; 1.0 = full rating. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: branch_limits, network, load_power_factor.
optimize_robust_flexibility¶
Robust OPF with two methods: heuristic constraint tightening (back-off) and scenario-based chance constraints. Combines probabilistic security assessment with optimal power flow to find the least-change dispatch that is secure with a user-specified confidence (e.g. 95% or 99%) under modeled uncertainty. Step 1: runs probabilistic RSA to compute per-bus voltage percentile envelopes. Step 2: computes symmetric per-bus back-offs for upper and lower voltage tails. Step 3: solves OPF with tightened per-bus vm_upper and vm_lower bounds. Step 4: iterates tighten-and-solve using target_p_any, max_iter, and min_improvement. Step 5: reports independent validation risk after OPF. Use for a dispatch that is secure with a stated confidence under uncertainty (robust OPF, back-offs for forecast error). Scenario mode also reports whether its scenario count met the nominal bound (guarantee_met; not a certificate for AC OPF) — the out-of-sample validation risk is the evidence.
| Argument | Type | Meaning |
|---|---|---|
opf_min_power_factor |
number | Minimum generator power factor in the OPF. Default 0.95; lower allows more reactive redispatch. |
risk_target |
number | Canonical target violation probability used across modes. Default 0.05. In heuristic mode maps to confidence=1-risk_target and target_p_any unless overridden; in scenario mode maps to alpha. |
robust_method |
text | Robust method: 'heuristic' (default) or 'scenario' for scenario-based chance-constrained AC-OPF. |
sgen_sigma |
number | Relative standard deviation for the sgen (wind/solar) multiplier. Default 0.00 (disabled unless explicitly requested). Set this only when the user explicitly asks for generator uncertainty. |
load_sigma |
number | Relative standard deviation for the load multiplier. Default 0.05 (±5%). |
confidence |
number | Deprecated alias for risk_target in heuristic interpretation: risk_target = 1 - confidence. Only consulted when risk_target is absent. |
n_samples |
whole number | Monte Carlo sample count for the pre-OPF RSA. Default 200. Use 50 for speed, 500 for accuracy. |
validation_samples |
whole number | Independent Monte Carlo sample count for post-OPF validation/certification. If omitted, defaults to n_samples. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
slack_max_mw |
number | Maximum external-grid import/export in MW. Default: loaded profile limit. |
load_scaling_factor |
number | Load stress multiplier for the OPF. Default 1.0 (current load). |
target_p_any |
number | Heuristic-only override for iterative stop target. If omitted, target_p_any is derived from risk_target. |
max_iter |
whole number | Maximum number of robust tighten-and-solve iterations. Default 3. |
min_improvement |
number | Minimum required improvement in p_any between iterations; loop stops when below this threshold. Default 0.005. |
alpha |
number | Deprecated alias for risk_target in scenario interpretation. Only consulted when risk_target is absent. |
beta |
number | Confidence level parameter for scenario method K sizing (probability guarantee holds). Default 1e-3. |
n_scenarios |
whole number | Optional explicit K for scenario method. If omitted, computed from (alpha, beta, d). |
scenario_k_cap |
whole number | Maximum scenario count for tractability. Computed K is clamped to this cap. Default 120. |
allowed_violation_fraction |
number | Optional discard budget fraction in scenario method. Default 0.0 (enforce all scenarios). |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
compute_flexibility_envelope¶
Computes the secure (P, Q) operating region for a single generator at the current network conditions. Holds all other generators at their current SCADA setpoints and sweeps the target generator over a rectangular (P, Q) grid, running a full AC power flow at each point in parallel. Returns a feasibility map (green = secure, red = constraint violated) and the safe reactive power range at the generator's current active output. Use for a generator's safe P/Q range or secure operating region, how much Q it can inject or absorb, or why the OPF chose its Q.
| Argument | Type | Meaning |
|---|---|---|
gen_name (required) |
text | Substation name of the generator to sweep. Required. Use the exact substation names listed under 'Substation names' in the system prompt; they describe the network currently loaded. |
p_min_mw |
number | Minimum P for the sweep in MW. Default: 0.0. |
p_max_mw |
number | Maximum P for the sweep in MW. Default: PG_MAX_DATA[gen_name]. |
q_min_mvar |
number | Minimum Q for the sweep in MVAr (absorbing). Default: −Pmax × tan(acos(0.9)) (PF=0.9 inductive boundary). |
q_max_mvar |
number | Maximum Q for the sweep in MVAr (injecting). Default: +Pmax × tan(acos(0.9)) (PF=0.9 capacitive boundary). |
resolution |
whole number | Grid resolution: resolution × resolution power-flow runs. Default 20 (~400 runs, ~8 s). Max 25 (~625 runs, ~20 s). Use 25 for maximum detail if time permits. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
load_scaling_factor |
number | Load stress multiplier for the sweep. Default 1.0 (current load). |
reference_state |
text | Reference operating point for the envelope sweep: 'scada' (default), 'post_opf' (latest cached optimization dispatch), or 'custom' (apply dispatch_overrides). |
dispatch_overrides |
object | Custom dispatch setpoints used when reference_state='custom'. Format: {element_name: p_mw} or {element_name: {p_mw, q_mvar}}. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: network, load_power_factor.
compute_hosting_capacity¶
Computes hosting capacity for an incremental injection at one bus in deterministic or probabilistic mode. Returns hosting_capacity_mw for one or more reactive-power strategies (unity, fixed_pf, reactive_proxy) plus binding constraints. Use when the user asks: 'how much more can bus X host?', 'hosting capacity at bus X', or 'compare hosting by reactive strategy'.
| Argument | Type | Meaning |
|---|---|---|
bus (required) |
text | Target bus identifier (index or label). Use 'all' for deterministic all-bus scan. |
q_mode |
text | Reactive strategy: all (default), unity, fixed_pf, or reactive_proxy. unity => Q≈0; fixed_pf => Q follows selected power_factor and pf_sign; reactive_proxy => damped counteracting current-bus-Q clipped to a PF=0.9 capability envelope; it is not PF-constrained like fixed_pf. |
power_factor |
number | Power factor used in fixed_pf mode. Default 0.95. |
pf_sign |
text | fixed_pf sign convention: absorbing (default) or injecting. |
mode |
text | Run mode: deterministic (default) or probabilistic. |
risk_threshold |
number | Only for probabilistic mode: maximum allowed probability of any violation. Default 0.05. |
n_samples |
whole number | Only for probabilistic mode: number of Monte Carlo samples. Default 200, capped at 1000. |
added_gen_sigma |
number | Only for probabilistic mode: sigma for bounded availability uncertainty on the added generator. Default 0.10. |
load_sigma |
number | Only for probabilistic mode: multiplicative load uncertainty sigma around the active operating point. Default 0.0. |
uncertainty_scope |
text | Only for probabilistic mode: 'added_generation_only' (default) or 'added_generation_plus_load'. Use the latter only when load uncertainty should also be sampled. |
timestamp |
text | Optional timestamp or unambiguous prefix for the operating point. |
p_max_search_mw |
number | Optional upper search bound in MW. Omit (or 0) for the backend's own choice. |
tolerance_mw |
number | Bisection tolerance in MW. Default 0.1. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
Also takes: network, load_power_factor.
flexibility_over_time¶
Flexibility across several moments. study='hold': a corrective option held from its moment — until when it keeps every limit. study='plan': one corrective plan for a window (a peak), instructions kept from moment to moment, compared with solving each alone. study='security': what N-1 security costs above the cheapest at each moment of a window (a full study per moment, in parallel; its progress is shown).
| Argument | Type | Meaning |
|---|---|---|
study (required) |
hold / plan / security |
|
option |
text | hold: the option's ref (e.g. 'S3:cheapest'). |
start |
text | plan, security: first moment (default: the clock). |
end |
text | plan, security: last moment. |
hours |
number | Length without an end, hours (default 6). |
moments |
whole number | plan, security: moments studied, 2–12 (default 6), evenly spaced, the first and last always kept; hour by hour is one more than the hours (16:00–00:00: 9). |
n1 |
preventive / corrective / both |
security: which N-1 secure option (default preventive). |
screen_n1 |
true/false | hold: the N-1 screen at each moment too. |
objective |
least_disturbance / cheapest |
plan. |
steadiness |
number | plan: how strongly instructions are kept, 0–10 (default 1). |
ramp_pct_per_h |
number | plan: ramp limit, % of capacity per hour. |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
hold_units |
list of text | plan, security: units kept at their schedule. |
data_source |
text | 'measurements' (actuals) or 'forecasts' (look-ahead). Omitted: measurements unless another was used earlier in this question. |
Also takes: branch_limits, network, load_power_factor.
Key performance indicators¶
evaluate_kpis¶
Key performance indicators at one moment: the schedule against a corrective action (the cheapest, or option), each checked by AC power flow. KPI-1 target demand flexibility (spare upward capacity, % of demand), KPI-2 flexibility utilisation (fewest MW that clear the violations ÷ MW the action moves), KPI-3 prevented violation ratio; N-0 and N-1 security margins; flexibility the units can deliver within every limit, up and down, per unit and together; flexibility required; the action's cost (n1: of N-1 security too).
| Argument | Type | Meaning |
|---|---|---|
option |
text | A corrective option's ref (e.g. 'S3:cheapest') to compare with the schedule; at a later moment its instructions held. Default: the cheapest corrective action at each moment. |
n1 |
preventive / corrective / both |
Also the cost of N-1 security above the cheapest (a security-constrained OPF: slower). |
hold_units |
list of text | Units kept at their schedule (the operator's conditions). |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
slack_max_mw |
number | External-grid exchange cap, MW, both directions. Omit for the network's own limit; 0.0 = islanded. For islanding or derating questions. |
slack_q_max_mvar |
number | External-grid reactive exchange cap, Mvar. Omit to use slack_max_mw. A cap makes local generators supply more Q. |
vm_upper_pu |
number | OPF voltage upper bound, p.u. Default: the network's own upper limit. A tighter bound forces more redispatch. |
vm_lower_pu |
number | OPF voltage lower bound, p.u. Default: the network's own lower limit. Lowering it widens the feasible region. |
pg_max_overrides |
object | Per-unit maximum active power, MW: {unit name: MW}. Others keep their capacity. |
pg_min_overrides |
object | Per-unit minimum active power, MW: {unit name: MW}; positive = must-run. Others keep their minimum. |
fixed_setpoints |
object | Pins units to exact MW: {name: MW}; the rest redispatch freely. Keys are unit names (under 'Units' in the system prompt) or the external-grid slack, named under 'Grid domain knowledge' in the system prompt (0.0 isolates the external interface). |
opf_current_safety_margin |
number | Fraction of rated branch current the OPF may use (0–1). Default 0.9; 1.0 = full rating. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: branch_limits, network, load_power_factor.
kpis_over_time¶
The key performance indicators of evaluate_kpis at each moment of a window (measurements or forecasts), each moment with its own corrective action (or option held): ranges, worst moments, the actions' cost and the MWh moved against the MWh required. Moments run in parallel; its progress is shown.
| Argument | Type | Meaning |
|---|---|---|
start |
text | First moment (default: the clock; forecasts: their first). |
end |
text | Last moment. |
hours |
number | Length without an end, hours (default 6; at most 48). |
moments |
whole number | Moments studied, 2–12 (default 6), evenly spaced, the first and last always kept; hour by hour is one more than the hours (16:00–00:00: 9). |
option |
text | A corrective option's ref (e.g. 'S3:cheapest') to compare with the schedule; at a later moment its instructions held. Default: the cheapest corrective action at each moment. |
n1 |
preventive / corrective / both |
Also the cost of N-1 security above the cheapest (a security-constrained OPF: slower). |
hold_units |
list of text | Units kept at their schedule (the operator's conditions). |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
slack_max_mw |
number | External-grid exchange cap, MW, both directions. Omit for the network's own limit; 0.0 = islanded. For islanding or derating questions. |
vm_upper_pu |
number | OPF voltage upper bound, p.u. Default: the network's own upper limit. A tighter bound forces more redispatch. |
vm_lower_pu |
number | OPF voltage lower bound, p.u. Default: the network's own lower limit. Lowering it widens the feasible region. |
data_source |
text | 'measurements' (actuals) or 'forecasts' (look-ahead). Omitted: measurements unless another was used earlier in this question. |
Also takes: branch_limits, network, load_power_factor.
What-if proposals¶
edit_proposal¶
Create a network proposal — the base network plus edits — or add edits to one, for what-if questions about changing the grid (the ops are described in the instructions: new loads, units, shunts, lines, transformers and buses; reinforcements; switching; any setting of an existing element via set_parameter; moves; scaling; include_proposal for 'A + B'). The base is never modified. Study it by passing its id as network to any analysis tool, or with compare_networks. Returns the stored edits, a summary and assumed (values filled in that you did not give — state them). needs_operator means a decision is missing: ask the operator its question with its options; do not choose. Give each edit only the fields its op uses.
Effect: Creates or changes a proposal; the loaded network is never modified.
| Argument | Type | Meaning |
|---|---|---|
proposal (required) |
text | Proposal id: letters, digits, '_' or '-', e.g. 'dc_bus9'. Created if new. |
edits (required) |
list of object | Edits applied in order after any the proposal already has. |
replace |
true/false | True replaces the proposal's edits instead of appending. Default false. |
compare_networks¶
Run one study on the base network and on a proposal at the SAME operating point (one timestamp, dataset, limits and load scaling) and return both results and the difference: new and resolved violations, the largest voltage and loading changes, and changes (proposal minus base) — quote those rather than subtracting. study='scan' compares them at every tick of a window instead — how often and where the proposal violates when the base does not, and its worst moments. Prefer this to separate calls whenever the question compares a proposal with today's grid. against compares with another proposal instead of the base (is B better than A?); proposals compares several at once against the same reference, at one tick, and returns a ranking table plus each comparison.
| Argument | Type | Meaning |
|---|---|---|
proposal |
text | The proposal id to compare with the base (or with against). |
proposals |
list of text | Instead of proposal: up to 6 proposal ids, each compared with the same reference. |
against |
text | A proposal to compare with instead of the base. In the result, base is then that proposal and compared_with names it. |
study |
rsa / n1 / opf / scan |
'rsa' (security assessment at one moment, default), 'n1' (every single line and transformer outage at one moment), 'opf' (the deterministic flexibility OPF at one moment: whether a corrective dispatch exists on each network and what it takes), or 'scan' (the security assessment at every tick of a window). |
start_timestamp |
text | scan: window start (timestamp prefix); default the first tick. |
end_timestamp |
text | scan: window end (timestamp prefix); default the last tick. |
step_size |
whole number | scan: every Nth tick; default every tick (long windows are thinned and say so). |
load_scaling_factor |
number | Multiplier on all active and reactive loads; 1.0 = as measured. |
vm_lower_pu |
number | Lower voltage limit, p.u.; default the network's. |
vm_upper_pu |
number | Upper voltage limit, p.u.; default the network's (Grid domain knowledge). |
max_line_loading_pct |
number | Line overload threshold, %. |
max_trafo_loading_pct |
number | Transformer overload threshold, %. |
data_source |
text | 'measurements', 'forecasts' or 'nominal' (the case's own point; no timestamp). Omitted: measurements unless another was used earlier in this question. |
timestamp |
text | Timestamp prefix, e.g. '2000-01-09 18'. Omitted: the current clock unless one was used earlier in this question. |
Also takes: load_power_factor.
Settings¶
set_load_power_factor¶
Change the session's load power factor: the measurements carry active power only, so every study gives each measured load the reactive power Q = P·tan(acos pf) (lagging). Default 0.95. The change applies to every later study and is kept for this network; the operator sees it in the System tab. Use it only when the operator asks to change the assumption itself — to rerun one study under another power factor, pass load_power_factor to that study instead. reset=true goes back to the default (0.95, or the loads' own when the network's profile states it).
Effect: Changes the session's settings, for every later study.
| Argument | Type | Meaning |
|---|---|---|
value |
number | Power factor, 0.5–1.0 (lagging), e.g. 0.92. |
reset |
true/false | True: back to the default. |
set_generator_model¶
Read or change how each generating unit is modelled. Call with no arguments to list every unit (name, bus, control, set-point, power factor, reactive limits, dispatchable). control='voltage': holds a voltage set-point, reactive power free within q_min/q_max (the OPF keeps those limits); control='power_factor': fixed power factor, injecting or absorbing (pf 1.0 = no reactive power); control='fixed_q': a set reactive output q_mvar. dispatchable: whether the OPF may move its active power. Changes apply to the base network (proposals are re-checked) and are kept for this network; the operator sees and edits them in the System tab. Change the model only when the operator asks; reset=true takes every unit back to how it was loaded.
Effect: Changes the session's settings, for every later study. Called without changes, it only reads them.
| Argument | Type | Meaning |
|---|---|---|
changes |
list of object | One item per setting changed: the unit, which setting, and its new value in the slot that setting uses. Every other setting keeps its value. Several settings or units: several items (voltage control at 1.02 p.u. is control and vm_pu). |
reset |
true/false | True: every unit back to how it was loaded. |
set_unit_costs¶
Read or change what each unit costs. No arguments: every unit and the external grid with its production cost (c0 €/h + c1 €/MWh·P + c2 €/MW²h·P²; the grid's c1 is the import price) and redispatch costs up/down (€/MWh; down for a renewable is curtailment), a reactive price per unit (€/Mvarh) and the grid's reactive band (tan φ) and penalty beyond it, each marked 'case', 'synthetic' or 'operator'; and per load, its demand response (share %, €/MWh) and load-relief price. Kept for this network and shown in the System tab. Used to cost the flexibility options and to find the cheapest one; the default dispatch ignores them.
Effect: Changes the session's settings, for every later study. Called without changes, it only reads them.
| Argument | Type | Meaning |
|---|---|---|
changes |
list of object | One item per price changed: the unit, which price, the new value. Every other price keeps its value. Several prices or units: several items. |
reset |
true/false | True: every cost back to its default. |
rename_elements¶
Rename buses, lines, transformers, loads or units of the loaded network, when the operator asks. Every result uses the new names from then on (a bus's lines and transformers are relabelled with it); measurements stay matched. Use the new names in later calls. No arguments: every renamed element.
Effect: Changes the session's settings, for every later study. Called without changes, it only reads them.
| Argument | Type | Meaning |
|---|---|---|
changes |
list of object | |
reset |
true/false | True: every name back as loaded. |
declare_network_facts¶
Record what the network does not state about its elements, as the operator states it: what drives a unit ('Gen_bus1 and Gen_bus7 are wind farms') or what kind of demand a load is ('Load 5 is a data centre'). Kept for this network; a renewable scaling (scenario scans, the look-ahead's check of renewables below forecast) then applies to the units declared wind or solar. Only what the operator says — never your own guess; 'unknown' withdraws a declaration.
Effect: Changes the session's settings, for every later study.
| Argument | Type | Meaning |
|---|---|---|
units |
list of object | |
loads |
list of object | |
reset |
true/false | Withdraw every declaration (units and loads). |
Shared arguments¶
Arguments many studies take, with the same meaning everywhere.
| Argument | Type | Meaning |
|---|---|---|
branch_limits |
object | Branches held below a share of their rating: {name or tag: %}, e.g. {"L30": 80}. 10–100. |
load_power_factor |
number | Measured loads' power factor (0.5–1, lagging) for this question only. Omitted: the session setting unless one was given earlier in this question. |
network |
text | 'base' or a proposal id. Omitted: 'base' unless a proposal was used earlier in this question (pass 'base' to compare with it). |