示例#1
0
        /// <summary>
        /// 根据车辆编号获取 当前数据流
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <returns></returns>
        public OBDCurrentDataStreamVM GetOBDCurrentDataStreamValueByVehicleCode(string vehicleCode)
        {

            OBDCurrentDataStreamVM vm = new OBDCurrentDataStreamVM();
            var rep = DMRepository.Get<EOBDDataStream>();
            var dataStream = rep.Get(p => p.VehicleCode == vehicleCode);
            var gpsCurrentInfo = rep.Get<EGPSCurrentInfo>(p => p.VehicleCode.ToString() == vehicleCode);
            if (dataStream != null)
            {
                vm.CurrentEngineCoolantTemperature = string.Format("{0}", Math.Round(dataStream.CurrentEngineCoolantTemperature, 2));
                vm.CurrentEngineRotateSpeed = string.Format("{0}", Math.Round(dataStream.CurrentEngineRotateSpeed, 0));
                vm.CurrentSpeed = string.Format("{0}", Math.Round(dataStream.CurrentSpeed, 2));
                vm.CurrentIntakeAirTemperature = string.Format("{0}", Math.Round(dataStream.CurrentIntakeAirTemperature, 2));

                vm.CurrentLoadValue = string.Format("{0}", Math.Round(dataStream.CurrentLoadValue, 2));
                vm.CurrentAirFlow = string.Format("{0}", Math.Round(dataStream.CurrentAirFlow, 2));
                vm.CurrentThrottleAbsolutePosition = string.Format("{0}", Math.Round(dataStream.CurrentThrottleAbsolutePosition, 2));
                vm.CurrentEnvironmentTemperature = string.Format("{0}", Math.Round(dataStream.CurrentEnvironmentTemperature, 2));
                vm.CurrentLongTermFuelCorrection = string.Format("{0}", Math.Round(dataStream.CurrentLongTermFuelCorrection, 2));
                vm.CurrentCylinder1IgnitionAdvanceAngle = string.Format("{0}", Math.Round(dataStream.CurrentCylinder1IgnitionAdvanceAngle, 2));
                vm.CurrentManifoldAbsolutePressure = string.Format("{0}", Math.Round(dataStream.CurrentManifoldAbsolutePressure, 2));
                vm.CurrentInstantFuelConsumption = string.Format("{0}", Math.Round(dataStream.CurrentInstantFuelConsumption, 2));

            }
            else
            {
                vm.CurrentEngineCoolantTemperature = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentEngineRotateSpeed = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentSpeed = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentIntakeAirTemperature = string.Format("{0}", Math.Round(0.00, 2));

                vm.CurrentLoadValue = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentAirFlow = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentThrottleAbsolutePosition = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentEnvironmentTemperature = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentLongTermFuelCorrection = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentCylinder1IgnitionAdvanceAngle = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentManifoldAbsolutePressure = string.Format("{0}", Math.Round(0.00, 2));
                vm.CurrentInstantFuelConsumption = string.Format("{0}", Math.Round(0.00, 2));


            }

            if (gpsCurrentInfo != null)
            {
                vm.CurrentBatteryVoltage = string.Format("{0}", Math.Round(gpsCurrentInfo.BatteryVoltage, 2));
            }
            else
            {
                vm.CurrentBatteryVoltage = string.Format("{0}", Math.Round(0.00, 2));
            }
            return vm;
        }
