Ejemplo n.º 1
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (Settings.StartEngineRpm > 0 && signalInfo.EngineRpm > Settings.StartEngineRpm && !isBrokenStartEngineRpmRule)
            {
                isBrokenStartEngineRpmRule = true;
                BreakRule(DeductionRuleCodes.RC40210);
            }
            if (signalInfo.CarState != CarState.Moving)
            {
                return;
            }

            //检测起步警报灯延时两秒
            if (startMovingCarTime != null && (DateTime.Now - startMovingCarTime.Value).TotalSeconds > 2 &&
                Settings.IsCheckStartLightOnNight && Context.ExamTimeMode == ExamTimeMode.Night &&
                !IsCautionLightSpeaked && CarSignalSet.Query(StartMovingTime).Any(d => d.Sensor.CautionLight))
            {
                IsCautionLightSpeaked = true;
                BreakRule(DeductionRuleCodes.RC41601, DeductionRuleCodes.SRC4160105);
            }

            if (IsFirstCarMoving)
            {
                if (!startMovingCarTime.HasValue)
                {
                    StartMovingTime    = DateTime.Now;
                    startMovingCarTime = DateTime.Now;
                    return;
                }

                //座椅起步开始前验证三模
                if (!CarSignalSet.Query(Context.ExamContext.StartExamTime).Any(d => d.Sensor.Seats))
                {
                    BreakRule(DeductionRuleCodes.RC40211, DeductionRuleCodes.SRC4021101);
                }
                if (!CarSignalSet.Query(Context.ExamContext.StartExamTime).Any(d => d.Sensor.ExteriorMirror))
                {
                    BreakRule(DeductionRuleCodes.RC40211, DeductionRuleCodes.SRC4021102);
                }
                if (!CarSignalSet.Query(Context.ExamContext.StartExamTime).Any(d => d.Sensor.InnerMirror))
                {
                    BreakRule(DeductionRuleCodes.RC40211, DeductionRuleCodes.SRC4021103);
                }


                IsFirstCarMoving = false;
                //起步左转向灯检查
                if (Settings.IsCheckStartLight)
                {
                    //白天只对左转向灯进行检测
                    //if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight))
                    //打了右转向灯进行评判
                    if (CarSignalSet.Query(StartTime).Count(d => d.Sensor.LeftIndicatorLight) < Constants.ErrorSignalCount || CarSignalSet.Query(StartTime).Any(d => d.Sensor.RightIndicatorLight))
                    {
                        BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020501);
                    }
                    else
                    {
                        //是否提前3秒打转向灯进行检测
                        var isTurnLight = AdvancedCarSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime,
                                                                                       Settings.TurnLightAheadOfTime);
                        if (!isTurnLight)
                        {
                            BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020601);
                        }
                    }
                }

                //夜间灯光检查
                if (Settings.IsCheckStartLightOnNight && Context.ExamTimeMode == ExamTimeMode.Night && !IsCautionLightSpeaked)
                {
                    //夜间起步灯光检测,打近光,关危险警报灯光
                    if (CarSignalSet.Query(StartTime).Count(d => d.Sensor.LowBeam) < Constants.ErrorSignalCount ||
                        CarSignalSet.Query(StartMovingTime).Any(d => d.Sensor.HighBeam))
                    {
                        IsCautionLightSpeaked = true;
                        BreakRule(DeductionRuleCodes.RC41601, DeductionRuleCodes.SRC4160105);
                    }
                }

                //夜间远近光交替
                if (Settings.StartLowAndHighBeamInNight && Context.ExamTimeMode == ExamTimeMode.Night)
                {
                    if (!AdvancedCarSignal.CheckHighBeam(StartTime, 1))
                    {
                        BreakRule(DeductionRuleCodes.RC41603);
                    }
                }
                //检测是否车门未关闭起步
                if (signalInfo.Sensor.Door)
                {
                    BreakRule(DeductionRuleCodes.RC40202);
                }
            }
            //检测手刹
            CheckHandbrake(signalInfo);
            //Logger.InfoFormat("StartEngineRpm:{0}", signalInfo.Sensor.EngineRpm);
            //Logger.InfoFormat("Settings:StartEngineRpm:{0}", Settings.StartEngineRpm);
            //检测发动机转速


            //当车辆停止的时候且向前运行一段距离后,停止检测
            if (signalInfo.CarState == CarState.Stop && (signalInfo.Distance - StartDistance) > 0)
            {
                StopCore();
            }
        }
