From 82c91b3d9133d788c3161e3749be91b93cb3481e Mon Sep 17 00:00:00 2001 From: sstroemer Date: Fri, 10 Jan 2025 11:17:30 +0100 Subject: [PATCH] chore: new docstrings in Utilities module --- src/utils/modules/Utilities.jl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/utils/modules/Utilities.jl b/src/utils/modules/Utilities.jl index 1c6d4bd..568e1c0 100644 --- a/src/utils/modules/Utilities.jl +++ b/src/utils/modules/Utilities.jl @@ -72,10 +72,37 @@ function annuity(total::Real, lifetime::Real, rate::Real, fraction::Real) @critical msg reason example end +""" + timespan(model::JuMP.Model)::Float64 + +Calculate the total timespan (duration, time period, ...) of a model in hours. + +# Arguments + +- `model::JuMP.Model`: The model for which the timespan is to be calculated. + +# Returns + +`Float64`: The total timespan of the model in hours. +""" function timespan(model::JuMP.Model)::Float64 return sum(s.weight for s in values(IESopt._iesopt_model(model).snapshots)) end +""" + yearspan(model::JuMP.Model)::Float64 + +Calculate the total timespan (duration, time period, ...) of a model in years. This assumes that a full year has a total +of 8760 hours. + +# Arguments + +- `model::JuMP.Model`: The model for which the timespan is to be calculated. + +# Returns + +`Float64`: The total timespan of the model in years. +""" function yearspan(model::JuMP.Model)::Float64 return timespan(model) / 8760.0 end