Miscellaneous types/functions/macros
Index
EnergyModelsBase
EnergyModelsBase.CyclicPeriods
EnergyModelsBase.NothingPeriod
EnergyModelsBase.PreviousPeriods
EnergyModelsBase.current_per
EnergyModelsBase.last_per
EnergyModelsBase.op_per
EnergyModelsBase.rep_per
EnergyModelsBase.strat_per
EnergyModelsBase.@assert_or_log
Module
EnergyModelsBase
— ModuleMain module for EnergyModelsBase
a framework for building flexible energy system models.
It exports several types and associated functions for accessing fields. In addition, all required functions for creaeting and running the model are exported.
You can find the exported types and functions below or on the pages Constraint functions and Data functions.
PreviousPeriods
and CyclicPeriods
PreviousPeriods
is a type used to store information from the previous periods in an iteration loop through the application of the iterator withprev
of TimeStruct
.
CyclicPeriods
is used for storing the current and the last period. The periods can either be AbstractStrategicPeriod
or AbstractRepresentativePeriod
. In the former case, it is however not fully used as the last strategic period is not relevant for the level balances.
Both composite types allow only EMB.NothingPeriod
types as input to the individual fields.
EnergyModelsBase.PreviousPeriods
— TypePreviousPeriods{S<:NothingPeriod, T<:NothingPeriod, U<:NothingPeriod}
Contains the previous strategic, representative, and operational period used through the application of the with_prev
iterator developed in TimeStruct
.
Fields
sp::S
is the previous strategic period.rp::T
is the previous representative period.op::U
is the previous operational period.
EnergyModelsBase.CyclicPeriods
— TypeCyclicPeriods{S<:NothingPeriod}
Contains information for calculating the cyclic constraints. The parameter S
should be either an AbstractStrategicPeriod
or AbstractRepresentativePeriod
.
Fields
last_per::S
is the last period in the case ofS<:AbstractRepresentativePeriod
or the current period in the case ofS<:AbstractStrategicPeriod
as the last strategic period is not relevant.current_per::S
is the current period in both the case ofS<:AbstractRepresentativePeriod
andS<:AbstractStrategicPeriod
.
EnergyModelsBase.NothingPeriod
— TypeUnion of Nothing
, TS.TimePeriod
, and TS.TimeStructure{T} where {T}
to be used for limiting the potential entries to the fields of PreviousPeriods
and CyclicPeriods
types.
The individual fields can be accessed through the following functions:
EnergyModelsBase.strat_per
— Functionstrat_per(prev_periods::PreviousPeriods)
Extracts the previous strategic period (field sp
) from a PreviousPeriods
type.
EnergyModelsBase.rep_per
— Functionrep_per(prev_periods::PreviousPeriods)
Extracts the previous representative period (field rp
) from a PreviousPeriods
type.
EnergyModelsBase.op_per
— Functionop_per(prev_periods::PreviousPeriods)
Extracts the previous operational period (field op
) from a PreviousPeriods
type.
EnergyModelsBase.last_per
— Functionlast_per(cyclic_pers::CyclicPeriods)
Extracts the last period (field last_per
) from a CyclicPeriods
type.
EnergyModelsBase.current_per
— Functioncurrent_per(cyclic_pers::CyclicPeriods)
Extracts the current period (field current_per
) from a CyclicPeriods
type.
Macros for checking the input data
The macro @assert_or_log
is an extension to the @assert
macro to allow either for asserting the input data directly, or logging the errors in the input data.
EnergyModelsBase.@assert_or_log
— Macroassert_or_log(ex, msg)
Macro that extends the behaviour of the @assert
macro. The switch ASSERTS_AS_LOG
, controls if the macro should act as a logger or a normal @assert
. This macro is designed to be used to check whether the data provided is consistent.