Skip to content

check_resource and check_resources hooks #107

Description

@espenbodal

Problem. The checks cover nodes, links, their data and the model type, but there is no hook for checking resources themselves or the combination of an element with the resources it carries. A package introducing resources with parameters (voltage limits, numbers of linearisation segments) and with requirements on the elements carrying them (at most one such resource per node, impedance data matching the formulation on a transmission mode) can only check these through a package-level function the user has to call, because a method of check_node for RefSink would be type piracy.

Proposal. Two functions with empty defaults, called from the existing check loops:

# called from check_elements for every element and every resource family it carries
check_resource(x::AbstractElement, 𝒫ˢᵘᵇ::Vector{<:Resource}, 𝒯, modeltype, check_timeprofiles) = nothing
# called from check_data for every resource family of the case products, logged as "Resources"
check_resources(𝒫ˢᵘᵇ::Vector{<:Resource}, 𝒯, modeltype, check_timeprofiles) = nothing

The logs of check_resource are attached to the element, those of check_resources to a new entry "Resources" in the consistency log. EnergyModelsGeography would call check_resource for areas and transmission modes in its check_elements methods as well.

Why non-breaking. Both defaults return nothing; the check loops gain one call each.

Tests. A test resource with a check_resources method that logs on a wrong parameter and a check_resource method that logs for a sink carrying it; the messages appear under the element and under "Resources".

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions