public void SendZC(DcInfo dcInfo, int sendID, int trainID, ModelType curModel, byte[] sendBuf) //测完 { if (!dcInfo.IsCurStartWith("Z") && !dcInfo.IsCurBaliseEmpty()) { zcPackage.SendID = (byte)sendID; zcPackage.TrainID = (UInt16)trainID; zcPackage.RunInformation = 0x01; zcPackage.TailSectionOrSwitch = zcPackage.HeadSectionOrSwitch; zcPackage.TailID = zcPackage.HeadID; zcPackage.ACtSpeed = (UInt16)Math.Abs(dcInfo.DCTrainSpeed); zcPackage.Mode = (byte)curModel; int ZCSendDataLength = zcPackage.ZCPackStream(sendBuf); client.Send(sendBuf, ZCSendDataLength); } }
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); }