Ejemplo n.º 2
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            ////初始化加速度
            if (!initG)
            {
                initG   = true;
                this.gx = signalInfo.AccelerationX;
                this.gy = signalInfo.AccelerationY;
                this.gz = signalInfo.AccelerationZ;
            }

            StartShockCheck(signalInfo);

            if (Settings.StartEngineRpm > 0 && signalInfo.EngineRpm > Settings.StartEngineRpm && !isBrokenStartEngineRpmRule)
            {
                isBrokenStartEngineRpmRule = true;
                BreakRule(DeductionRuleCodes.RC40210);
            }
            if (signalInfo.CarState != CarState.Moving)
            {
                return;
            }
            //检测起步//起步
            //检测起步
            //检测起步警报灯延时两秒
            if (startMovingCarTime != null && (DateTime.Now - startMovingCarTime.Value).TotalSeconds > 2 &&
                Settings.IsCheckStartLightOnNight && Context.ExamTimeMode == ExamTimeMode.Night &&
                !IsCautionLightSpeaked && CarSignalSet.Query(StartMovingTime).Any(d => d.Sensor.CautionLight))
            {
                IsCautionLightSpeaked = true;
                BreakRule(DeductionRuleCodes.RC41601, DeductionRuleCodes.SRC4160105);
            }
            //todo:始终没有档位检测是不好检测的。
            if (!IsMustGearOneSpeaked && Settings.StartIsMustGearOne && !signalInfo.Sensor.Clutch)
            {
                if (signalInfo.Sensor.Gear == Domain.Gear.Three || signalInfo.Sensor.Gear == Domain.Gear.Two || signalInfo.Sensor.Gear == Domain.Gear.Four || signalInfo.Sensor.Gear == Domain.Gear.Five)
                {
                    IsMustGearOneSpeaked = true;
                    BreakRule(DeductionRuleCodes.RC30137);
                }
            }

            if (signalInfo.Sensor.Loudspeaker)
            {
                IsLoudspeaker = true;
            }
            if (IsFirstCarMoving)
            {
                if (!startMovingCarTime.HasValue)
                {
                    StartMovingTime    = DateTime.Now;
                    startMovingCarTime = DateTime.Now;
                    return;
                }
                //这样有问题

                IsFirstCarMoving = false;
                //起步左转向灯检查
                if (Settings.IsCheckStartLight)
                {
                    //白天只对左转向灯进行检测
                    if (CarSignalSet.Query(StartTime).Count(d => d.Sensor.LeftIndicatorLight) < Constants.ErrorSignalCount)
                    {
                        BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020501);
                    }
                    else
                    {
                        //是否提前3秒打转向灯进行检测
                        var isTurnLight = AdvancedCarSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime,
                                                                                       Settings.TurnLightAheadOfTime);
                        if (!isTurnLight)
                        {
                            BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020601);
                        }
                    }
                }

                //夜间灯光检查
                if (Settings.IsCheckStartLightOnNight && Context.ExamTimeMode == ExamTimeMode.Night && !IsCautionLightSpeaked)
                {
                    //夜间起步灯光检测,打近光,关危险警报灯光
                    if (CarSignalSet.Query(StartTime).Count(d => d.Sensor.LowBeam) < Constants.ErrorSignalCount ||
                        CarSignalSet.Query(StartMovingTime).Any(d => d.Sensor.HighBeam))
                    {
                        IsCautionLightSpeaked = true;
                        BreakRule(DeductionRuleCodes.RC41601, DeductionRuleCodes.SRC4160105);
                    }
                }

                //夜间远近光交替
                if (Settings.StartLowAndHighBeamInNight && Context.ExamTimeMode == ExamTimeMode.Night)
                {
                    if (!AdvancedCarSignal.CheckHighBeam(StartTime, 1))
                    {
                        BreakRule(DeductionRuleCodes.RC41603);
                    }
                }

                //检测喇叭
                if ((Settings.VehicleStartingLoudSpeakerDayCheck && Context.ExamTimeMode == ExamTimeMode.Day) ||
                    (Settings.VehicleStartingLoudSpeakerNightCheck && Context.ExamTimeMode == ExamTimeMode.Night))
                {
                    //如果没有按喇叭
                    if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.Loudspeaker) && !IsLoudspeaker)
                    {
                        BreakRule(DeductionRuleCodes.RC40208);
                    }
                }

                //检测是否车门未关闭起步
                if (signalInfo.Sensor.Door)
                {
                    BreakRule(DeductionRuleCodes.RC40202);
                }
            }



            //TODO:起步项目才会去评判手刹
            CheckHandbrake(signalInfo);
            //当车辆停止的时候且向前运行一段距离后,停止检测
            //当前
            if (signalInfo.CarState == CarState.Stop && (signalInfo.Distance - StartDistance) > 0)
            {
                StopCore();
            }

            //只要超过一定距离起步就结束
        }