示例#2
0
        /// <summary>
        /// 根据车辆编号获取 当前数据流
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <returns></returns>
        public OBDCurrentDataStreamVM GetOBDCurrentDataStreamDashboardByVehicleCode(string vehicleCode)
        {

            OBDCurrentDataStreamVM vm = new OBDCurrentDataStreamVM();
            var rep = DMRepository.Get<EOBDDataStream>();
            var dataStream = rep.Get(p => p.VehicleCode == vehicleCode);
            var gpsCurrentInfo = rep.Get<EGPSCurrentInfo>(p => p.VehicleCode.ToString() == vehicleCode);
            if (dataStream != null)
            {
                vm.CurrentEngineCoolantTemperature = string.Format("{0}", Math.Round(dataStream.CurrentEngineCoolantTemperature, 2));
                vm.CurrentEngineRotateSpeed = string.Format("{0}", Math.Round(dataStream.CurrentEngineRotateSpeed, 0));
                vm.CurrentSpeed = string.Format("{0}", Math.Round(dataStream.CurrentSpeed, 2));
                vm.CurrentIntakeAirTemperature = string.Format("<span class=\"c-oraner\">{0}℃</span><br /><span class=\"tit-numerical\">当前进气温度</span>", Math.Round(dataStream.CurrentIntakeAirTemperature, 2));

                vm.CurrentLoadValue = string.Format("<span class=\"c-oraner\">{0} %</span><br /><span class=\"tit-numerical\">负荷计算值</span>", Math.Round(dataStream.CurrentLoadValue, 2));
                vm.CurrentAirFlow = string.Format("<span class=\"c-oraner\">{0} g/s</span><br /><span class=\"tit-numerical\">空气流量</span>", Math.Round(dataStream.CurrentAirFlow, 2));
                vm.CurrentThrottleAbsolutePosition = string.Format("<span class=\"c-oraner\">{0} %</span><br /><span class=\"tit-numerical\">节气门绝对位置</span>", Math.Round(dataStream.CurrentThrottleAbsolutePosition, 2));
                vm.CurrentEnvironmentTemperature = string.Format("<span class=\"c-oraner\">{0} ℃</span><br /><span class=\"tit-numerical\">环境温度</span>", Math.Round(dataStream.CurrentEnvironmentTemperature, 2));
                vm.CurrentLongTermFuelCorrection = string.Format("<span class=\"c-oraner\">{0}</span><br /><span class=\"tit-numerical\">长期燃油修正</span>", Math.Round(dataStream.CurrentLongTermFuelCorrection, 2));
                vm.CurrentCylinder1IgnitionAdvanceAngle = string.Format("<span class=\"c-oraner\">{0} °</span><br /><span class=\"tit-numerical\">气缸1点火提前角</span>", Math.Round(dataStream.CurrentCylinder1IgnitionAdvanceAngle, 2));
                vm.CurrentManifoldAbsolutePressure = string.Format("<span class=\"c-oraner\">{0} kPa</span><br /><span class=\"tit-numerical\">进气歧管绝对压力</span>", Math.Round(dataStream.CurrentManifoldAbsolutePressure, 2));
                vm.CurrentInstantFuelConsumption = string.Format("<span class=\"c-oraner\">{0} ml</span><br /><span class=\"tit-numerical\">即时油耗</span>", Math.Round(dataStream.CurrentInstantFuelConsumption, 2));

            }
            else
            {
                vm.CurrentEngineCoolantTemperature = string.Format("{0}", 0.00);
                vm.CurrentEngineRotateSpeed = string.Format("{0}", 0.00);
                vm.CurrentSpeed = string.Format("{0}", 0.00);
                vm.CurrentIntakeAirTemperature = string.Format("<span class=\"c-oraner\">{0}℃</span><br /><span class=\"tit-numerical\">当前进气温度</span>", 0.00);

                vm.CurrentLoadValue = string.Format("<span class=\"c-oraner\">{0} %</span><br /><span class=\"tit-numerical\">负荷计算值</span>", 0.00);
                vm.CurrentAirFlow = string.Format("<span class=\"c-oraner\">{0} g/s</span><br /><span class=\"tit-numerical\">空气流量</span>", 0.00);
                vm.CurrentThrottleAbsolutePosition = string.Format("<span class=\"c-oraner\">{0} %</span><br /><span class=\"tit-numerical\">节气门绝对位置</span>", 0.00);
                vm.CurrentEnvironmentTemperature = string.Format("<span class=\"c-oraner\">{0} ℃</span><br /><span class=\"tit-numerical\">环境温度</span>", 0.00);
                vm.CurrentLongTermFuelCorrection = string.Format("<span class=\"c-oraner\">{0}</span><br /><span class=\"tit-numerical\">长期燃油修正</span>", 0.00);
                vm.CurrentCylinder1IgnitionAdvanceAngle = string.Format("<span class=\"c-oraner\">{0} °</span><br /><span class=\"tit-numerical\">气缸1点火提前角</span>", 0.00);
                vm.CurrentManifoldAbsolutePressure = string.Format("<span class=\"c-oraner\">{0} kPa</span><br /><span class=\"tit-numerical\">进气歧管绝对压力</span>", 0.00);
                vm.CurrentInstantFuelConsumption = string.Format("<span class=\"c-oraner\">{0} ml</span><br /><span class=\"tit-numerical\">即时油耗</span>", 0.00);


            }

            if (gpsCurrentInfo != null)
            {
                vm.CurrentBatteryVoltage = string.Format("{0}", Math.Round(gpsCurrentInfo.BatteryVoltage, 2));
            }
            else
            {
                vm.CurrentBatteryVoltage = string.Format("{0}", Math.Round(0.00, 2));
            }
            return vm;
        }
