diff --git a/src/components/line-app/infos/TrainInfo.vue b/src/components/line-app/infos/TrainInfo.vue index db95ff9..c6bdf74 100644 --- a/src/components/line-app/infos/TrainInfo.vue +++ b/src/components/line-app/infos/TrainInfo.vue @@ -29,6 +29,19 @@ }} + + + + {{ item.label }} + + + {{ + item.formatFn + ? item.formatFn(trainInfo.vobcState[item.key]) + : trainInfo.vobcState[item.key] + }} + + @@ -47,6 +60,11 @@ interface DynamicKeyType { key: keyof state.TrainDynamicState; formatFn?(v: state.TrainDynamicState[keyof state.TrainDynamicState]): string; } +interface VobcStateType { + label: string; + key: keyof state.TrainVobcState; + formatFn?(v: state.TrainVobcState[keyof state.TrainVobcState]): string; +} const lineStore = useLineStore(); const trainInfo = ref(); const dynamicInfo = ref(); @@ -92,6 +110,61 @@ const list2: DynamicKeyType[] = [ { label: '头车雷达速度值', key: 'headRadarSpeed', formatFn: speedFormat }, { label: '尾车雷达速度值', key: 'tailRadarSpeed', formatFn: speedFormat }, ]; +const list3: VobcStateType[] = [ + // 动力学信息 + { label: '生命信号', key: 'lifeSignal' }, + { label: 'TC1激活状态', key: 'tc1Active', formatFn: upFormat }, + { label: 'TC2激活状态', key: 'tc2Active', formatFn: upFormat }, + { + label: '列车方向向前', + key: 'directionForward', + formatFn: upFormat, + }, + { + label: '列车方向向后', + key: 'directionBackward', + formatFn: upFormat, + }, + { + label: '列车牵引状态', + key: 'tractionStatus', + formatFn: upFormat, + }, + { + label: '列车制动状态', + key: 'brakingStatus', + formatFn: upFormat, + }, + { + label: '列车紧急制动状态', + key: 'emergencyBrakingStatus', + formatFn: upFormat, + }, + { + label: '列车折返状态(AR)', + key: 'turnbackStatus', + formatFn: upFormat, + }, + { label: '跳跃状态', key: 'jumpStatus', formatFn: upFormat }, + { + label: 'ATO模式', + key: 'ato', + formatFn: upFormat, + }, + { label: 'FAM模式', key: 'fam', formatFn: upFormat }, + { label: 'CAM模式', key: 'cam', formatFn: upFormat }, + { label: '牵引安全回路', key: 'tractionSafetyCircuit', formatFn: upFormat }, + { label: '停放制动状态', key: 'parkingBrakeStatus', formatFn: upFormat }, + { label: '保持制动状态', key: 'maintainBrakeStatus', formatFn: upFormat }, + { label: '列车牵引力', key: 'tractionForce', formatFn: tractionForceFormat }, + { label: '列车制动力', key: 'brakeForce', formatFn: tractionForceFormat }, + { label: '列车载荷', key: 'trainLoad', formatFn: trainLoadFormat }, + { label: '列车开左门指令', key: 'leftDoorOpenCommand', formatFn: upFormat }, + { label: '列车开右门指令', key: 'rightDoorOpenCommand', formatFn: upFormat }, + { label: '列车关左门指令', key: 'leftDoorCloseCommand', formatFn: upFormat }, + { label: '列车关右门指令', key: 'rightDoorCloseCommand', formatFn: upFormat }, + { label: '整列车门关好', key: 'allDoorClose', formatFn: upFormat }, +]; function upFormat(v: boolean) { return v ? '是' : '否'; } @@ -113,10 +186,10 @@ function resistanceFormat(v: number) { } function speedFormat(v: number) { let n: string | number = ''; - if (v >= 0 && v < 500) { - // 负数和大于500的是错误数字 - n = floatDecimal(v); - } + // if (v >= 0 && v < 500) { + // 负数和大于500的是错误数字 + n = floatDecimal(v / 100); + // } return `${n} km/h`; } function trainLengthFormat(v: number) { @@ -129,6 +202,15 @@ function floatDecimal(v: number, x = 2) { return n; } +function tractionForceFormat(v: number) { + const n = floatDecimal(v / 100); + return `${n} KN`; +} +function trainLoadFormat(v: number) { + const n = floatDecimal(v / 100); + return `${n} ton`; +} + watch( () => lineStore.selectedGraphics, (val) => { diff --git a/src/graphics/train/Train.ts b/src/graphics/train/Train.ts index 33f61c2..8fea1cf 100644 --- a/src/graphics/train/Train.ts +++ b/src/graphics/train/Train.ts @@ -173,11 +173,16 @@ export class TrainHead extends Container { arrow.beginFill(aColor, 1); arrow.drawPolygon(arrowPoint); arrow.endFill(); - // if (states.mode?.ipModeTrainStoped) { - // this.arrow.visible = false; - // } else { - // this.arrow.visible = true; - // } + if (states.dynamicState.speed > 0) { + this.arrow.visible = true; + } else { + this.arrow.visible = false; + } + if (states.vobcState.tc1Active || states.vobcState.tc2Active) { + this.pause.visible = true; + } else { + this.pause.visible = false; + } } } diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts index cc961f9..533f87f 100644 --- a/src/protos/device_state.ts +++ b/src/protos/device_state.ts @@ -1287,19 +1287,19 @@ export namespace state { if (this.curveResistance != 0) writer.writeFloat(13, this.curveResistance); if (this.speed != 0) - writer.writeFloat(14, this.speed); + writer.writeInt32(14, this.speed); if (this.headSensorSpeed1 != 0) - writer.writeFloat(15, this.headSensorSpeed1); + writer.writeInt32(15, this.headSensorSpeed1); if (this.headSensorSpeed2 != 0) - writer.writeFloat(16, this.headSensorSpeed2); + writer.writeInt32(16, this.headSensorSpeed2); if (this.tailSensorSpeed1 != 0) - writer.writeFloat(17, this.tailSensorSpeed1); + writer.writeInt32(17, this.tailSensorSpeed1); if (this.tailSensorSpeed2 != 0) - writer.writeFloat(18, this.tailSensorSpeed2); + writer.writeInt32(18, this.tailSensorSpeed2); if (this.headRadarSpeed != 0) - writer.writeFloat(19, this.headRadarSpeed); + writer.writeInt32(19, this.headRadarSpeed); if (this.tailRadarSpeed != 0) - writer.writeFloat(20, this.tailRadarSpeed); + writer.writeInt32(20, this.tailRadarSpeed); if (!w) return writer.getResultBuffer(); } @@ -1349,25 +1349,25 @@ export namespace state { message.curveResistance = reader.readFloat(); break; case 14: - message.speed = reader.readFloat(); + message.speed = reader.readInt32(); break; case 15: - message.headSensorSpeed1 = reader.readFloat(); + message.headSensorSpeed1 = reader.readInt32(); break; case 16: - message.headSensorSpeed2 = reader.readFloat(); + message.headSensorSpeed2 = reader.readInt32(); break; case 17: - message.tailSensorSpeed1 = reader.readFloat(); + message.tailSensorSpeed1 = reader.readInt32(); break; case 18: - message.tailSensorSpeed2 = reader.readFloat(); + message.tailSensorSpeed2 = reader.readInt32(); break; case 19: - message.headRadarSpeed = reader.readFloat(); + message.headRadarSpeed = reader.readInt32(); break; case 20: - message.tailRadarSpeed = reader.readFloat(); + message.tailRadarSpeed = reader.readInt32(); break; default: reader.skipField(); }