DC-OPF Market Clearing and Congestion Analysis
When to Use
- Analyze transmission constraint impacts on electricity prices
- Compare base vs counterfactual market clearing results
- Identify congestion patterns and LMP changes
Input Files
network.json: MATPOWER format power system- Before coding, inspect
bus,gen,branch, andgencostinnetwork.jsonand confirm where costs, limits, statuses, and reserve-related data are stored. Do not assume generator cost coefficients are embedded ingenrows unless the file explicitly shows that. - Thermal capacity line 64→1501 increased 20% in counterfactual
Input Files
Validate Inputs Before Modeling
- Inspect
network.jsonstructure before building the OPF: verify where buses, generators, branches, costs, reserves, and anycolumn_info/ metadata are stored. - Confirm MATPOWER field meanings before using them. Do not guess column indices, thermal-limit fields, generator cost definitions, reserve data semantics, or whether quantities need
baseMVAscaling. - Use one consistent unit convention for load, generation limits, line limits, flows, reserve quantities, and prices.
- Confirm the counterfactual semantics before modeling: only the line 64→1501 thermal capacity changes, and it increases by 20% in the counterfactual.
- If
network.jsonis large, inspect it selectively with lightweight shell checks or small Python probes: confirm top-level keys, array sizes, representativebus/gen/branch/gencostrows, anycolumn_infoor reserve-related metadata, and the exact branch record for 64→1501 before coding.
- Prefer partial, incremental reads over full-file dumps for large inputs: inspect top-level structure and counts first, then
column_info/metadata, then only the specific rows/fields needed for bus demand, generator statuses/limits,gencost, reserve semantics, branch ratings, and the exact 64→1501 branch. Use those discovered counts and mappings to drive the formulation rather than relying on a full pretty-print. - Before writing solver code, inspect enough of
network.jsonto directly locate and confirm the fields/columns used for bus demand, generator min/max output, generator status, branch endpoints, branch reactance/susceptance inputs, branch thermal limits, andgencostcoefficients. Do not proceed from a truncated header/sample alone. - Record one explicit mapping from MATPOWER sections/columns to model inputs and use it consistently in both scenarios; do not mix cost data from
genin one run andgencostin another. - If
network.jsonincludescolumn_info, reserve tables, or other metadata blocks, read them before coding and map every referenced field from that metadata. - Do not invent reserve costs, reserve requirements, extra generator economics, or unsupported reserve fields unless the input explicitly defines them. If reserve-related inputs are ambiguous after inspection, stop guessing and resolve the ambiguity from the provided data first.
- Treat MATPOWER
bus,gen,branch, andgencostvalues as already expressed in the case's native power units unless the file metadata clearly requires conversion. Do not multiply only generator limits, only some costs, or only some flows bybaseMVAwhile leaving related quantities unchanged. - Check generator and branch status fields before modeling; exclude out-of-service elements rather than assuming every row is active.
- Parse
gencostby its declared model/order and coefficient layout; do not guess linear/quadratic terms fromgencolumns or undocumented positions. Inspect at least one actualbranchrow, onegencostrow, and any reserve-related records you rely on before finalizing the parser. - Before writing the full solver, do a tiny schema probe and record the exact fields you will use: top-level keys, array sizes, one representative
busrow, onegenrow, onebranchrow, onegencostrow, and the exact64->1501branch row. - Treat reserve modeling as a data gate: confirm the file explicitly contains reserve quantities, rules, and costs required for co-optimization before coding them. If those inputs are absent or ambiguous, stop guessing and resolve the schema first.
- Before coding the solver, write down a compact field map from the inspected input (for example: demand source, generator limit/status columns, branch endpoint/status/rating columns,
gencostmodel and coefficients, any reserve fields) and reuse that same mapping in both scenarios.
Market Model
DC-OPF with reserve co-optimization:
- Power balance at each bus
- Temperature limits on generators and lines
- Spinning Reserve Requirements
Formulation Requirements
- Build both scenarios from one shared parsing/model-building workflow so the base case and counterfactual use identical formulation, indexing, and post-processing except for the verified 64→1501 thermal-limit increase.
- For every bus, add exactly one nodal power-balance equation; the reference/slack bus still needs its own balance equation.
- Apply the angle reference as a separate constraint only (
theta[ref] = 0or equivalent); never skip the slack-bus balance row when assembling constraints. - When constructing susceptance, admittance, or PTDF matrices, convert every bus label and branch endpoint through a dense
bus_id -> internal_indexmap first. Never index matrices with raw MATPOWER bus numbers unless contiguity was explicitly verified. - Keep explicit handles to every bus power-balance constraint and the reserve-requirement constraint so you can extract LMPs and reserve MCP from solver duals or native exact solver outputs after each successful solve.
- Use the inspected
gencostdata to formulate costs exactly: LP is acceptable only if the verified cost model is linear; if quadratic/polynomial terms are present, include them exactly. - Check dual sign conventions and any
baseMVAscaling before reporting prices so LMPs and reserve MCP are in$ / MWhrather than a mis-scaled dual convention. - If the full model is hard to debug, use a smaller mathematically faithful DC-OPF only to validate indexing, constraints, units, and dual extraction, then return to the full required model; do not replace the market-clearing formulation with heuristics.
- Before trusting reported LMPs or reserve MCP from duals, run a tiny calibration test (for example one simple energy-balance case and one reserve-pricing case) to verify the solver's dual sign/unit conventions; only then apply the same mapping to the full DC-OPF results.
Formulation Requirements
- Use an actual DC-OPF with reserve co-optimization for both cases. Do not approximate total cost, LMPs, or reserve MCP with heuristics, simplified adders, or post-hoc pricing proxies.
- Keep network power-balance and transmission line-flow constraints in both runs so the line-limit change can affect congestion and nodal prices.
- Include nodal power-balance equations for every bus, including the reference/slack bus.
- Fix the reference angle separately (
theta_ref = 0or equivalent), but do not replace the slack-bus balance equation with only an angle-fixing constraint. - Derive reported LMPs and reserve MCP from the solved optimization model/duals or an equivalent exact market-clearing formulation.
Output Format
Report at /root/report.json, for examlple:
{
"base_case": {
"total_cost_dollars_per_hour": 12500.0,
"lmp_by_bus": [{"bus": 1, "lmp_dollars_per_MWh": 35.2}, ...],
"reserve_mcp_dollars_per_MWh": 5.0,
"binding_lines": [{"from": 5, "to": 6, "flow_MW": 100.0, "limit_MW": 100.0}]
},
"counterfactual": {...},
"impact_analysis": {
"cost_reduction_dollars_per_hour": 200.0,
"buses_with_largest_lmp_drop": [...],
"congestion_relieved": true
}
}
- Write the complete structured results to
/root/report.jsonfirst, then use that file as the source for any final summary or answer text. - Before citing headline findings, re-read the specific report fields you mention instead of paraphrasing from memory or logs.
- In addition to the required report fields, include a small scenario-specific diagnostic for the target line 64→1501 in both base and counterfactual outputs (for example its flow, loading fraction or percent, limit, and whether it is binding). Use this to support
congestion_relievedrather than inferring relief only from aggregate metrics.
Execution Checks
- After creating or overwriting any driver script, solver script, or transformed input, inspect the saved file before execution to confirm it contains the intended executable code/data rather than a placeholder summary or partial write.
- After any fix that affects formulation, scaling, prices, outputs, or environment setup, treat all prior artifacts as stale until a new full run completes and rewrites
/root/report.json. - Treat truncated stdout/stderr, abruptly cut-off printed values,
tailoutput, or incomplete solver logs as execution anomalies; investigate and rerun rather than assuming success from a created file. - If the preferred solver is unavailable or fails, try a deliberate fallback solver sequence for the same convex DC-OPF formulation before changing the model.
- Gate all downstream steps on solver success for each run: if termination is infeasible, failed, inaccurate, unknown, or accompanied by blocking warnings, stop extraction, fix the formulation/data issue, rerun, and only then continue.
- Accept results only from runs with clearly successful solve/termination status and the complete primal/dual information needed for dispatch, flows, LMPs, and reserve MCP.
- Do not read dispatch vectors, duals, LMPs, reserve MCP, binding lines, or write
/root/report.jsonfrom missing variables, stale outputs, unsuccessful solves, or partial logs. - Verify artifact regeneration with direct evidence such as successful process exit plus a fresh
/root/report.jsonmodification time or an explicit report-written message before reading the file. - If
report.jsonis large, verify required sections with targeted reads/searches (for examplebase_case,counterfactual,impact_analysis, andreserve_mcp_dollars_per_MWh) rather than relying on a truncated full-file view.
- For large regenerated reports, do a quick two-sided check: inspect the beginning plus the end of
/root/report.json(or targeted keys near each end) to confirm both scenario results and downstream impact-analysis sections were actually written. - After each solve, do a quick sanity pass before accepting the run: confirm both scenarios solved, the modified line limit changed only in the counterfactual, and key outputs are not obviously degenerate (for example unchanged results after the line-limit increase, flat/uniform LMPs without congestion evidence, generation-load mismatch beyond tolerance, or line-flow violations beyond tolerance).
- If outputs look suspicious, treat that as a blocking modeling error: fix the formulation, rerun both cases, and regenerate
/root/report.jsonbefore summarizing.
- If the first runnable script fails with a concrete exception (for example missing module, missing key/field, bad column assumption, infeasibility, or absent duals), debug that specific failure first. Do not respond by immediately rewriting the whole solver or launching a larger background implementation.
- Treat dependency failures as an early decision gate: either fix the environment deliberately and rerun the same exact approach, or consciously switch to another exact formulation supported by available tools.
- If a simplified or reduced model fails, stabilize it before escalating. Confirm whether the issue is schema mapping, status filtering, units, indexing, or formulation infeasibility, and only then scale back up to the full case.
- If execution fails in a way that is inconsistent with what you believe you wrote, read the on-disk file back and reconcile the mismatch before continuing.
- Treat obviously implausible solved outputs as a hard stop, not partial progress. Examples:
$0/hrtotal cost for a nontrivial served system, thousands of binding lines without strong model justification, identical base/counterfactual outputs after the line-limit change, or dispatch/load numbers that conflict with the reported objective. - If a run produces suspicious economics or congestion counts, debug the current formulation/data path first (cost parsing, statuses, indexing, thermal-limit mapping, balance equations, reserve coupling, dual scaling) and rerun before making any new solver/library/framework switch.
- Do not keep restarting in new frameworks after ordinary implementation errors. Unless the current path is fundamentally incapable of producing the required exact outputs, stabilize one end-to-end pipeline and fix the failing component incrementally.
- If you detect that outputs are wrong, incomplete, heuristic, or unsupported by solver outputs, treat that as unfinished work: fix the implementation, rerun both scenarios, regenerate
/root/report.json, and verify the corrected values before concluding. - Treat solver messages such as
Solution may be inaccurate, large residual warnings, or numerically unreliable termination as blocking for final quantitative reporting. Do not use those outputs for costs, LMPs, reserve MCP, congestion claims, orimpact_analysisunless you first resolve the warning or independently verify the solution quality to tolerance. - After each solve and before writing
/root/report.json, run an explicit feasibility validation on the candidate solution: check nodal power balance residuals, generator-limit compliance, reserve-requirement satisfaction, and branch-flow-vs-limit violations using the same solved variables and active limits. - If any validation fails beyond numerical tolerance, or if reported flows exceed enforced limits / generation does not cover load, treat the run as unresolved: fix formulation, scaling, or solver choice, rerun both scenarios, and do not finalize the analysis from that artifact.
- Do not treat file existence, JSON validity, or plausible-looking prices/costs as sufficient evidence of correctness; constraint satisfaction and reliable solver status are mandatory.
- After the first concrete runtime failure (for example
ModuleNotFoundError,KeyError, infeasibility, or missing duals), reproduce and debug that specific failure directly. Do not respond by immediately launching a broader replacement solver or another long implementation path. - If a reduced or fallback model fails, identify whether the blocker is schema mapping, status filtering, indexing, units, or formulation before scaling back up. Treat unresolved errors in the small test as a stop sign for larger runs.
- Prefer foreground runs or an equivalent monitored execution path for the final solve/report generation. If you launch a background task, wait for completion, inspect its result, and confirm a freshly written
/root/report.jsonbefore concluding. - Do not treat a launched process, task id, or partial log as completion; require explicit successful termination plus regenerated report evidence.
- Treat any pre-existing
/root/report.jsonas stale until a corrected run clearly rewrites it; after the final run, open the freshly regenerated file itself and verify it contains populatedbase_case,counterfactual, andimpact_analysissections rather than relying only on console success messages. - After each successful run, reopen
/root/report.jsonitself and verify the required sections and key fields are present (base_case,counterfactual,impact_analysis, and price fields). Do not rely only on solver success, a write message, or a partial file view. - If you inspected an older report before rerunning, treat that file as stale until you confirm a newer timestamp or freshly rewritten contents from the corrected run.
- If you determine that current prices, flows, reserve MCP, or congestion conclusions are wrong or based on a simplified/proxy method, treat the task as still incomplete: update the implementation, rerun both scenarios successfully, and verify the regenerated
/root/report.jsonbefore concluding. - Do not stop at diagnosis. A recognized defect is only resolved after the fix is applied on disk, the workflow is rerun, and the corrected outputs are read back from the fresh report.
- Before using any external network library conversion or custom sparse/PTDF build on the full case, run one tiny proof check: verify a few
bus_id -> internal_indexmappings succeed, verify the target branch64->1501maps correctly, and if using a library API, create one minimal object with the exact required arguments before bulk conversion. - If primal dispatch/flows look plausible but LMPs or reserve MCP are extreme, unstable, or solver-marked
optimal_inaccurate, treat that as a scaling/conditioning failure rather than a finished result: inspect reactance/susceptance magnitudes, matrix conditioning, and unit consistency, then rescale the same formulation and rerun before reporting prices.
Execution Checks
Implementation Guardrails
- When you create a Python script, write executable code immediately; do not create placeholder files that only describe intended logic in prose.
- Before first execution, quickly inspect the created script and confirm it contains real imports, functions or solver calls, and a report-writing path rather than a textual summary.
- When writing a script via a file tool or heredoc, treat the write as untrusted until you read back the saved file and verify key executable lines are present exactly as intended. If the on-disk content looks like prose, a placeholder summary, or a partial write, rewrite it before running anything.
- If dependencies are missing or system Python is externally managed, use a concrete, reproducible setup path such as
python3 -m venv /root/.venv && . /root/.venv/bin/activate && pip install <packages>; then verify imports with a small command before running the full workflow. - If you create a local virtual environment, keep using that same interpreter for install, probe, and solve steps (for example
/root/.venv/bin/pythonand/root/.venv/bin/pip) so package availability is consistent across reruns. - If the solver reports infeasible or failed on the base case, treat that as a formulation or data-mapping bug: inspect parsed limits/status fields, balance equations for every bus, slack-bus handling, reserve coupling, and the specific constraints causing infeasibility before changing algorithms.
- Do not abandon a failing model by restarting from scratch without evidence that the underlying parsing or formulation bug was fixed.
- Do not stop after launching a long run: wait for completion, check successful termination, and confirm a freshly rewritten
/root/report.jsonbefore concluding.
- Prefer one dedicated executable driver script (for example
solve_market.py) that parses inputs, runs both scenarios through the same code path, and writes/root/report.jsondirectly; this is the default reproducible workflow unless a clearly simpler exact path already exists.
Execution Checks
- After any code or model change, rerun the full workflow and verify the run completed before trusting outputs.
- Do not treat truncated logs or partial file views as proof that both scenarios solved.
- Before reading
/root/report.json, confirm the corrected run finished and rewrote the artifact via a successful exit/termination status, completion message, or fresh file timestamp. - Only summarize results after verifying both base and counterfactual cases completed successfully and the final report was regenerated.
Key Metrics
- Binding lines: loading >= 99% of thermal capacity
- LMP = Locational Marginal Price at each bus
- Reserve MCP: system-wide reserve clearing price
Preflight Validation
- Record the baseline thermal limit of branch 64→1501 before any edits, and verify the branch identifiers and rating field match the intended asset exactly.
- Before the first full solve, sanity-test the exact formulation on the verified data: check slack/reference-bus handling, one balance equation per bus, branch-flow sign conventions, thermal-limit encoding, and reserve coupling.
- After applying the counterfactual, confirm that only this branch limit changed and that the new limit equals the baseline multiplied by 1.2.
- If the base case is infeasible, debug the existing formulation first on the verified model/data. Do not replace the algorithm as the first response to infeasibility.
- If required optimization packages are missing or the system Python is managed, create and use a local virtual environment (for example
/root/.venv), install the needed dependencies there, and rerun from that environment rather than abandoning the exact DC-OPF workflow. - After creating the virtual environment or installing packages, immediately verify the exact interpreter path and imports you plan to use with a tiny command before writing or rerunning the full workflow.
- Before choosing an implementation path, probe the environment with quick import/solver checks for the libraries you plan to use. Prefer the lightest viable exact path that matches the runtime you actually have.
- Do this dependency check before writing a full solver script. If key packages/solvers are unavailable, either use an allowed local virtual environment (for example
/root/.venv) and re-check imports, or switch immediately to an already-available exact workflow. - Prefer short, testable probes first: verify parsing, field mappings, and one small solve or formulation check before launching the full two-scenario run.
- Do not spend the task on prolonged environment surgery before trying an environment-compatible implementation path.
- After environment setup changes, rerun the full workflow and re-verify solver availability before solving base and counterfactual cases.
- Before committing to a library or custom network build, run one tiny proof check for the chosen path: verify bus-label-to-index mapping on a few buses/branches and, if using an external power-system API, confirm the minimal object-creation call signatures and required arguments from that API before bulk conversion.
- Before writing the full solver, run a tiny environment/dependency probe for the exact planned stack (imports plus a callable solver check) and choose the implementation path from that evidence.
- If the preferred stack is unavailable, do not continue with the same large design anyway. Either set up a local virtual environment and re-check imports/solvers, or switch immediately to an already-available exact workflow.
- In constrained runtimes, prefer an already-supported exact workflow over prolonged package or system-install attempts. Do not spend the task on heavyweight environment repair if a supported exact path is available sooner.
- If no environment-supported exact workflow is available after that probe, stop escalating to larger rewrites or long background jobs; explicitly treat the environment as the blocker rather than pretending the same plan is still feasible.
- Keep the first executable test small: confirm parsing, key field mappings, and one minimal exact solve or formulation check before launching the full two-scenario run.
- Before implementing the counterfactual, explicitly verify that bus 64, bus 1501, and at least one branch connecting 64->1501 exist in the input data; do not write scenario logic against an assumed or inferred asset.
- If multiple rows could match the target asset, identify the exact branch row by endpoints and the verified thermal-limit field before editing any limit.
- Record the exact branch row/index, active rating field, and baseline thermal limit for line 64→1501 before solving so the same identified asset is modified and re-checked in the counterfactual.
- If bus labels or parallel branches make the target ambiguous, resolve that ambiguity from the actual branch data before applying the +20% change; do not proceed on a guessed branch match.
- If a custom-built DC-OPF remains infeasible after basic data checks show adequate generation/reserve capability, treat that as evidence of a formulation bug and prefer a proven MATPOWER-aware/domain solver path over continued large custom rewrites.
- When using a domain OPF solver, first confirm it can represent the required DC network-constrained clearing and exposes exact solved-case prices, flows, and limits needed for reporting; then use those native outputs directly.
Preflight Validation
- Confirm the case has the expected MATPOWER sections:
baseMVA,bus,gen,branch,gencost. - Verify the specific branch corresponding to line 64→1501 exists before modifying its thermal limit for the counterfactual.
- Sanity-check units and sign conventions used in power balance, branch flow limits, generator limits, and reserve requirements before solving.
- Do not switch to a new solver just because the first run is infeasible; first inspect formulation errors such as slack-bus treatment, flow sign conventions, reserve coupling, and line-limit encoding.
Tips
- Run market clearing twice with different constraints
- Compare LMP differences to find impacted buses
- Report top 3 buses with largest LMP drop
- Build the base-case model from verified data before applying the counterfactual line-limit change.
- If generation costs are quadratic/polynomial, read them from
gencostand formulate the objective accordingly rather than guessing fromgencolumns. - In MATPOWER-style data, create a dense
bus_id -> internal_indexmapping before building susceptance/PTDF matrices or indexing arrays; bus numbers may be noncontiguous. - If the full case is difficult, debug on a reduced but mathematically faithful model first, then scale back to the full network.
- Read
references/dc-opf-guardrails.mdwhen implementing the optimization or network matrices.
- Use targeted schema-inspection, indexing, sparse-matrix, and dual-handling patterns from
references/dc-opf-guardrails.mdwhen the case is large or when price extraction is fragile. - Read
references/solver-choice-patterns.mdwhen selecting a solver or deciding whether native MATPOWER-aware OPF outputs can be used directly. - Read
references/environment-and-debugging.mdwhen deciding what tooling is feasible in the current runtime or when the first implementation attempt fails.
- Before coding, inspect the input schema and map every column/field used in costs, limits, reserves, and line ratings.
- Do not simplify away transmission constraints or reserve co-optimization; the counterfactual must propagate through the network model.
- Validate MATPOWER conventions before solving: keep
bus[:, PD],gen[:, PMIN], andgen[:, PMAX]in consistent units, and do not multiply only some quantities bybaseMVA. - If the base case is infeasible, debug the formulation on the verified input data before rewriting the algorithm.
- After each solve, check solver status before reading dispatch or price outputs; do not write
report.jsonfrom missing variables, failed solves, stale artifacts, or incomplete logs. - Before summarizing impacts, inspect the complete final
report.jsonand verify the cited numbers actually appear there. - Do not finish until
/root/report.jsonis written with both scenarios and impact analysis.
- Preferred sequence: inspect schema, metadata, statuses, and units -> build one faithful DC-OPF with reserve co-optimization on verified indexing -> solve base case -> clone the same model/data and change only line 64→1501 limit by +20% -> solve counterfactual -> validate statuses and refreshed outputs -> write report.
- Prefer one executable driver script that performs the full pipeline end to end: load/inspect input, run both scenarios through the same solve routine, compute comparisons, and write
/root/report.json. Avoid splitting scenario logic across ad hoc manual commands when one script can keep the runs synchronized. - Prefer one reproducible driver script or reusable solve routine that loads/parses the network once, builds the model once, runs both base and counterfactual through the same code path, computes comparison metrics, and writes a single unified
/root/report.json; the only intended modeled difference is the 64→1501 thermal-limit change. - Prefer a MATPOWER-aware OPF solver/library when available instead of rebuilding every matrix and pricing output from scratch; if it exposes native economic outputs, use those exact solved-case fields for LMPs, reserve prices, branch flows, and active limits rather than estimating them from dispatch or heuristics.
- For large cases, use sparse bus/branch/generator incidence and susceptance matrices.
- If solves are numerically fragile or prices look unstable, rescale the same formulation consistently and rerun; a practical recovery pattern is to keep balance equations, generation, flows, and limits in one MW-based convention end to end.
- When using optimization software, store handles to nodal balance constraints for every bus and the reserve requirement constraint so you can extract LMPs and reserve MCP directly from dual values after each successful solve.
- Resist solver rewrites or heuristic fallbacks unless they preserve the same network-constrained market-clearing model and exact required outputs.
- Preserve the proven workflow for this task shape: use targeted schema probes plus metadata first, then one reusable script/function that runs both base and counterfactual cases through the same parsing, model, extraction, and report-writing path.
- If an initial solved report shows implausible price magnitudes or signs, treat that as a likely extraction/scaling bug and fix it before finalizing.
Minimum completion checklist
- Verify any created script/config/report artifact contains real content, not placeholder prose.
- If any intermediate result is known to be wrong, incomplete, heuristic, or unsupported by solver outputs, revise the implementation and rerun until
/root/report.jsonreflects corrected results.
Minimum completion checklist
- Build the same DC-OPF with reserve co-optimization for both runs; only change the 64→1501 thermal limit in the counterfactual.
- Solve base case and counterfactual successfully.
- Extract total cost, bus-level LMPs, reserve MCP, and binding lines for each run.
- Compare cases and write
/root/report.json.
Validation Before Finalizing
- If you changed code after inspecting an earlier
report.json, reopen and revalidate the newly regenerated file only after confirming the corrected run completed; never summarize a possibly stale artifact. - Confirm the base and counterfactual runs use the same data parsing, model formulation, price extraction, and reporting logic; only the specified 64→1501 thermal limit should change in the counterfactual.
- Confirm the final report contains populated
base_case,counterfactual, andimpact_analysissections, not just an existing file. - When using a domain OPF solver, verify that reported LMPs, reserve prices, branch flows, and thermal limits come from the solved-case outputs, not from a separate approximation layer, stale arrays, or reconstructed debug calculations.
- Treat self-detected anomalies or obviously broken outputs as blocking formulation bugs, not usable results. Examples:
$0/hrtotal cost, identical base and counterfactual outputs despite an active constraint change, implausibly many binding lines, extremely large or near-zero LMPs without clear model justification, or$0/MWhreserve MCP despite apparent reserve scarcity. - If you changed cost scaling, per-unit/MW conversions, or dual-sign conventions during debugging, re-validate them end to end before using total cost, LMPs, or reserve MCP in the final report.
- Sanity-check at least a few LMPs and the reserve MCP directly after each successful solve. If prices look implausibly large or small, re-check
baseMVAhandling, objective units, and dual-to-$ / MWhconversions before trusting any report values. - Use a hard acceptance gate on economics: if total cost, LMPs, or reserve MCP are implausibly scaled, do not finalize. Fix units or dual conversion, rerun both scenarios, and confirm the corrected values appear in the regenerated
/root/report.json. - Validate not just JSON structure but the scenario story: confirm line 64→1501 exists in the solved input, was the only thermal-limit change in the counterfactual, compare its base vs counterfactual loading/binding status, and confirm
congestion_relievedmatches those solved results. - Do not call outputs realistic or conclude congestion impacts are established if any blocking physical, economic, or stale-artifact validation check still fails.
- Treat this as a hard stop rule: if you detect generation-load mismatch, branch-limit violations beyond tolerance, failed reserve satisfaction, or solver-reported inaccuracy that remains unresolved, do not present the results as a completed market analysis.
- Prefer a targeted validation script/check that computes max balance residual and max line-limit violation from the solved outputs before accepting either scenario; verify these checks for both base and counterfactual, not just by inspecting report snippets.
- Treat self-detected plausibility concerns as blocking unless resolved. If you observe signs such as extreme LMPs or reserve MCPs, likely scaling errors, or outputs inconsistent with the modeled network, do not present the run as a valid completed market analysis.
- If a blocking issue cannot be resolved after debugging, do not silently finalize with suspect numbers; explicitly state that valid market results could not be established and why.
- Explicitly compare the target branch 64→1501 across both solved scenarios: confirm its thermal limit is
base_limitin the base case and1.2 * base_limitin the counterfactual, then check its flow, loading, and binding status changed or not as reported. Do not infer congestion relief only from aggregate cost or average price changes. - Re-check price extraction against the actual balance-constraint form used in the solved model: verify the dual sign convention and any needed scaling before accepting bus LMPs or reserve MCP.
- Before summarizing results, open the regenerated
/root/report.jsonand verify the required top-level sections and fields are present:base_case,counterfactual,impact_analysis, scenario cost/LMP/binding-line data, andreserve_mcp_dollars_per_MWh. - After each successful solve, do a short plausibility review of total cost, a few LMPs, reserve MCP, and the constrained-line story before treating the run as usable. If magnitudes or signs look implausible, debug dual interpretation, scaling, or reporting logic and rerun rather than trusting the first extracted values.
- Treat any self-detected feasibility violation as a hard stop. If you observe generation-load mismatch, branch flows above enforced limits beyond tolerance, reserve shortfall, or any inconsistency between reported dispatch/flows and the modeled constraints, do not finalize the task from that run.
- Treat solver warnings such as
Solution may be inaccurateas blocking for final quantitative reporting unless you resolve the warning or independently verify the candidate solution to tolerance with explicit residual/violation checks. - Do not accept
/root/report.jsonmerely because it exists or contains plausible values. Recompute and check max nodal-balance residual, max branch-limit violation, generator bound violations, and reserve satisfaction from the solved outputs for both scenarios before concluding. - Validate congestion conclusions with both aggregate metrics and line-level evidence on the modified asset: inspect the solved flow, limit, loading, and binding status of branch 64→1501 in both scenarios, and ensure
congestion_relievedand any claimed LMP impact are consistent with that branch-specific evidence. - After regenerating
/root/report.json, validate both content and schema: read back the top-level keys and confirmbase_case,counterfactual, andimpact_analysisare all present before trusting headline numbers. - Build the final narrative from
/root/report.jsonand these targeted checks, not from intermediate console output, partial logs, or remembered values. - If these checks fail or remain ambiguous after reruns, explicitly report that valid market results could not be established rather than presenting suspect prices, costs, congestion claims, or impact analysis as completed results.
Validation Before Finalizing
Treat these checks as mandatory before writing /root/report.json or claiming success:
- Confirm solver/termination status is successful for both scenarios before extracting dispatch, LMPs, reserve MCP, or line flows.
- Verify the counterfactual only changes the specified line 64→1501 thermal limit by +20%.
- Verify
/root/report.jsonis complete, readable JSON and not truncated. - Confirm physical consistency: total dispatched generation covers total load within numerical tolerance, and no reported binding/loaded line exceeds its thermal limit except negligible solver tolerance.
- Confirm economic consistency: total cost is reported in
$ / hour, while LMP and reserve MCP are reported in$ / MWh; re-check signs, scaling, dual conventions, and final magnitudes if objective scaling or per-unit conversions changed during debugging. - Treat implausible outputs as blocking issues. Examples:
$0/hrtotal cost, suspiciously uniform prices, identical results after a material constraint change, implausably many binding lines, or prices/MCP that are orders of magnitude off without a clear model-based reason. - Check that binding-line identification is consistent with the skill threshold (
loading >= 99%of thermal capacity) and that binding lines, LMP changes, reserve MCP, and congestion relief tell a coherent network-constrained story. - If solver warnings, infeasibility, unexplained generation-load mismatch, violated limits, or other formulation concerns appear, stop, fix the model, rerun both cases, and only then finalize. If unresolved, explicitly report that valid market results could not be established.