示例#3
0
        /// <summary>
        /// 根据车辆编号获取 当前数据流
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <returns></returns>
        public OBDCurrentDataStreamVM GetOBDCurrentDataStreamByVehicleCode(string vehicleCode)
        {
            
            OBDCurrentDataStreamVM vm = new OBDCurrentDataStreamVM();
            var rep = DMRepository.Get<EOBDDataStream>();
            var dataStream = rep.Get(p => p.VehicleCode == vehicleCode);
            var gpsCurrentInfo = rep.Get<EGPSCurrentInfo>(p => p.VehicleCode.ToString() == vehicleCode);
            if (dataStream != null)
            {
                vm.CurrentEngineCoolantTemperature = string.Format("<span class=\"td-r\">冷却液温度:</span><span class=\"c-rel\">{0}</span> ℃", Math.Round(dataStream.CurrentEngineCoolantTemperature, 2));
                vm.CurrentEngineRotateSpeed = string.Format("<span class=\"td-r\">发动机转速:</span><span class=\"c-rel\">{0}</span> r/min", Math.Round(dataStream.CurrentEngineRotateSpeed, 0));
                vm.CurrentSpeed = string.Format("当前车速:<span class=\"c-rel\">{0}</span > km/h", Math.Round(dataStream.CurrentSpeed, 2));
                vm.CurrentIntakeAirTemperature = string.Format("当前进气温度:<span class=\"c-rel\">{0}</span> ℃", Math.Round(dataStream.CurrentIntakeAirTemperature, 2));

                vm.CurrentLoadValue = string.Format("负荷计算值:<span class=\"c-rel\">{0}</span> %", Math.Round(dataStream.CurrentLoadValue, 2));
                vm.CurrentAirFlow = string.Format("空气流量:<span class=\"c-rel\">{0}</span> g/s", Math.Round(dataStream.CurrentAirFlow, 2));
                vm.CurrentThrottleAbsolutePosition = string.Format("节气门绝对位置:<span class=\"c-rel\">{0}</span> %", Math.Round(dataStream.CurrentThrottleAbsolutePosition, 2));
                vm.CurrentEnvironmentTemperature = string.Format("环境温度:<span class=\"c-rel\">{0}</span> ℃", Math.Round(dataStream.CurrentEnvironmentTemperature, 2));
                vm.CurrentLongTermFuelCorrection = string.Format("长期燃油修正:<span class=\"c-rel\">{0}</span> ", Math.Round(dataStream.CurrentLongTermFuelCorrection, 2));
                vm.CurrentCylinder1IgnitionAdvanceAngle = string.Format("气缸1点火提前角:<span class=\"c-rel\">{0}</span> °", Math.Round(dataStream.CurrentCylinder1IgnitionAdvanceAngle, 2));
                vm.CurrentManifoldAbsolutePressure = string.Format("进气歧管绝对压力:<span class=\"c-rel\">{0}</span> kPa", Math.Round(dataStream.CurrentManifoldAbsolutePressure, 2));
                vm.CurrentInstantFuelConsumption = string.Format("即时油耗:<span class=\"c-rel\">{0}</span> ml", Math.Round(dataStream.CurrentInstantFuelConsumption, 2));
            
            }
            else 
            {
                vm.CurrentEngineCoolantTemperature = string.Format("<span class=\"td-r\">冷却液温度:</span><span class=\"c-rel EngineCoolantTemperature\">{0}</span> ℃", Math.Round(0.00, 2));
                vm.CurrentEngineRotateSpeed = string.Format("<span class=\"td-r\">发动机转速:</span><span class=\"c-rel EngineRotateSpeed\">{0}</span> r/min", Math.Round(0.00, 2));
                vm.CurrentSpeed = string.Format("当前车速:<span class=\"c-rel CurrentSpeed\">{0}</span > km/h", Math.Round(0.00, 2));
                vm.CurrentIntakeAirTemperature = string.Format("当前进气温度:<span class=\"c-rel IntakeAirTemperature\">{0}</span> ℃", Math.Round(0.00, 2));

                vm.CurrentLoadValue = string.Format("负荷计算值:<span class=\"c-rel\">{0}</span> %", Math.Round(0.00, 2));
                vm.CurrentAirFlow = string.Format("空气流量:<span class=\"c-rel\">{0}</span> g/s", Math.Round(0.00, 2));
                vm.CurrentThrottleAbsolutePosition = string.Format("节气门绝对位置:<span class=\"c-rel\">{0}</span> %", Math.Round(0.00, 2));
                vm.CurrentEnvironmentTemperature = string.Format("环境温度:<span class=\"c-rel\">{0}</span> ℃", Math.Round(0.00, 2));
                vm.CurrentLongTermFuelCorrection = string.Format("长期燃油修正:<span class=\"c-rel\">{0}</span> ", Math.Round(0.00, 2));
                vm.CurrentCylinder1IgnitionAdvanceAngle = string.Format("气缸1点火提前角:<span class=\"c-rel\">{0}</span> °", Math.Round(0.00, 2));
                vm.CurrentManifoldAbsolutePressure = string.Format("进气歧管绝对压力:<span class=\"c-rel\">{0}</span> kPa", Math.Round(0.00, 2));
                vm.CurrentInstantFuelConsumption = string.Format("即时油耗:<span class=\"c-rel\">{0}</span> ml", Math.Round(0.00, 2));
            
            
            }

            if (gpsCurrentInfo != null)
            {
                vm.CurrentBatteryVoltage = string.Format("电瓶电压:<span class=\"c-rel BatteryVoltage\">{0}</span> v", Math.Round(gpsCurrentInfo.BatteryVoltage, 2));
            }
            else
            {
                vm.CurrentBatteryVoltage = string.Format("电瓶电压:<span class=\"c-rel BatteryVoltage\">{0}</span> v", Math.Round(0.00, 2));
            }
            return vm;
        }