Runs a set of post-interpolation consistency checks over the numeric / bounds / map parameters of a scenario and reports any issues. Checks:
NA index columns: no NA in a parameter's
dimSetsid columns. Whenfold = TRUE, NA is permitted only in the trimmable dimensions (region / timeslice / vintage, which fold encodes as wildcards); whenfold = FALSE, no NA is permitted in any id column.Schema: data columns match the declared
dimSets(plusvalue, andtypefor bounds).Duplicate keys: no duplicate id tuples.
Map vs parameter (correctness): every tuple of a value map is covered by its source parameter; a missing value would otherwise be silently replaced by the solver default.
Parameter vs map (efficiency): value parameter rows lie within the union of their maps (no orphan / out-of-domain rows). After trimming this must hold exactly.
Free meals: every object with flow variables has its governing constraints. A storage without its balance chain, or a trade corridor without its flow-capacity link, would supply the balance unbounded and solve to OPTIMAL with a meaningless objective – structural. Missing charge/discharge or availability bounds are advisory, since an open (
Inf) side deliberately produces no equation.Calendar chronology: the timeslice successor chain (the storage balance and ramping order) is derived from the calendar's timetable row order; a row order that contradicts the timetable's own timeframe columns is structural.
Usage
validate_scenario_parameters(
object,
fold = TRUE,
action = c("warn", "stop", "silent")
)Details
Structural findings always stop; action governs the advisory ones.
interpolate_model() runs this automatically (validate = TRUE, action
"warn"); call it directly to re-check a scenario or to collect the
findings table.
Examples
# \donttest{
ek <- topia$modules$electricity$R3
mod <- newModel("TOPIA", data = ek$repo,
calendar = topia$modules$calendars$s4_h24,
region = ek$regions,
horizon = topia$modules$horizons$base,
discount = 0.05)
mod <- setGeoscale(mod, ek$geoscale)
scen <- interpolate_model(mod, name = "EX")
#> Cost declared at a coarse geoscale level:
#> TBD_COA_WEST_CENTRAL@invcost: CENTRAL, WEST
#> TBD_GAS_WEST_CENTRAL@invcost: CENTRAL, WEST
#> The cost is charged ONCE at that cell rather than at each child region, and is discounted at the children's rate. That is usually what a national cost datum means -- said here because it is a different number from naming the children individually.
# no rows means every parameter's domain, bounds and defaults agree
validate_scenario_parameters(scen, action = "silent")
# }
