BO4E.Extensions/BusinessObjects/Energiemenge/EnergiemengeExtension.cs
/// <summary>
///     Get ratio of overlap between given Energiemenge and a reference.
///     Method is basically just another name for <see cref="GetOverlapFactor"/>
/// </summary>
/// <param name="em">Energiemenge</param>
/// <param name="reference">reference time range</param>
/// <param name="obisKz">OBIS</param>
/// <param name="mengeneinheit">unit of measurement</param>
/// <param name="wev">type of measurement</param>
/// <param name="decimalRounding">post decimals</param>
/// <returns>value between 0 (no overlap) and 1.0 (100% overlap)</returns>
Get ratio of overlap between given Energiemenge and a reference.
Method is basically just another name for
Get ratio of overlap between given Energiemenge and a reference . Method is basically just another name for
public static decimal GetCoverage(this BO.Energiemenge em, ITimeRange reference,
            Wertermittlungsverfahren? wev, string obisKz, Mengeneinheit mengeneinheit, int decimalRounding = 10)
        {
            decimal exactResult;
            using (MiniProfiler.Current.Step(
                $"calculating coverage for list with {em.Energieverbrauch.Count} entries."))
            {
                exactResult = em.Energieverbrauch
                    .Where(v => v.Einheit == mengeneinheit && v.Obiskennzahl == obisKz &&
                                v.Wertermittlungsverfahren == wev)
                    .Sum(v => GetOverlapFactor(new TimeRange((v.Startdatum ?? DateTimeOffset.MinValue).DateTime, (v.Enddatum ?? DateTimeOffset.MinValue).DateTime), reference, true));
            }
            return Math.Round(exactResult, decimalRounding);
        }
public static decimal GetCoverage ( this BO . Energiemenge em , ITimeRange reference , Wertermittlungsverfahren ? wev , string obisKz , Mengeneinheit mengeneinheit , int decimalRounding = 10 ) { decimal exactResult ; using ( MiniProfiler . Current . Step ( $" calculating coverage for list with  { em . Energieverbrauch . Count }  entries. " ) ) { exactResult = em . Energieverbrauch . Where ( v => v . Einheit == mengeneinheit && v . Obiskennzahl == obisKz && v . Wertermittlungsverfahren == wev ) . Sum ( v => GetOverlapFactor ( new TimeRange ( ( v . Startdatum ?? DateTimeOffset . MinValue ) . DateTime , ( v . Enddatum ?? DateTimeOffset . MinValue ) . DateTime ) , reference , true ) ) ; } return Math . Round ( exactResult , decimalRounding ) ; }
Get ratio of overlap between given Energiemenge and a reference.
Get ratio of overlap between given Energiemenge and a reference .
value between 0 (no overlap) and 1.0 (100% overlap)
value between 0 ( no overlap ) and 1 . 0 ( 100% overlap )
BO.Energiemenge
this
reference
ITimeRange
reference time range
reference time range
wev
Wertermittlungsverfahren?
type of measurement
type of measurement
obisKz
string
None
mengeneinheit
Mengeneinheit
unit of measurement
unit of measurement
decimalRounding
int
None
em
None