Planning profiles ================= A planning profile is a named way of searching for the works that resolve the violations of a network (#80, step 6f). It is made for a persona, someone with a question to answer, and it translates that persona into the settings of a run: the order in which the violation types are taken, how the strategies of a turn are chosen, whether the run is priced, and which strategies it registers with which search options. gridforge's strategies are heuristics. Each makes a reasonable choice at its turn, and the plan a run ends with depends on the order of the turns and on how the choices are made. No profile, and no combination of settings, claims to give the plan of lowest cost: only a solver over the whole space of works could. The profiles explore that space in different ways, at different costs in CPU, and the figures below say what each gives on the case study, not what it would give on other networks. A profile fixes how the run searches, not the data of the study. The line and transformer types, the prices, the cap on conductors in parallel (3 in the case study) and the flexibility of the loads stay the study's. Which profile? -------------- .. list-table:: :header-rows: 1 :widths: 14 28 30 28 * - Profile - Persona - How it searches - What it trades off * - ``standard`` (the default) - The planner of an investment programme: routine works, priced. - The default order of the violation types. In each turn, the lookahead rates the chains of strategies it tries by their cost. Line upgrades, transformer upgrades, the no-load tap of the unit in place. - The reference of the case study. No new sites: no new MV/LV substation is considered. * - ``screening`` - An analyst running many feeders or scenarios, for an envelope or a ranking. - As ``standard``, but the first strategy that resolves a turn is kept, without the lookahead. - Less CPU than ``standard``. It rates fewer chains of strategies, so its plans can differ from ``standard``'s where the choices interact (flexibility against works). See the figures below. * - ``extended`` - A planner who wants to see what a wider set of measures and a top-down order find. - The top-down order (the MV network first, then each LV network). Every lever: the line upgrades kept to the zone of the violations, and new MV/LV substations that take back the line and unit upgrades of an LV network before adding one unit to it. Lookahead, priced. - More CPU than ``standard``. Plans that may include new sites, and that differ from ``standard``'s feeder by feeder, in either direction. See the figures below. * - ``hosting_capacity`` - A connection or hosting-capacity analyst who needs the works a scenario requires, not their cost. It runs without prices, as pv-flex runs, and is the set-up proposed for pv-flex. - As ``extended``, without prices: the first strategy that resolves a turn is kept. - No prices needed. Its plan is a set of works that resolves the violations, not a cost estimate: the line choices are not guided by price. Flexibility, if the study offers it, is used first. The settings of each profile ---------------------------- .. list-table:: :header-rows: 1 :widths: 34 16 16 16 18 * - Setting (``PlanningProfile``) - ``standard`` - ``screening`` - ``extended`` - ``hosting_capacity`` * - ``order`` - ``default`` - ``default`` - ``top_down`` - ``top_down`` * - ``strategy_choice`` - ``lookahead`` - ``first`` - ``lookahead`` - ``first`` * - ``priced`` - yes - yes - yes - no * - ``no_load_tap`` (``NoLoadTapStrategy``) - yes - yes - yes - yes * - ``restrict_to_violation_zone``, ``one_upgrade_per_zone`` (line upgrades) - no - no - yes - yes * - ``new_substation`` (``NewSubstationStrategy``) - no - no - yes - yes * - ``take_back_line_upgrades``, ``take_back_transformer_upgrades`` - -- - -- - yes - yes * - ``units_per_call``, ``max_new_substations`` - -- - -- - 1, the study's (3) - 1, the study's (3) All four register ``LineUpgradeStrategy`` and ``TransformerUpgradeStrategy``, and ``FlexibilityStrategy`` when the study gives the loads a share of flexibility. ``TapChangeStrategy``, an operation strategy, is in none of them: it must not share units with the no-load tap (see :doc:`usage`). Each profile in short --------------------- ``standard`` The case study's default, and the reference of every comparison. Its results are those of the case study's default before the profiles, run by run (the figures below). The lookahead compares the chains of strategies a turn offers by their cost, which matters where strategies compete: flexibility against works, the no-load tap against line upgrades. Its plans rely on the units in place having Enedis's current tap range (0, +2.5, +5 %); for units whose range is not known, take it with ``no_load_tap=False``. ``screening`` The same kinds of works as ``standard``, with less CPU: the first strategy that resolves a turn is kept, so fewer chains of strategies are rated, and its plans can differ from ``standard``'s where the choices interact, as flexibility against works. The figures below give how much, on the case study. Use it to rank feeders or size an envelope over many runs, then run the feeders retained with ``standard``. ``extended`` The top-down order of #80 with every lever the case study has: the MV network is reinforced first, then each LV network, with the no-load tap first in the LV voltage turns, the line upgrades kept to the zone of the violations, and new MV/LV substations. A new substation takes back the line and unit upgrades the run made in its LV network, so that the network is reinforced either by copper or by a new unit, not by both. It explores plans that ``standard`` does not consider, at more CPU, and its plans differ from ``standard``'s feeder by feeder, in either direction. ``hosting_capacity`` ``extended`` without prices: the works a scenario requires, with no cost model, as pv-flex runs (pv-flex itself registers its own strategies in the default order, without the no-load tap or the new substation (its registry can add a ``TapChangeStrategy``); this is the set-up proposed for it). The run chooses the first strategy that resolves each turn, so that its plan answers "which works, and how many", not "at what cost": the line choices are not guided by price. A study that needs a cost prices the works afterwards, as pv-flex values the works and the curtailment itself. Figures on the case study ------------------------- The 150 feeders of version 2, loads × 2.5, at 0 and 30 % of flexibility: each profile run with ``benchmarks/profile_study.py study --profile NAME`` at commit ``0a6daf0`` (2026-11-27), 2 workers under ``nice``, 300 runs per profile, all resolved, with no error. The files are ``benchmarks/results/2026-11-27/study_profile_*.json``. CPU is the sum of the runs' seconds in this one batch, on a shared machine: each file records the load average (1, 5 and 15 minutes) at its start, from 12.3 to 17.9 on 24 cores for the three priced profiles, and from 5.5 to 9.5 for ``hosting_capacity``. Compare CPU within the batch only. "Tap visits" counts the interventions on no-load taps (``no_load_tap_interventions``), "Actions" the actions of the plans. The change of cost is measured against the case study with the cap of 3 conductors and before the no-load tap (``2026-11-25/study_step7_off_cap_3.json``: 34.637 M€ at 0 %, 9.493 M€ at 30 %). Release 0.4.0, which has no cap, gives 34.629 M€ and 9.495 M€ (``2026-11-24/study_milestone2.json``). .. list-table:: :header-rows: 1 :widths: 16 7 11 9 9 9 9 9 8 9 * - Profile - Flex. - Cost (M€) - vs cap 3 - Resolved - Shed (MW) - Tap visits - Actions - New units - CPU (s) * - ``standard`` - 0 % - 33.608 - −3.0 % - 150 - 0.0 - 134 - 329 - 0 - 129 * - - 30 % - 9.190 - −3.2 % - 150 - 134.1 - 25 - 484 - 0 - 1,657 * - ``screening`` - 0 % - 33.609 - −3.0 % - 150 - 0.0 - 135 - 330 - 0 - 79 * - - 30 % - 9.246 - −2.6 % - 150 - 138.2 - 54 - 490 - 0 - 689 * - ``extended`` - 0 % - 33.384 - −3.6 % - 150 - 0.0 - 109 - 362 - 1 - 148 * - - 30 % - 9.167 - −3.4 % - 150 - 134.3 - 31 - 494 - 1 - 1,836 * - ``hosting_capacity`` - 0 % - not priced - -- - 150 - 0.0 - 119 - 376 - 0 - 71 * - - 30 % - not priced - -- - 150 - 149.5 - 41 - 503 - 0 - 577 ``hosting_capacity`` runs without a cost model, so its runs have no cost: its file records ``null`` as the total cost of each run. The run was made before ``profile_study.py`` recorded None for a run without prices (the review of !65), and recorded 0.0; these were set to ``null`` in the committed file, as the profiler now records them. Its plans are not priced afterwards here: the run records hold no list of the works. Feeder by feeder against ``standard`` in the same batch (a feeder counts when its cost differs by more than 1 €): - ``screening``: at 0 %, 1 feeder costs more (``53_MVFeeder1070``, by 914 €), and none less; at 30 %, 13 feeders cost more, by 138 € to 42.1 k€ (``84_MVFeeder2419``), 55.9 k€ in all, and none less. Total +0.00 % at 0 % and +0.61 % at 30 %; CPU ×0.62 and ×0.42. - ``extended``: at 0 %, 23 feeders cost less, by 0.4 to 59.1 k€ (``84_MVFeeder3748``), 413.3 k€ in all, and 10 more, by 0.2 to 59.5 k€ (``52_MVFeeder0192``), 189.7 k€ in all; at 30 %, 17 cost less (37.3 k€ in all) and 17 more (14.5 k€ in all). Total −0.67 % at 0 % and −0.25 % at 30 %; CPU ×1.15 and ×1.11. It builds 1 new substation at each level of flexibility (22,941 € and 17,941 €, 0.010 km of MV cable, 1 LV line opened). - ``hosting_capacity``: CPU ×0.55 and ×0.35; at 30 %, 149.5 MW shed against 134.1 MW. ``standard``'s runs are those of the case study at ``2a850d7`` (step 6e), run by run to the cent. A researcher's run of this set-up on pv-flex's 7 over-voltage cases without prices (proposal at ``28128c1``, not committed here) resolved 7 of 7 with 4 new units and 167 conductors. Named orders ------------ ``order`` takes a name of ``ORDERS`` (``gridforge.core.profiles``) or the entries of an order, as ``EnhancementStrategyRegistry`` takes them: ``default`` The registry's own order: the loading of the transformers, that of the lines, the over-voltages, the under-voltages, every level at once. ``top_down`` ``TOP_DOWN_ORDER``: the MV network first, then the LV networks, in each the loading of the transformers, that of the lines, the over- and under-voltages. ``loading_first`` ``LOADING_FIRST_ORDER``: the loading from the bottom up (the LV networks, then the MV network), then the voltages from the top down. A named setting, not a profile. Measured with every lever (as ``extended``), its total cost against the top-down order on the 150 feeders: −1.2 % at 0 % of flexibility and −0.5 % at 30 % with loads × 2.5, the data it was chosen on; −0.1 % and −0.0 % with loads × 2.0, which it was not chosen on (researcher's runs at ``cbdbccf``, 2026-11-27, not committed here). Take it with ``order="loading_first"``. Overriding a profile -------------------- Every setting of a profile can be overridden, by its name; the profile of the run is then named after its own with ``+overrides``, and records every setting it ran with (``PlanningProfile.settings``). In the case study, ``CaseStudyConfig.profile`` (``standard``) names the profile, and the functions of ``gridforge/case_study/mv_lv_feeder.py`` take a profile and overrides: .. code-block:: python from gridforge.case_study import mv_lv_feeder # The registry and the options of GridEnhancementAlgorithm of a profile registry, options = mv_lv_feeder.create_run(with_flex=True, profile="extended") # The same profile in the loading-first order, without the no-load tap registry, options = mv_lv_feeder.create_run( True, profile="extended", order="loading_first", no_load_tap=False ) ``create_strategy_registry`` takes the same profile and the overrides of the registry, and ``create_run`` also those of the algorithm, ``strategy_choice`` and ``priced``. The study's data stay its own arguments: ``max_parallel_conductors`` and ``uncap_dedicated_lines`` (see :doc:`usage`). ``mv_lv_feeder.py --profile NAME`` runs the case study with a profile, and ``benchmarks/profile_study.py`` takes ``--profile NAME`` and, as overrides, ``--order``, ``--strategy-choice``, ``--new-substation``, ``--max-new-substations`` and ``--no-load-tap``; it records them as ``registry_options``, and each run records the settings of its profile. A profile of one's own is a ``PlanningProfile``, or one of ``PROFILES`` with ``dataclasses.replace`` or ``get_profile(name, **overrides)``, passed as ``profile``. Without the case study ---------------------- A study that builds its own strategies takes from a profile what concerns the search. A study that runs without prices with its own strategies, as pv-flex does, would take ``hosting_capacity`` so (``profiles_test.py`` runs this example): .. code-block:: python from gridforge.core.grid_enhancement import GridEnhancementAlgorithm from gridforge.core.profiles import PROFILES from gridforge.strategies.line_upgrade import LineUpgradeStrategy, dedicated_lines profile = PROFILES["hosting_capacity"] registry = profile.new_registry() # the priority order of the profile registry.register_strategy( LineUpgradeStrategy( line_types, max_parallel_conductors={"lv": 1, "mv": 1}, uncapped_lines=dedicated_lines, **profile.line_upgrade_options(), ) ) # ... its other strategies, with profile.new_substation_options() for a new substation algorithm = GridEnhancementAlgorithm( power_flow_engine=engine, strategy_registry=registry, **profile.algorithm_options(), # strategy_choice "first", no cost model ) ``algorithm_options(cost_model)`` refuses a priced profile without a cost model, and a profile without prices refuses the lookahead, which rates the chains by their cost. Reproducing earlier results --------------------------- - ``standard`` gives the results of the case study's default before the profiles, entry for entry (checked on 44 runs: the 2 feeders in git and 20 of version 2, at 0 and 30 % of flexibility). - ``extended`` gave the results of the former ``top_down_order=True`` (``--top-down on``), which it replaced; ``screening`` gave those of the default with ``strategy_choice="first"``; ``hosting_capacity`` gave those of the former top-down order without a cost model. - ``standard`` with ``no_load_tap=False`` gives the results of the case study before the no-load tap: the strategy off, with the cap of 3 conductors (``2026-11-25/study_step7_off_cap_3.json``, 34.637 M€ and 9.493 M€).