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".
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_nodeforRefSinkwould be type piracy.Proposal. Two functions with empty defaults, called from the existing check loops:
The logs of
check_resourceare attached to the element, those ofcheck_resourcesto a new entry "Resources" in the consistency log. EnergyModelsGeography would callcheck_resourcefor areas and transmission modes in itscheck_elementsmethods as well.Why non-breaking. Both defaults return
nothing; the check loops gain one call each.Tests. A test resource with a
check_resourcesmethod that logs on a wrong parameter and acheck_resourcemethod that logs for a sink carrying it; the messages appear under the element and under "Resources".