using IStation.Untity;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Security.Policy;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace IStation.CalcModel
|
{
|
/// <summary>
|
///
|
/// </summary>
|
internal class TimeDataBundle
|
{
|
protected IStation.CalcModel.eCalcOptType _clacOptType = CalcModel.eCalcOptType.功率;
|
public List<IStation.CalcModel.StationTimeData> TimeDatas;
|
public List<IStation.CalcModel.PumpCurveInfo> OpenPumpInfos { get; set; }//开泵角标
|
public double[,] SpanSumCacheFlow { get; set; }//缓存用:第一个元素是开始,第二元素是结束
|
public double[,] SpanSumCachePower { get; set; }//缓存用
|
public double[,] SpanSumCacheMoney { get; set; }//缓存用
|
public double[,] SpanSumCacheCompare { get; set; }//缓存用
|
|
|
public void CalcSpanCache(IStation.CalcModel.eCalcOptType clacOptType)
|
{
|
this._clacOptType = clacOptType;
|
|
int time_count = this.TimeDatas.Count;
|
SpanSumCacheFlow = new double[time_count, time_count];
|
SpanSumCachePower = new double[time_count, time_count];
|
SpanSumCacheMoney = new double[time_count, time_count];
|
|
for (int j = 0; j < time_count; j++)
|
{
|
for (int k = 0; k < time_count; k++)
|
{
|
SpanSumCacheFlow[j, k] = SpanSumCachePower[j, k] = SpanSumCacheMoney[j, k] = 0;//负数表示
|
}
|
}
|
for (int startIndx = 0; startIndx < time_count; startIndx++)
|
{
|
double flow = TimeDatas[startIndx].SumFlow;
|
double power = TimeDatas[startIndx].SumPower;
|
double money = TimeDatas[startIndx].SumMoney;
|
|
bool isLimitRange = false;
|
for (int endIndx = startIndx+1; endIndx < time_count; endIndx++)
|
{
|
if(isLimitRange == false)
|
{//只要中间出现,整个区域都不许
|
isLimitRange = TimeDatas[endIndx].SumPower == double.MaxValue ? true : false;
|
}
|
if(isLimitRange)
|
{
|
SpanSumCacheFlow[startIndx, endIndx] = flow;
|
SpanSumCachePower[startIndx, endIndx] = double.MaxValue;
|
SpanSumCacheMoney[startIndx, endIndx] = double.MaxValue;
|
}
|
else
|
{
|
flow += TimeDatas[endIndx].SumFlow;
|
SpanSumCacheFlow[startIndx, endIndx] = flow;
|
|
|
power += TimeDatas[endIndx].SumPower;
|
money += TimeDatas[endIndx].SumMoney;
|
SpanSumCachePower[startIndx, endIndx] = power;
|
SpanSumCacheMoney[startIndx, endIndx] = money;
|
}
|
}
|
|
}
|
|
if (clacOptType == CalcModel.eCalcOptType.功率)
|
{
|
SpanSumCacheCompare = SpanSumCachePower;
|
}
|
else
|
{
|
SpanSumCacheCompare = SpanSumCacheMoney;
|
}
|
}
|
|
public bool GetRangeData1(int startIndx, int endIndx, out double flow, out double compare)
|
{
|
flow = 0;
|
compare = 0;
|
|
if (endIndx == 0)
|
return false;
|
if (endIndx <= startIndx)
|
return false;
|
flow = SpanSumCacheFlow[startIndx, endIndx - 1];
|
compare = SpanSumCacheCompare[startIndx, endIndx - 1];
|
|
//if (flow > -0.1) return true;
|
//for (int i = startIndx; i < endIndx; i++)
|
//{
|
// flow += TimeDatas[i].SumFlow;
|
// compare += TimeDatas[i].SumCompare;
|
//}
|
//SpanSumCacheFlow[startIndx, endIndx - 1] = flow;
|
//SpanSumCacheCompare[startIndx, endIndx - 1] = compare;
|
|
return true;
|
}
|
|
public bool GetRangeDataStart1(int startIndx, out double flow, out double compare)
|
{
|
flow = 0;
|
compare = 0;
|
int time_count = this.TimeDatas.Count;
|
|
|
flow = SpanSumCacheFlow[startIndx, time_count - 1];
|
compare = SpanSumCacheCompare[startIndx, time_count - 1];
|
|
//if (flow > -0.1) return true;
|
//for (int i = startIndx; i < endIndx; i++)
|
//{
|
// flow += TimeDatas[i].SumFlow;
|
// compare += TimeDatas[i].SumCompare;
|
//}
|
//SpanSumCacheFlow[startIndx, endIndx - 1] = flow;
|
//SpanSumCacheCompare[startIndx, endIndx - 1] = compare;
|
|
return true;
|
}
|
|
public bool GetRangeData2(int startIndx, int endIndx, out double flow, out double power, out double money)
|
{
|
flow = 0;
|
power = 0;
|
money = 0;
|
|
if (endIndx == 0)
|
return false;
|
if (endIndx <= startIndx)
|
return false;
|
flow = SpanSumCacheFlow[startIndx, endIndx - 1];
|
power = SpanSumCachePower[startIndx, endIndx - 1];
|
money = SpanSumCacheMoney[startIndx, endIndx - 1];
|
//if (flow > -0.1) return true;
|
|
|
//for (int i = startIndx; i < endIndx; i++)
|
//{
|
// flow += TimeDatas[i].SumFlow;
|
// power += TimeDatas[i].SumPower;
|
// money += TimeDatas[i].SumMoney;
|
//}
|
//SpanSumCacheFlow[startIndx, endIndx - 1] = flow;
|
//SpanSumCachePower[startIndx, endIndx - 1] = power;
|
//SpanSumCacheMoney[startIndx, endIndx - 1] = money;
|
|
return true;
|
}
|
}
|
}
|