Esempio n. 1
0
        public void SendATPCurve(SpeedLimit speedLimit, bool isInFault, bool isEb,
                                 byte zhangJieFault, byte xiaoJieFault, string faultReason, bool faultRecover, bool speedFault, byte[] sendBuf, int totalEnergy, int comfort)
        {
            Atp2Curve curve = this;

            curve.atpCurvePackage.MAEndDistance = speedLimit.MAEndDistance;
            curve.atpCurvePackage.limSpeedNum   = speedLimit.limSpeedNum;

            for (int i = 0; i < 4; i++)
            {
                curve.atpCurvePackage.limSpeedDistance[i] = speedLimit.limSpeedDistance[i];
                curve.atpCurvePackage.limSpeedLength[i]   = speedLimit.limSpeedLength[i];
            }

            if (isInFault == true && isEb == false) //收到后并且不EB了说明不处于故障了
            {
                isInFault = false;
            }

            if (isInFault == true)
            {
                curve.atpCurvePackage.faultPostion = "故障章节 :" +
                                                     Convert.ToString(zhangJieFault) + "\r\n" + "故障小节:" +
                                                     Convert.ToString(xiaoJieFault) + "\r\n" + "故障原因:" + Convert.ToString(faultReason);
            }
            else
            {
                curve.atpCurvePackage.faultPostion = "";
            }

            if (faultRecover == true)
            {
                curve.atpCurvePackage.faultReason = "";
            }
            else if (speedFault == true)
            {
                curve.atpCurvePackage.faultReason = "速度传感器故障,请切入EUM模式回库";
            }
            curve.atpCurvePackage.totalEnergy = totalEnergy;
            curve.atpCurvePackage.Comfort     = comfort;
            curve.SetFaultReason(zhangJieFault, xiaoJieFault);

            int ATPCurveSendDataLength = curve.atpCurvePackage.ATPCurvePackStream(sendBuf);

            client.Send(sendBuf, ATPCurveSendDataLength);
        }
Esempio n. 2
0
        public void SendDMI(int trainID, DcInfo dcInfo, bool isEB,
                            ComputeProtectSpeed ProtectSpeed, SpeedLimit speedLimit,
                            bool DMIShow, bool isRealeaseEB, bool isSendZCBool,
                            bool isInFault, byte[] sendBuf) //发送DMI消息
        {
            dmiPackage.TrainID    = 65536;
            dmiPackage.TrainNum   = "T0" + trainID.ToString();
            dmiPackage.HighModel  = 1;
            dmiPackage.CurModel   = (byte)dcInfo.DCCtrlMode;
            dmiPackage.ActulSpeed = (UInt16)Math.Abs(dcInfo.DCTrainSpeed);
            dmiPackage.BreakOut   = (byte)DMIBreakOut.NoEB;
            dmiPackage.Alarm      = 1;

            if (isEB == false)
            {
                UInt16 HighSpeed = (UInt16)ProtectSpeed(
                    speedLimit.MAEndDistance, speedLimit.limSpeedNum, speedLimit.limSpeedDistance[0]);
                dmiPackage.HighSpeed      = HighSpeed; //目前得不到速度信息
                dmiPackage.PermitSpeed    = (UInt16)(HighSpeed - 5);
                dmiPackage.FrontPermSpeed = (UInt16)(HighSpeed - 2);
                dmiPackage.TargetLoca     = (UInt16)speedLimit.MAEndDistance;
            }
            else
            {
                dmiPackage.HighSpeed      = 0; //目前得不到速度信息
                dmiPackage.PermitSpeed    = 0;
                dmiPackage.FrontPermSpeed = 0;
                dmiPackage.TargetLoca     = 0;
            }

            if (isEB == true)
            {
                dmiPackage.BreakOut = (byte)DMIBreakOut.EB;
                dmiPackage.Alarm    = 1;
            }

            dmiPackage.Dmishow = (UInt16)(DMIShow ? 2 : 1);

            if (!dcInfo.IsCurBaliseEmpty())
            {
                dmiPackage.IsNoZHG = (UInt16)(dcInfo.IsCurStartWith("ZHG")? 0 : 1);
            }

            dmiPackage.IsRealeaseEB = (UInt16)(isRealeaseEB ? 2 : 1);
            dmiPackage.IsCBTC       = (UInt16)(isSendZCBool ? 0 : 1);

            if (isInFault == true)
            {
                dmiPackage.FaultType = 2;
            }
            else if (isSendZCBool == false)
            {
                dmiPackage.FaultType = 3;
            }
            else
            {
                dmiPackage.FaultType = 1;
            }

            int DMISendDataLength = dmiPackage.DMIPackStream(sendBuf);

            client.Send(sendBuf, DMISendDataLength);
        }