Skip to content

Linearize the PolyhedralFunctionBlock of a UCBlock in the default BlockConfig of the UCBlock templates - #126

Open
dmeoli wants to merge 3 commits into
SPSUnipi:mainfrom
dmeoli:feature/ucblock-polyhedral-function-config
Open

dmeoli wants to merge 3 commits into
SPSUnipi:mainfrom
dmeoli:feature/ucblock-polyhedral-function-config

Conversation

@dmeoli

@dmeoli dmeoli commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

smspp_ucblock_solver reads, when no -B is given, the BlockConfig InnerBCfg.txt from the -c folder, which pySMSpp sets to the folder of the BlockSolverConfig; the UCBlock folder had none, so a UCBlock with a PolyhedralFunctionBlock (e.g., the future value of the water of the HydroSystemUnitBlock that pypsa2smspp writes with hydro_system=True) was solved with the function in its natural form, which a :MILPSolver cannot handle, and the tool failed.

The folder now ships InnerBCfg.txt, a map from classname to BlockConfig whose only entry puts the PolyhedralFunctionBlock in its linearized form (PFBCfg.txt, the same file as in the TSSBlock folder of #116). Every other sub-Block keeps the formulation it is deserialized with, so the instances without a PolyhedralFunctionBlock are solved as before: the 23 cases of test_ucblock.py of pypsa2smspp without hydro units pass with and without the file, and the 2 hydro cases with hydro_system=True pass with the default template (with the optimum of PyPSA, 2.9533401e10 and 1.5550488e9) and fail without it. The new test checks that the folder carries the file with that entry only.

The two-stage case needs no change here: smspp_tssb_solver reads TSSBCfg.txt by default, and the TSSBlock/InnerBCfg.txt of #116 already has the PolyhedralFunctionBlock entry, to be given with B="InnerBCfg.txt".

…s by default, linearizes the PolyhedralFunctionBlock

A UCBlock with a PolyhedralFunctionBlock, e.g., the future value of the
water of a HydroSystemUnitBlock, could not be solved from the UCBlock
templates, since a MILPSolver needs the function in its linearized form
and the folder gave no BlockConfig asking for it. The map has that entry
only, so the other sub-Blocks keep the formulation they are deserialized
with and the instances without such a function are solved as before.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant