forked from ddrilling/AsbCloudServer
исправление класса интерполяции
This commit is contained in:
parent
b487f01fae
commit
37e29e003c
@ -8,7 +8,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems.Utils
|
||||
internal class Interpolation
|
||||
{
|
||||
private IEnumerator<(DateTimeOffset dateMin, float? depthMin, DateTimeOffset dateMax, float? depthMax)> enumerator;
|
||||
(DateTimeOffset dateMin, float? depthMin, DateTimeOffset dateMax, float? depthMax) lastValue = default;
|
||||
(DateTimeOffset x, float? y) lastValue = default;
|
||||
|
||||
public Interpolation(IOrderedEnumerable<(DateTimeOffset dateMin, float? depthMin, DateTimeOffset dateMax, float? depthMax)> collection)
|
||||
{
|
||||
@ -17,18 +17,19 @@ namespace AsbCloudInfrastructure.Services.Subsystems.Utils
|
||||
}
|
||||
|
||||
public float GetDepth(DateTimeOffset date)
|
||||
{
|
||||
if (lastValue.depthMin is not null &&
|
||||
lastValue.depthMax is not null)
|
||||
{
|
||||
{
|
||||
while (date > enumerator.Current.dateMax)
|
||||
while (date >= enumerator.Current.dateMax)
|
||||
{
|
||||
if (isLess(date))
|
||||
CalcValue(enumerator.Current, date.Second);
|
||||
{
|
||||
lastValue.x = date;
|
||||
lastValue.y = CalcValue(enumerator.Current, date.Second);
|
||||
}
|
||||
enumerator.MoveNext();
|
||||
}
|
||||
}
|
||||
return (float)lastValue.depthMin;
|
||||
return (float)lastValue.y;
|
||||
}
|
||||
|
||||
private bool isLess(DateTimeOffset date)
|
||||
|
@ -265,7 +265,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
||||
" max(well_depth) as max_well_depth " +
|
||||
"from " +
|
||||
" t_telemetry_data_saub " +
|
||||
"where id_telemetry = @idTelemetry and \"date\" > @begin " +
|
||||
"where id_telemetry = @idTelemetry and \"date\" >= @begin " +
|
||||
"group by ceil(well_depth * 10) " +
|
||||
"order by min_date; ";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user