BO4E.Extensions/BusinessObjects/Energiemenge/EnergiemengeExtension.cs
/// <summary>
///     Returns the consumption of a given kind of Mengeneinheit within the specified reference time range.
/// </summary>
/// <param name="em">Energiemenge</param>
/// <param name="reference">reference time frame</param>
/// <param name="wev">Wertermittlungsverfahren</param>
/// <param name="obiskennzahl">OBIS number</param>
/// <param name="me">an extensive unit (e.g. "kWh")</param>
/// <returns>
///     the consumption within the give time slice <paramref name="reference" /> in the unit passed as
///     <paramref name="me" />
/// </returns>
Returns the consumption of a given kind of Mengeneinheit within the specified reference time range.
Returns the consumption of a given kind of Mengeneinheit within the specified reference time range .
public static decimal GetConsumption(this BO.Energiemenge em, ITimeRange reference,
            Wertermittlungsverfahren? wev, string obiskennzahl, Mengeneinheit me)
        {
            if (!me.IsExtensive())
                throw new ArgumentException(
                    $"The Mengeneinheit {me} isn't extensive. Calculating a consumption doesn't make sense.");
            return em.Energieverbrauch
                .Where(v => v.Wertermittlungsverfahren == wev && v.Obiskennzahl == obiskennzahl && v.Einheit == me)
                .Sum(v => GetOverlapFactor(new TimeRange((v.Startdatum ?? DateTimeOffset.MinValue).DateTime, (v.Enddatum ?? DateTimeOffset.MinValue).DateTime), reference, false) * v.Wert);
        }
public static decimal GetConsumption ( this BO . Energiemenge em , ITimeRange reference , Wertermittlungsverfahren ? wev , string obiskennzahl , Mengeneinheit me ) { if ( ! me . IsExtensive ( ) ) throw new ArgumentException ( $" The Mengeneinheit  { me }  isn't extensive. Calculating a consumption doesn't make sense. " ) ; return em . Energieverbrauch . Where ( v => v . Wertermittlungsverfahren == wev && v . Obiskennzahl == obiskennzahl && v . Einheit == me ) . Sum ( v => GetOverlapFactor ( new TimeRange ( ( v . Startdatum ?? DateTimeOffset . MinValue ) . DateTime , ( v . Enddatum ?? DateTimeOffset . MinValue ) . DateTime ) , reference , false ) * v . Wert ) ; }
Returns the consumption of a given kind of Mengeneinheit within the specified reference time range.
Returns the consumption of a given kind of Mengeneinheit within the specified reference time range .
the consumption within the give time slice  in the unit passed as
the consumption within the give time slice in the unit passed as
BO.Energiemenge
this
<not_specific>
reference
ITimeRange
reference time frame
reference time frame
wev
Wertermittlungsverfahren?
None
obiskennzahl
string
None
me
Mengeneinheit
an extensive unit
an extensive unit
em
<not_specific>
None