public async Task <DataPoints <DateTime, double> > GetDailyCostGraphData() { Procedures proc = new Procedures(_db, _config); var ret = await proc.SummaryPeriodCostsAsync(Procedures.Period.Daily); var outV = new DataPoints <DateTime, double>(); var dummyHours = new List <DateTime>(); for (int i = 0; i < 24; i++) { DateTime tempTime = DateTime.Now; DateTime returnV = new DateTime(tempTime.Year, tempTime.Month, tempTime.Day, i, 0, 0); for (int j = 0; j < ret.Count(); j++) { if (ret.ElementAt(j).dataPoints.Count < 1) { continue; } var dateValue = ret.ElementAt(j).getvalueT(); var reading = ret.ElementAt(j).getValueY(); if (dateValue.ElementAt(0).Hour == returnV.Hour) { outV.AddPoint(dateValue.ElementAt(0), reading.ElementAt(0)); } else { outV.AddPoint(dateValue.ElementAt(0), 0); } } } return(outV); }
private DataPoints <DateTime, double> GetTestExpectedSummer() { //Build data var list = new DataPoints <DateTime, double>(); list.AddPoint((Convert.ToDateTime("2/12/2019 12:04:00 PM")), 2.0); list.AddPoint((Convert.ToDateTime("1/1/2019 12:10:15 PM")), 20.0); return(list); }
public DataPoints <DateTime, double> GetTestExpectedSummaryDaily() { //Build data DataPoints <DateTime, double> list = new DataPoints <DateTime, double>(); list.AddPoint((Convert.ToDateTime("1/1/2019 12:04:00 PM")), 12.0); list.AddPoint((Convert.ToDateTime("1/1/2019 13:10:15 PM")), 16.0); list.AddPoint((Convert.ToDateTime("1/1/2019 14:05:15 PM")), 4.0); return(list); }
private DataPoints <String, double> GetTestExpectedSummarySummerCost() { //Build data DataPoints <String, double> list = new DataPoints <String, double>(); list.AddPoint("Summer", 1184.0); list.AddPoint("Winter", 0.0); list.AddPoint("Spring", 0.0); list.AddPoint("Autum", 0.0); return(list); }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { receivingUdpClient.Close(); Debug.Log("Packet queue watcher stopped by user"); } else if (Input.GetKeyDown(KeyCode.N)) { NewCapture(); } if (listener.IsAlive || packetQueue.Count > 0) { ForzaPacket packet; if (packetQueue.TryDequeue(out packet)) { DataPoint newPoint = DataPoints.AddPoint(packet); int lapNum = trackInfo.CheckNewLap(DataPoints.GetLatestPacketIndex()); newPoint.GetPacket().LapNum = (uint)lapNum; visualizations.DrawTrail(newPoint, lapNum); uiVisualizations.DrawUI(packet); } } }
public DataPoints <DateTime, double> GetTestExpectedMonthly() { //Build data var list = new DataPoints <DateTime, double>(); list.AddPoint((Convert.ToDateTime("1/1/2019 12:04:00 PM")), 8.0); list.AddPoint((Convert.ToDateTime("2/1/2019 13:10:15 PM")), 10.0); list.AddPoint((Convert.ToDateTime("3/1/2019 14:05:15 PM")), 4.0); list.AddPoint((Convert.ToDateTime("2000/4/1")), 0.0); list.AddPoint((Convert.ToDateTime("2000/5/1")), 0.0); list.AddPoint((Convert.ToDateTime("2000/6/1")), 0.0); list.AddPoint((Convert.ToDateTime("2000/7/1")), 0.0); list.AddPoint((Convert.ToDateTime("2000/8/1")), 0.0); list.AddPoint((Convert.ToDateTime("2000/9/1")), 0.0); list.AddPoint((Convert.ToDateTime("2000/10/1")), 0.0); list.AddPoint((Convert.ToDateTime("2000/11/1")), 0.0); list.AddPoint((Convert.ToDateTime("2000/12/1")), 0.0); return(list); }
public void LoadCSV() { receivingUdpClient.Close(); string path = FileBrowser.OpenSingleFile("Open CSV", lastSavePath, "csv"); if (path != "") { Debug.Log("Reading packet info from " + path); visualizations.ResetVisualizations(); uiVisualizations.ResetUIVisualizations(); using (StreamReader reader = new StreamReader(path)) { while (!reader.EndOfStream) { string line = reader.ReadLine(); string[] values = line.Split(','); ForzaPacket p = new ForzaPacket { IsRaceOn = int.Parse(values[0]), TimestampMS = uint.Parse(values[1]), EngineMaxRpm = float.Parse(values[2]), EngineIdleRpm = float.Parse(values[3]), CurrentEngineRpm = float.Parse(values[4]), AccelerationX = float.Parse(values[5]), AccelerationY = float.Parse(values[6]), AccelerationZ = float.Parse(values[7]), VelocityX = float.Parse(values[8]), VelocityY = float.Parse(values[9]), VelocityZ = float.Parse(values[10]), AngularVelocityX = float.Parse(values[11]), AngularVelocityY = float.Parse(values[12]), AngularVelocityZ = float.Parse(values[13]), Yaw = float.Parse(values[14]), Pitch = float.Parse(values[15]), Roll = float.Parse(values[16]), NormalizedSuspensionTravelFrontLeft = float.Parse(values[17]), NormalizedSuspensionTravelFrontRight = float.Parse(values[18]), NormalizedSuspensionTravelRearLeft = float.Parse(values[19]), NormalizedSuspensionTravelRearRight = float.Parse(values[20]), TireSlipRatioFrontLeft = float.Parse(values[21]), TireSlipRatioFrontRight = float.Parse(values[22]), TireSlipRatioRearLeft = float.Parse(values[23]), TireSlipRatioRearRight = float.Parse(values[24]), WheelRotationSpeedFrontLeft = float.Parse(values[25]), WheelRotationSpeedFrontRight = float.Parse(values[26]), WheelRotationSpeedRearLeft = float.Parse(values[27]), WheelRotationSpeedRearRight = float.Parse(values[28]), WheelOnRumbleStripFrontLeft = int.Parse(values[29]), WheelOnRumbleStripFrontRight = int.Parse(values[30]), WheelOnRumbleStripRearLeft = int.Parse(values[31]), WheelOnRumbleStripRearRight = int.Parse(values[32]), WheelInPuddleDepthFrontLeft = float.Parse(values[33]), WheelInPuddleDepthFrontRight = float.Parse(values[34]), WheelInPuddleDepthRearLeft = float.Parse(values[35]), WheelInPuddleDepthRearRight = float.Parse(values[36]), SurfaceRumbleFrontLeft = float.Parse(values[37]), SurfaceRumbleFrontRight = float.Parse(values[38]), SurfaceRumbleRearLeft = float.Parse(values[39]), SurfaceRumbleRearRight = float.Parse(values[40]), TireSlipAngleFrontLeft = float.Parse(values[41]), TireSlipAngleFrontRight = float.Parse(values[42]), TireSlipAngleRearLeft = float.Parse(values[43]), TireSlipAngleRearRight = float.Parse(values[44]), TireCombinedSlipFrontLeft = float.Parse(values[45]), TireCombinedSlipFrontRight = float.Parse(values[46]), TireCombinedSlipRearLeft = float.Parse(values[47]), TireCombinedSlipRearRight = float.Parse(values[48]), SuspensionTravelMetersFrontLeft = float.Parse(values[49]), SuspensionTravelMetersFrontRight = float.Parse(values[50]), SuspensionTravelMetersRearLeft = float.Parse(values[51]), SuspensionTravelMetersRearRight = float.Parse(values[52]), CarOrdinal = int.Parse(values[53]), CarClass = int.Parse(values[54]), CarPerformanceIndex = int.Parse(values[55]), DrivetrainType = int.Parse(values[56]), NumCylinders = int.Parse(values[57]) }; if (p.TimestampMS == lastTimestamp) { Debug.Log("Same packet received, dropping."); continue; } else { lastTimestamp = p.TimestampMS; } DataPoint datapoint = DataPoints.AddPoint(p); int lapNum = trackInfo.CheckNewLap(DataPoints.GetLatestPacketIndex()); p.LapNum = (uint)lapNum; visualizations.DrawTrail(datapoint, lapNum, true); } reader.Close(); Debug.Log("Read complete"); } MainCamera mainCamera = Camera.main.GetComponent <MainCamera>(); mainCamera.GoToPoint(0); } }