diff --git a/docs/docs.go b/docs/docs.go index c949f1d..29e1619 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -4061,7 +4061,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/dto.SignalOperationReqDto" + "$ref": "#/definitions/request_proto.SignalOperationReq" } } ], @@ -4113,7 +4113,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/request_proto.TurnoutOperationReq" + "$ref": "#/definitions/request_proto.PointsOperationReq" } } ], @@ -4616,16 +4616,6 @@ const docTemplate = `{ "name": "id", "in": "query" }, - { - "type": "integer", - "name": "max_diameter", - "in": "query" - }, - { - "type": "integer", - "name": "min_diameter", - "in": "query" - }, { "type": "string", "name": "name", @@ -4643,6 +4633,7 @@ const docTemplate = `{ }, { "type": "string", + "description": "MinDiameter int32 ` + "`" + `json:\"min_diameter\" form:\"min_diameter\"` + "`" + `\nMaxDiameter int32 ` + "`" + `json:\"max_diameter\" form:\"max_diameter\"` + "`" + `", "name": "train_sets", "in": "query" } @@ -5202,18 +5193,6 @@ const docTemplate = `{ "dto.ConfigTrainData": { "type": "object", "properties": { - "baseResistanceParamA": { - "description": "Mass int32 ` + "`" + `json:\"mass\" form:\"mass\"` + "`" + ` // 列车的质量(100=1ton)", - "type": "number" - }, - "baseResistanceParamB": { - "description": "基本阻力参数B", - "type": "number" - }, - "baseResistanceParamC": { - "description": "基本阻力参数C", - "type": "number" - }, "curveResistanceParamR1": { "description": "曲线阻力参数R1", "type": "number" @@ -5230,6 +5209,22 @@ const docTemplate = `{ "description": "曲线阻力参数R4", "type": "number" }, + "davisParamA": { + "description": "Mass int32 ` + "`" + `json:\"mass\" form:\"mass\"` + "`" + ` // 列车的质量(100=1ton)", + "type": "number" + }, + "davisParamB": { + "description": "基本阻力参数B", + "type": "number" + }, + "davisParamC": { + "description": "基本阻力参数C", + "type": "number" + }, + "idling": { + "description": "空转", + "type": "number" + }, "jump": { "description": "是否跳跃", "type": "boolean" @@ -5255,7 +5250,7 @@ const docTemplate = `{ "dto.ConfigTrainEnds": { "type": "object", "properties": { - "radarCheckSpeed": { + "radarCheckSpeedDiff": { "description": "雷达测速数值", "type": "number" }, @@ -5675,43 +5670,6 @@ const docTemplate = `{ } } }, - "dto.SignalOperationReqDto": { - "type": "object", - "required": [ - "aspect", - "id", - "mapId", - "operation", - "simulationId" - ], - "properties": { - "aspect": { - "description": "当操作为Operation.Display时有效,表示显示的信号", - "allOf": [ - { - "$ref": "#/definitions/state_proto.Signal_Aspect" - } - ] - }, - "id": { - "type": "integer" - }, - "mapId": { - "type": "integer" - }, - "operation": { - "description": "信号机操作类型", - "allOf": [ - { - "$ref": "#/definitions/request_proto.Signal_Operation" - } - ] - }, - "simulationId": { - "type": "string" - } - } - }, "dto.SimulationCreateReqDto": { "type": "object", "properties": { @@ -5807,12 +5765,6 @@ const docTemplate = `{ "id": { "type": "integer" }, - "max_diameter": { - "type": "integer" - }, - "min_diameter": { - "type": "integer" - }, "name": { "type": "string" }, @@ -5826,6 +5778,7 @@ const docTemplate = `{ "type": "integer" }, "train_sets": { + "description": "MinDiameter int32 ` + "`" + `json:\"min_diameter\" form:\"min_diameter\"` + "`" + `\nMaxDiameter int32 ` + "`" + `json:\"max_diameter\" form:\"max_diameter\"` + "`" + `", "type": "string" } } @@ -6029,6 +5982,88 @@ const docTemplate = `{ } } }, + "request_proto.PointsOperationReq": { + "type": "object", + "properties": { + "deviceId": { + "description": "设备id", + "type": "integer" + }, + "mapId": { + "description": "图id", + "type": "integer" + }, + "operation": { + "description": "道岔操作", + "allOf": [ + { + "$ref": "#/definitions/request_proto.Points_Operation" + } + ] + }, + "param": { + "description": "道岔参数,当operation为SetParams时有效", + "allOf": [ + { + "$ref": "#/definitions/request_proto.PointsParam" + } + ] + }, + "simulationId": { + "description": "仿真id", + "type": "string" + } + } + }, + "request_proto.PointsParam": { + "type": "object", + "properties": { + "forcePosition": { + "description": "道岔强制", + "allOf": [ + { + "$ref": "#/definitions/request_proto.Points_Force" + } + ] + } + } + }, + "request_proto.Points_Force": { + "type": "integer", + "enum": [ + 0, + 1, + 2, + 3 + ], + "x-enum-comments": { + "Points_FP_DW": "定位", + "Points_FP_FW": "反位", + "Points_FP_NONE": "无强制", + "Points_FP_SB": "失表" + }, + "x-enum-varnames": [ + "Points_FP_NONE", + "Points_FP_DW", + "Points_FP_FW", + "Points_FP_SB" + ] + }, + "request_proto.Points_Operation": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "x-enum-comments": { + "Points_SetParams": "设置参数", + "Points_Undefined": "未定义" + }, + "x-enum-varnames": [ + "Points_Undefined", + "Points_SetParams" + ] + }, "request_proto.PsdOperationReq": { "type": "object", "properties": { @@ -6148,52 +6183,7 @@ const docTemplate = `{ "Section_CancelFaultOcc" ] }, - "request_proto.Signal_Operation": { - "type": "integer", - "enum": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11 - ], - "x-enum-comments": { - "Signal_Display": "显示操作,如设置绿色、设置红黄色", - "Signal_LightACancelDs": "取消蓝灯断丝故障", - "Signal_LightAFaultDs": "设置蓝灯断丝故障", - "Signal_LightBCancelDs": "取消白灯断丝故障", - "Signal_LightBFaultDs": "设置白灯断丝故障", - "Signal_LightHCancelDs": "取消红灯断丝故障", - "Signal_LightHFaultDs": "设置红灯断丝故障", - "Signal_LightLCancelDs": "取消绿灯断丝故障", - "Signal_LightLFaultDs": "设置绿灯断丝故障", - "Signal_LightUCancelDs": "取消黄灯断丝故障", - "Signal_LightUFaultDs": "设置黄灯断丝故障", - "Signal_Undefined": "未定义" - }, - "x-enum-varnames": [ - "Signal_Undefined", - "Signal_Display", - "Signal_LightHFaultDs", - "Signal_LightUFaultDs", - "Signal_LightLFaultDs", - "Signal_LightAFaultDs", - "Signal_LightBFaultDs", - "Signal_LightHCancelDs", - "Signal_LightUCancelDs", - "Signal_LightLCancelDs", - "Signal_LightACancelDs", - "Signal_LightBCancelDs" - ] - }, - "request_proto.TurnoutOperationReq": { + "request_proto.SignalOperationReq": { "type": "object", "properties": { "deviceId": { @@ -6205,10 +6195,18 @@ const docTemplate = `{ "type": "integer" }, "operation": { - "description": "道岔操作", + "description": "信号机操作", "allOf": [ { - "$ref": "#/definitions/request_proto.Turnout_Operation" + "$ref": "#/definitions/request_proto.Signal_Operation" + } + ] + }, + "param": { + "description": "信号机参数,当operation为SetParams时有效", + "allOf": [ + { + "$ref": "#/definitions/request_proto.SignalParam" } ] }, @@ -6218,52 +6216,51 @@ const docTemplate = `{ } } }, - "request_proto.Turnout_Operation": { + "request_proto.SignalParam": { + "type": "object", + "properties": { + "dsList": { + "description": "信号机断丝", + "type": "array", + "items": { + "$ref": "#/definitions/request_proto.Signal_DS" + } + }, + "force": { + "description": "信号机强制", + "allOf": [ + { + "$ref": "#/definitions/request_proto.Signal_Force" + } + ] + } + } + }, + "request_proto.Signal_DS": { "type": "integer", "enum": [ 0, 1, 2, 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11 + 4 ], "x-enum-comments": { - "Turnout_CancelDC": "取消定操", - "Turnout_CancelFC": "取消反操", - "Turnout_CancelForce": "取消强制", - "Turnout_CancelJC": "取消挤岔故障", - "Turnout_CancelSB": "取消失表故障", - "Turnout_DC": "定操", - "Turnout_FC": "反操", - "Turnout_ForceDw": "强制定位", - "Turnout_ForceFw": "强制反位", - "Turnout_SetJC": "设置挤岔故障", - "Turnout_SetSB": "设置失表故障", - "Turnout_Undefined": "未定义" + "Signal_DS_A": "蓝灯断丝", + "Signal_DS_B": "白灯断丝", + "Signal_DS_H": "红灯断丝", + "Signal_DS_L": "绿灯断丝", + "Signal_DS_U": "黄灯断丝" }, "x-enum-varnames": [ - "Turnout_Undefined", - "Turnout_DC", - "Turnout_CancelDC", - "Turnout_FC", - "Turnout_CancelFC", - "Turnout_SetSB", - "Turnout_CancelSB", - "Turnout_SetJC", - "Turnout_CancelJC", - "Turnout_ForceDw", - "Turnout_ForceFw", - "Turnout_CancelForce" + "Signal_DS_H", + "Signal_DS_U", + "Signal_DS_L", + "Signal_DS_A", + "Signal_DS_B" ] }, - "state_proto.Signal_Aspect": { + "request_proto.Signal_Force": { "type": "integer", "enum": [ 0, @@ -6275,15 +6272,40 @@ const docTemplate = `{ 6, 7 ], + "x-enum-comments": { + "Signal_SF_A": "蓝灯", + "Signal_SF_B": "白灯", + "Signal_SF_H": "红灯", + "Signal_SF_HU": "红黄灯", + "Signal_SF_L": "绿灯", + "Signal_SF_M": "灭灯", + "Signal_SF_NONE": "无强制", + "Signal_SF_U": "黄灯" + }, "x-enum-varnames": [ - "Signal_Non", - "Signal_OFF", - "Signal_L", - "Signal_H", - "Signal_U", - "Signal_HU", - "Signal_B", - "Signal_A" + "Signal_SF_NONE", + "Signal_SF_M", + "Signal_SF_H", + "Signal_SF_U", + "Signal_SF_L", + "Signal_SF_HU", + "Signal_SF_A", + "Signal_SF_B" + ] + }, + "request_proto.Signal_Operation": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "x-enum-comments": { + "Signal_SetParams": "设置参数", + "Signal_Undefined": "未定义" + }, + "x-enum-varnames": [ + "Signal_Undefined", + "Signal_SetParams" ] } }, diff --git a/docs/swagger.json b/docs/swagger.json index ceb0c01..ec6d931 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -4055,7 +4055,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/dto.SignalOperationReqDto" + "$ref": "#/definitions/request_proto.SignalOperationReq" } } ], @@ -4107,7 +4107,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/request_proto.TurnoutOperationReq" + "$ref": "#/definitions/request_proto.PointsOperationReq" } } ], @@ -4610,16 +4610,6 @@ "name": "id", "in": "query" }, - { - "type": "integer", - "name": "max_diameter", - "in": "query" - }, - { - "type": "integer", - "name": "min_diameter", - "in": "query" - }, { "type": "string", "name": "name", @@ -4637,6 +4627,7 @@ }, { "type": "string", + "description": "MinDiameter int32 `json:\"min_diameter\" form:\"min_diameter\"`\nMaxDiameter int32 `json:\"max_diameter\" form:\"max_diameter\"`", "name": "train_sets", "in": "query" } @@ -5196,18 +5187,6 @@ "dto.ConfigTrainData": { "type": "object", "properties": { - "baseResistanceParamA": { - "description": "Mass int32 `json:\"mass\" form:\"mass\"` // 列车的质量(100=1ton)", - "type": "number" - }, - "baseResistanceParamB": { - "description": "基本阻力参数B", - "type": "number" - }, - "baseResistanceParamC": { - "description": "基本阻力参数C", - "type": "number" - }, "curveResistanceParamR1": { "description": "曲线阻力参数R1", "type": "number" @@ -5224,6 +5203,22 @@ "description": "曲线阻力参数R4", "type": "number" }, + "davisParamA": { + "description": "Mass int32 `json:\"mass\" form:\"mass\"` // 列车的质量(100=1ton)", + "type": "number" + }, + "davisParamB": { + "description": "基本阻力参数B", + "type": "number" + }, + "davisParamC": { + "description": "基本阻力参数C", + "type": "number" + }, + "idling": { + "description": "空转", + "type": "number" + }, "jump": { "description": "是否跳跃", "type": "boolean" @@ -5249,7 +5244,7 @@ "dto.ConfigTrainEnds": { "type": "object", "properties": { - "radarCheckSpeed": { + "radarCheckSpeedDiff": { "description": "雷达测速数值", "type": "number" }, @@ -5669,43 +5664,6 @@ } } }, - "dto.SignalOperationReqDto": { - "type": "object", - "required": [ - "aspect", - "id", - "mapId", - "operation", - "simulationId" - ], - "properties": { - "aspect": { - "description": "当操作为Operation.Display时有效,表示显示的信号", - "allOf": [ - { - "$ref": "#/definitions/state_proto.Signal_Aspect" - } - ] - }, - "id": { - "type": "integer" - }, - "mapId": { - "type": "integer" - }, - "operation": { - "description": "信号机操作类型", - "allOf": [ - { - "$ref": "#/definitions/request_proto.Signal_Operation" - } - ] - }, - "simulationId": { - "type": "string" - } - } - }, "dto.SimulationCreateReqDto": { "type": "object", "properties": { @@ -5801,12 +5759,6 @@ "id": { "type": "integer" }, - "max_diameter": { - "type": "integer" - }, - "min_diameter": { - "type": "integer" - }, "name": { "type": "string" }, @@ -5820,6 +5772,7 @@ "type": "integer" }, "train_sets": { + "description": "MinDiameter int32 `json:\"min_diameter\" form:\"min_diameter\"`\nMaxDiameter int32 `json:\"max_diameter\" form:\"max_diameter\"`", "type": "string" } } @@ -6023,6 +5976,88 @@ } } }, + "request_proto.PointsOperationReq": { + "type": "object", + "properties": { + "deviceId": { + "description": "设备id", + "type": "integer" + }, + "mapId": { + "description": "图id", + "type": "integer" + }, + "operation": { + "description": "道岔操作", + "allOf": [ + { + "$ref": "#/definitions/request_proto.Points_Operation" + } + ] + }, + "param": { + "description": "道岔参数,当operation为SetParams时有效", + "allOf": [ + { + "$ref": "#/definitions/request_proto.PointsParam" + } + ] + }, + "simulationId": { + "description": "仿真id", + "type": "string" + } + } + }, + "request_proto.PointsParam": { + "type": "object", + "properties": { + "forcePosition": { + "description": "道岔强制", + "allOf": [ + { + "$ref": "#/definitions/request_proto.Points_Force" + } + ] + } + } + }, + "request_proto.Points_Force": { + "type": "integer", + "enum": [ + 0, + 1, + 2, + 3 + ], + "x-enum-comments": { + "Points_FP_DW": "定位", + "Points_FP_FW": "反位", + "Points_FP_NONE": "无强制", + "Points_FP_SB": "失表" + }, + "x-enum-varnames": [ + "Points_FP_NONE", + "Points_FP_DW", + "Points_FP_FW", + "Points_FP_SB" + ] + }, + "request_proto.Points_Operation": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "x-enum-comments": { + "Points_SetParams": "设置参数", + "Points_Undefined": "未定义" + }, + "x-enum-varnames": [ + "Points_Undefined", + "Points_SetParams" + ] + }, "request_proto.PsdOperationReq": { "type": "object", "properties": { @@ -6142,52 +6177,7 @@ "Section_CancelFaultOcc" ] }, - "request_proto.Signal_Operation": { - "type": "integer", - "enum": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11 - ], - "x-enum-comments": { - "Signal_Display": "显示操作,如设置绿色、设置红黄色", - "Signal_LightACancelDs": "取消蓝灯断丝故障", - "Signal_LightAFaultDs": "设置蓝灯断丝故障", - "Signal_LightBCancelDs": "取消白灯断丝故障", - "Signal_LightBFaultDs": "设置白灯断丝故障", - "Signal_LightHCancelDs": "取消红灯断丝故障", - "Signal_LightHFaultDs": "设置红灯断丝故障", - "Signal_LightLCancelDs": "取消绿灯断丝故障", - "Signal_LightLFaultDs": "设置绿灯断丝故障", - "Signal_LightUCancelDs": "取消黄灯断丝故障", - "Signal_LightUFaultDs": "设置黄灯断丝故障", - "Signal_Undefined": "未定义" - }, - "x-enum-varnames": [ - "Signal_Undefined", - "Signal_Display", - "Signal_LightHFaultDs", - "Signal_LightUFaultDs", - "Signal_LightLFaultDs", - "Signal_LightAFaultDs", - "Signal_LightBFaultDs", - "Signal_LightHCancelDs", - "Signal_LightUCancelDs", - "Signal_LightLCancelDs", - "Signal_LightACancelDs", - "Signal_LightBCancelDs" - ] - }, - "request_proto.TurnoutOperationReq": { + "request_proto.SignalOperationReq": { "type": "object", "properties": { "deviceId": { @@ -6199,10 +6189,18 @@ "type": "integer" }, "operation": { - "description": "道岔操作", + "description": "信号机操作", "allOf": [ { - "$ref": "#/definitions/request_proto.Turnout_Operation" + "$ref": "#/definitions/request_proto.Signal_Operation" + } + ] + }, + "param": { + "description": "信号机参数,当operation为SetParams时有效", + "allOf": [ + { + "$ref": "#/definitions/request_proto.SignalParam" } ] }, @@ -6212,52 +6210,51 @@ } } }, - "request_proto.Turnout_Operation": { + "request_proto.SignalParam": { + "type": "object", + "properties": { + "dsList": { + "description": "信号机断丝", + "type": "array", + "items": { + "$ref": "#/definitions/request_proto.Signal_DS" + } + }, + "force": { + "description": "信号机强制", + "allOf": [ + { + "$ref": "#/definitions/request_proto.Signal_Force" + } + ] + } + } + }, + "request_proto.Signal_DS": { "type": "integer", "enum": [ 0, 1, 2, 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11 + 4 ], "x-enum-comments": { - "Turnout_CancelDC": "取消定操", - "Turnout_CancelFC": "取消反操", - "Turnout_CancelForce": "取消强制", - "Turnout_CancelJC": "取消挤岔故障", - "Turnout_CancelSB": "取消失表故障", - "Turnout_DC": "定操", - "Turnout_FC": "反操", - "Turnout_ForceDw": "强制定位", - "Turnout_ForceFw": "强制反位", - "Turnout_SetJC": "设置挤岔故障", - "Turnout_SetSB": "设置失表故障", - "Turnout_Undefined": "未定义" + "Signal_DS_A": "蓝灯断丝", + "Signal_DS_B": "白灯断丝", + "Signal_DS_H": "红灯断丝", + "Signal_DS_L": "绿灯断丝", + "Signal_DS_U": "黄灯断丝" }, "x-enum-varnames": [ - "Turnout_Undefined", - "Turnout_DC", - "Turnout_CancelDC", - "Turnout_FC", - "Turnout_CancelFC", - "Turnout_SetSB", - "Turnout_CancelSB", - "Turnout_SetJC", - "Turnout_CancelJC", - "Turnout_ForceDw", - "Turnout_ForceFw", - "Turnout_CancelForce" + "Signal_DS_H", + "Signal_DS_U", + "Signal_DS_L", + "Signal_DS_A", + "Signal_DS_B" ] }, - "state_proto.Signal_Aspect": { + "request_proto.Signal_Force": { "type": "integer", "enum": [ 0, @@ -6269,15 +6266,40 @@ 6, 7 ], + "x-enum-comments": { + "Signal_SF_A": "蓝灯", + "Signal_SF_B": "白灯", + "Signal_SF_H": "红灯", + "Signal_SF_HU": "红黄灯", + "Signal_SF_L": "绿灯", + "Signal_SF_M": "灭灯", + "Signal_SF_NONE": "无强制", + "Signal_SF_U": "黄灯" + }, "x-enum-varnames": [ - "Signal_Non", - "Signal_OFF", - "Signal_L", - "Signal_H", - "Signal_U", - "Signal_HU", - "Signal_B", - "Signal_A" + "Signal_SF_NONE", + "Signal_SF_M", + "Signal_SF_H", + "Signal_SF_U", + "Signal_SF_L", + "Signal_SF_HU", + "Signal_SF_A", + "Signal_SF_B" + ] + }, + "request_proto.Signal_Operation": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "x-enum-comments": { + "Signal_SetParams": "设置参数", + "Signal_Undefined": "未定义" + }, + "x-enum-varnames": [ + "Signal_Undefined", + "Signal_SetParams" ] } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 99309de..9579750 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -191,16 +191,6 @@ definitions: type: object dto.ConfigTrainData: properties: - baseResistanceParamA: - description: Mass int32 `json:"mass" form:"mass"` // - 列车的质量(100=1ton) - type: number - baseResistanceParamB: - description: 基本阻力参数B - type: number - baseResistanceParamC: - description: 基本阻力参数C - type: number curveResistanceParamR1: description: 曲线阻力参数R1 type: number @@ -213,6 +203,19 @@ definitions: curveResistanceParamR4: description: 曲线阻力参数R4 type: number + davisParamA: + description: Mass int32 `json:"mass" form:"mass"` // + 列车的质量(100=1ton) + type: number + davisParamB: + description: 基本阻力参数B + type: number + davisParamC: + description: 基本阻力参数C + type: number + idling: + description: 空转 + type: number jump: description: 是否跳跃 type: boolean @@ -231,7 +234,7 @@ definitions: type: object dto.ConfigTrainEnds: properties: - radarCheckSpeed: + radarCheckSpeedDiff: description: 雷达测速数值 type: number radarCheckTime: @@ -515,29 +518,6 @@ definitions: description: 新添加的列车的索引 type: string type: object - dto.SignalOperationReqDto: - properties: - aspect: - allOf: - - $ref: '#/definitions/state_proto.Signal_Aspect' - description: 当操作为Operation.Display时有效,表示显示的信号 - id: - type: integer - mapId: - type: integer - operation: - allOf: - - $ref: '#/definitions/request_proto.Signal_Operation' - description: 信号机操作类型 - simulationId: - type: string - required: - - aspect - - id - - mapId - - operation - - simulationId - type: object dto.SimulationCreateReqDto: properties: mapId: @@ -603,10 +583,6 @@ definitions: type: string id: type: integer - max_diameter: - type: integer - min_diameter: - type: integer name: type: string total_length: @@ -614,6 +590,9 @@ definitions: train_model: type: integer train_sets: + description: |- + MinDiameter int32 `json:"min_diameter" form:"min_diameter"` + MaxDiameter int32 `json:"max_diameter" form:"max_diameter"` type: string trainConfigData: $ref: '#/definitions/dto.ConfigTrainData' @@ -761,6 +740,61 @@ definitions: description: 数据类型 type: integer type: object + request_proto.Points_Force: + enum: + - 0 + - 1 + - 2 + - 3 + type: integer + x-enum-comments: + Points_FP_DW: 定位 + Points_FP_FW: 反位 + Points_FP_NONE: 无强制 + Points_FP_SB: 失表 + x-enum-varnames: + - Points_FP_NONE + - Points_FP_DW + - Points_FP_FW + - Points_FP_SB + request_proto.Points_Operation: + enum: + - 0 + - 1 + type: integer + x-enum-comments: + Points_SetParams: 设置参数 + Points_Undefined: 未定义 + x-enum-varnames: + - Points_Undefined + - Points_SetParams + request_proto.PointsOperationReq: + properties: + deviceId: + description: 设备id + type: integer + mapId: + description: 图id + type: integer + operation: + allOf: + - $ref: '#/definitions/request_proto.Points_Operation' + description: 道岔操作 + param: + allOf: + - $ref: '#/definitions/request_proto.PointsParam' + description: 道岔参数,当operation为SetParams时有效 + simulationId: + description: 仿真id + type: string + type: object + request_proto.PointsParam: + properties: + forcePosition: + allOf: + - $ref: '#/definitions/request_proto.Points_Force' + description: 道岔强制 + type: object request_proto.Psd_Operation: enum: - 0 @@ -860,89 +894,67 @@ definitions: - Section_CancelPdrst - Section_SetFaultOcc - Section_CancelFaultOcc + request_proto.Signal_DS: + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + type: integer + x-enum-comments: + Signal_DS_A: 蓝灯断丝 + Signal_DS_B: 白灯断丝 + Signal_DS_H: 红灯断丝 + Signal_DS_L: 绿灯断丝 + Signal_DS_U: 黄灯断丝 + x-enum-varnames: + - Signal_DS_H + - Signal_DS_U + - Signal_DS_L + - Signal_DS_A + - Signal_DS_B + request_proto.Signal_Force: + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + type: integer + x-enum-comments: + Signal_SF_A: 蓝灯 + Signal_SF_B: 白灯 + Signal_SF_H: 红灯 + Signal_SF_HU: 红黄灯 + Signal_SF_L: 绿灯 + Signal_SF_M: 灭灯 + Signal_SF_NONE: 无强制 + Signal_SF_U: 黄灯 + x-enum-varnames: + - Signal_SF_NONE + - Signal_SF_M + - Signal_SF_H + - Signal_SF_U + - Signal_SF_L + - Signal_SF_HU + - Signal_SF_A + - Signal_SF_B request_proto.Signal_Operation: enum: - 0 - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 - - 8 - - 9 - - 10 - - 11 type: integer x-enum-comments: - Signal_Display: 显示操作,如设置绿色、设置红黄色 - Signal_LightACancelDs: 取消蓝灯断丝故障 - Signal_LightAFaultDs: 设置蓝灯断丝故障 - Signal_LightBCancelDs: 取消白灯断丝故障 - Signal_LightBFaultDs: 设置白灯断丝故障 - Signal_LightHCancelDs: 取消红灯断丝故障 - Signal_LightHFaultDs: 设置红灯断丝故障 - Signal_LightLCancelDs: 取消绿灯断丝故障 - Signal_LightLFaultDs: 设置绿灯断丝故障 - Signal_LightUCancelDs: 取消黄灯断丝故障 - Signal_LightUFaultDs: 设置黄灯断丝故障 + Signal_SetParams: 设置参数 Signal_Undefined: 未定义 x-enum-varnames: - Signal_Undefined - - Signal_Display - - Signal_LightHFaultDs - - Signal_LightUFaultDs - - Signal_LightLFaultDs - - Signal_LightAFaultDs - - Signal_LightBFaultDs - - Signal_LightHCancelDs - - Signal_LightUCancelDs - - Signal_LightLCancelDs - - Signal_LightACancelDs - - Signal_LightBCancelDs - request_proto.Turnout_Operation: - enum: - - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 - - 8 - - 9 - - 10 - - 11 - type: integer - x-enum-comments: - Turnout_CancelDC: 取消定操 - Turnout_CancelFC: 取消反操 - Turnout_CancelForce: 取消强制 - Turnout_CancelJC: 取消挤岔故障 - Turnout_CancelSB: 取消失表故障 - Turnout_DC: 定操 - Turnout_FC: 反操 - Turnout_ForceDw: 强制定位 - Turnout_ForceFw: 强制反位 - Turnout_SetJC: 设置挤岔故障 - Turnout_SetSB: 设置失表故障 - Turnout_Undefined: 未定义 - x-enum-varnames: - - Turnout_Undefined - - Turnout_DC - - Turnout_CancelDC - - Turnout_FC - - Turnout_CancelFC - - Turnout_SetSB - - Turnout_CancelSB - - Turnout_SetJC - - Turnout_CancelJC - - Turnout_ForceDw - - Turnout_ForceFw - - Turnout_CancelForce - request_proto.TurnoutOperationReq: + - Signal_SetParams + request_proto.SignalOperationReq: properties: deviceId: description: 设备id @@ -952,32 +964,28 @@ definitions: type: integer operation: allOf: - - $ref: '#/definitions/request_proto.Turnout_Operation' - description: 道岔操作 + - $ref: '#/definitions/request_proto.Signal_Operation' + description: 信号机操作 + param: + allOf: + - $ref: '#/definitions/request_proto.SignalParam' + description: 信号机参数,当operation为SetParams时有效 simulationId: description: 仿真id type: string type: object - state_proto.Signal_Aspect: - enum: - - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 - type: integer - x-enum-varnames: - - Signal_Non - - Signal_OFF - - Signal_L - - Signal_H - - Signal_U - - Signal_HU - - Signal_B - - Signal_A + request_proto.SignalParam: + properties: + dsList: + description: 信号机断丝 + items: + $ref: '#/definitions/request_proto.Signal_DS' + type: array + force: + allOf: + - $ref: '#/definitions/request_proto.Signal_Force' + description: 信号机强制 + type: object host: localhost:9091 info: contact: {} @@ -3553,7 +3561,7 @@ paths: name: SignalOperationReqDto required: true schema: - $ref: '#/definitions/dto.SignalOperationReqDto' + $ref: '#/definitions/request_proto.SignalOperationReq' produces: - application/json responses: @@ -3586,7 +3594,7 @@ paths: name: TurnoutOperationReq required: true schema: - $ref: '#/definitions/request_proto.TurnoutOperationReq' + $ref: '#/definitions/request_proto.PointsOperationReq' produces: - application/json responses: @@ -3855,12 +3863,6 @@ paths: - in: query name: id type: integer - - in: query - name: max_diameter - type: integer - - in: query - name: min_diameter - type: integer - in: query name: name type: string @@ -3870,7 +3872,10 @@ paths: - in: query name: train_model type: integer - - in: query + - description: |- + MinDiameter int32 `json:"min_diameter" form:"min_diameter"` + MaxDiameter int32 `json:"max_diameter" form:"max_diameter"` + in: query name: train_sets type: string produces: diff --git a/dto/simulation.go b/dto/simulation.go index fb9360d..8a41d81 100644 --- a/dto/simulation.go +++ b/dto/simulation.go @@ -92,11 +92,11 @@ type ConfigTrainReqDto struct { WheelDiameter int32 `json:"wheelDiameter"` // 轮径(mm) } type ConfigTrainEnds struct { - SpeedSensorEnableA bool `json:"speedSensorEnableA"` // 2端速度传感器是否有效 - SpeedSensorEnableB bool `json:"speedSensorEnableB"` // 2端速度传感器是否有效 - RadarEnable bool `json:"radarEnable"` // 雷达是否有效 - RadarCheckSpeedDiff float32 `json:"radarCheckSpeed"` // 雷达测速数值 - RadarCheckTime int32 `json:"radarCheckTime"` // 雷达检测时间(秒) + SpeedSensorEnableA bool `json:"speedSensorEnableA"` // 2端速度传感器是否有效 + SpeedSensorEnableB bool `json:"speedSensorEnableB"` // 2端速度传感器是否有效 + RadarEnable bool `json:"radarEnable"` // 雷达是否有效 + RadarCheckSpeedDiff float32 `json:"radarCheckSpeedDiff"` // 雷达测速数值 + RadarCheckTime int32 `json:"radarCheckTime"` // 雷达检测时间(秒) } type ConfigTrainData struct { //Mass int32 `json:"mass" form:"mass"` // 列车的质量(100=1ton) @@ -234,10 +234,11 @@ type BaliseMoveReqDto struct { // BaliseModifyTelegramReqDto 修改应答器报文 type BaliseModifyTelegramReqDto struct { - SimulationId string `json:"simulationId" form:"simulationId"` //仿真ID - MapId int32 `json:"mapId" form:"mapId"` //地图ID - BaliseId uint32 `json:"baliseId" form:"baliseId"` //应答器ID - Telegram string `json:"telegram" from:"telegram"` //报文(16进制字符串) + SimulationId string `json:"simulationId" form:"simulationId"` //仿真ID + MapId int32 `json:"mapId" form:"mapId"` //地图ID + BaliseId uint32 `json:"baliseId" form:"baliseId"` //应答器ID + FixedTelegram string `json:"fixedTelegram" from:"fixedTelegram"` //固定报文(16进制字符串) + FixedUserTelegram string `json:"fixedUserTelegram" from:"fixedUserTelegram"` //固定用户报文(16进制字符串) } // BaliseReqDto 应答器请求 diff --git a/go.mod b/go.mod index aae3ebb..be46fca 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.4.0 github.com/sagikazarmark/slog-shim v0.1.0 - github.com/shopspring/decimal v1.3.1 github.com/spf13/viper v1.18.1 github.com/stretchr/testify v1.8.4 github.com/swaggo/files v1.0.1 @@ -48,7 +47,6 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/simonvetter/modbus v1.6.0 // indirect - github.com/snksoft/crc v1.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/yohamta/donburi v1.3.9 // indirect go.uber.org/atomic v1.9.0 // indirect @@ -97,7 +95,7 @@ require ( golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/protobuf v1.31.0 + google.golang.org/protobuf v1.32.0 gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index ad79ce7..723b2b3 100644 --- a/go.sum +++ b/go.sum @@ -174,12 +174,8 @@ github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6g github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samber/slog-gin v1.1.0 h1:dDvYEGJkJg0DxuNWo6m6gV5Bm+iSk85Ox9on7c7OjQU= github.com/samber/slog-gin v1.1.0/go.mod h1:vmMxOYIqDHbthu7SmiF/oOlMhpYukL62JB4Ct5etOvI= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/simonvetter/modbus v1.6.0 h1:RDHJevtc7LDIVoHAbhDun8fy+QwnGe+ZU+sLm9ZZzjc= github.com/simonvetter/modbus v1.6.0/go.mod h1:hh90ZaTaPLcK2REj6/fpTbiV0J6S7GWmd8q+GVRObPw= -github.com/snksoft/crc v1.1.0 h1:HkLdI4taFlgGGG1KvsWMpz78PkOC9TkPVpTV/cuWn48= -github.com/snksoft/crc v1.1.0/go.mod h1:5/gUOsgAm7OmIhb6WJzw7w5g2zfJi4FrHYgGPdshE+A= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= @@ -297,8 +293,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/message_server/sfp_ms.go b/message_server/sfp_ms.go index ae8d82e..6999206 100644 --- a/message_server/sfp_ms.go +++ b/message_server/sfp_ms.go @@ -1,7 +1,6 @@ package message_server import ( - "encoding/hex" "fmt" "joylink.club/bj-rtsts-server/dto/common_proto" "reflect" @@ -83,9 +82,11 @@ func collectBaliseStates(world ecs.World, mapId int32) ([]*state_proto.BaliseSta for id, structure := range uidStructure.TransponderIds { entry, ok := entity.GetEntityByUid(world, structure.Uid) if ok { + baliseFixedTelegram := component.BaliseFixedTelegramType.Get(entry) baliseState := &state_proto.BaliseState{ - Id: id, - Telegram: hex.EncodeToString(component.BaliseStateType.Get(entry).ValidTelegram), + Id: id, + FixedTelegram: fmt.Sprintf("%X", baliseFixedTelegram.Telegram), + FixedUserTelegram: fmt.Sprintf("%X", baliseFixedTelegram.UserTelegram), } transponderStates = append(transponderStates, baliseState) km := component.KmType.Get(entry) diff --git a/third_party/can_btm/balise_detection.go b/third_party/can_btm/balise_detection.go index e6a4c58..cd390be 100644 --- a/third_party/can_btm/balise_detection.go +++ b/third_party/can_btm/balise_detection.go @@ -121,7 +121,7 @@ func (t *BaliseDetector) rcvTelegram(wd *component.WorldData, baliseId string) [ if !ok { return nil } else { - return component.BaliseStateType.Get(entry).ValidTelegram + return component.BaliseFixedTelegramType.Get(entry).Telegram } } diff --git a/ts/simulation/wayside/memory/wayside_memory_transponder.go b/ts/simulation/wayside/memory/wayside_memory_transponder.go index 793d548..bcef42d 100644 --- a/ts/simulation/wayside/memory/wayside_memory_transponder.go +++ b/ts/simulation/wayside/memory/wayside_memory_transponder.go @@ -128,14 +128,26 @@ func BaliseTelegramModify(simulation *VerifySimulation, req *dto.BaliseModifyTel if !ok { return sys_error.New(fmt.Sprintf("没有[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId)) } - if len(req.Telegram) != 256 { - return sys_error.New(fmt.Sprintf("报文长度必须为[%d]", 256)) + fixedTelegramLen := 256 + if len(req.FixedTelegram) != fixedTelegramLen { + return sys_error.New(fmt.Sprintf("固定报文长度必须为[%d]", fixedTelegramLen)) } - bytes, err := hex.DecodeString(req.Telegram) + fixedUserTelegramLen := 208 + if len(req.FixedUserTelegram) != fixedUserTelegramLen { + return sys_error.New(fmt.Sprintf("固定用户报文长度必须为[%d]", fixedUserTelegramLen)) + } + ft, err := hex.DecodeString(req.FixedTelegram) if err != nil { - return sys_error.New("报文解析出错", err) + return sys_error.New("固定报文解析出错", err) } - component.BaliseStateType.SetValue(entry, component.BaliseState{ValidTelegram: bytes}) + fut, err := hex.DecodeString(req.FixedUserTelegram) + if err != nil { + return sys_error.New("固定用户报文解析出错", err) + } + component.BaliseFixedTelegramType.SetValue(entry, component.BaliseState{ + Telegram: ft, + UserTelegram: fut, + }) return nil } @@ -152,8 +164,8 @@ func BaliseTelegramReset(simulation *VerifySimulation, req *dto.BaliseReqDto) er func baliseTelegramReset(simulation *VerifySimulation, balise *repository.Transponder) error { entry, _ := entity.GetEntityByUid(simulation.World, balise.Id()) - component.BaliseStateType.SetValue(entry, component.BaliseState{ - ValidTelegram: balise.FixedTelegram(), + component.BaliseFixedTelegramType.SetValue(entry, component.BaliseState{ + Telegram: balise.FixedTelegram(), }) return nil } diff --git a/ts/simulation/wayside/memory/wayside_simulation.go b/ts/simulation/wayside/memory/wayside_simulation.go index 4efc6ca..9e95558 100644 --- a/ts/simulation/wayside/memory/wayside_simulation.go +++ b/ts/simulation/wayside/memory/wayside_simulation.go @@ -237,7 +237,7 @@ func (s *VerifySimulation) CollectDynamicsTurnoutInfo() *message.DynamicsTurnout } pos := component.TurnoutPositionType.Get(entry) turnoutState.TurnoutInfos = append(turnoutState.TurnoutInfos, &message.TurnoutInfo{ - Code: 0, + Code: uint16(sta.CommonId), NPosition: pos.Dw, RPosition: pos.Fw, }) @@ -1034,13 +1034,18 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic for _, data := range storage.Transponders { fixedTelegram, err := hex.DecodeString(data.FixedTelegram) if err != nil { - slog.Error(fmt.Sprintf("解析应答器[%s]的报文出错:", err.Error())) + slog.Error(fmt.Sprintf("解析应答器[%s]的固定报文出错:", err.Error())) + } + fixedUserTelegram, err := hex.DecodeString(data.FixedUserTelegram) + if err != nil { + slog.Error(fmt.Sprintf("解析应答器[%s]的固定用户报文出错:", err.Error())) } responder := &proto.Transponder{ - Id: uidsMap.TransponderIds[GetMapElementId(data.Common)].Uid, - Km: convertKm(data.KilometerSystem), - FixedTelegram: fixedTelegram, - Type: convertToProtoBaliseType(data.Type), + Id: uidsMap.TransponderIds[GetMapElementId(data.Common)].Uid, + Km: convertKm(data.KilometerSystem), + FixedTelegram: fixedTelegram, + Type: convertToProtoBaliseType(data.Type), + FixedUserTelegram: fixedUserTelegram, } switch data.TransponderRef.DeviceType { case data_proto.RelatedRef_Section: