计轴区段
This commit is contained in:
parent
aee9a659ba
commit
c54760276f
|
@ -309,7 +309,10 @@ func axleSectionOperation(c *gin.Context) { //操作:设置故障占用、取
|
|||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
memory.ChangeAxleSectionState(simulation, req)
|
||||
err := memory.ChangeAxleSectionState(simulation, req)
|
||||
if err != nil {
|
||||
panic(sys_error.New("操作失败", err))
|
||||
}
|
||||
c.JSON(http.StatusOK, "ok")
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,8 @@ type AxleSectionOperationReqDto struct {
|
|||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
DeviceId string `form:"id" json:"id" binding:"required"`
|
||||
Operation request_proto.Section_Operation `form:"operation" json:"operation"`
|
||||
TrainIn bool `form:"trainIn" json:"trainIn"`
|
||||
TrainOut bool `form:"trainOut" json:"trainOut"`
|
||||
}
|
||||
type EsbButtonOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
|
|
|
@ -2,24 +2,36 @@ package memory
|
|||
|
||||
import (
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
"joylink.club/bj-rtsts-server/dto/request_proto"
|
||||
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
||||
"joylink.club/rtsssimulation/fi"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) {
|
||||
/*
|
||||
sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Section{})
|
||||
slog.Debug("操作计轴区段", "axleSectionUid", sectionUid)
|
||||
switch req.Operation {
|
||||
case request_proto.Section_Drst:
|
||||
fi.DriveAxleSectionDrst(simulation.World, sectionUid, req.Reset)
|
||||
case request_proto.Section_Pdrst:
|
||||
fi.DriveAxleSectionPdrst(simulation.World, sectionUid, req.Reset)
|
||||
func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) error {
|
||||
|
||||
case request_proto.Section_TrainIn:
|
||||
fi.DriveAxleSectionTrainIn(simulation.World, sectionUid)
|
||||
case request_proto.Section_TrainOut:
|
||||
fi.DriveAxleSectionTrainOut(simulation.World, sectionUid)
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Section{})
|
||||
slog.Debug("操作计轴区段", "axleSectionUid", sectionUid)
|
||||
if req.TrainIn {
|
||||
return fi.AxleSectionTrainDrive(simulation.World, sectionUid, true)
|
||||
}
|
||||
if req.TrainOut {
|
||||
return fi.AxleSectionTrainDrive(simulation.World, sectionUid, false)
|
||||
}
|
||||
//
|
||||
switch req.Operation {
|
||||
case request_proto.Section_CancelDrst:
|
||||
return fi.AxleSectionDrstDrive(simulation.World, sectionUid, false)
|
||||
case request_proto.Section_SetDrst:
|
||||
return fi.AxleSectionDrstDrive(simulation.World, sectionUid, true)
|
||||
case request_proto.Section_CancelPdrst:
|
||||
return fi.AxleSectionPdrstDrive(simulation.World, sectionUid, false)
|
||||
case request_proto.Section_SetPdrst:
|
||||
return fi.AxleSectionPdrstDrive(simulation.World, sectionUid, true)
|
||||
case request_proto.Section_CancelFaultOcc:
|
||||
return fi.AxleSectionFaultOccDrive(simulation.World, sectionUid, false)
|
||||
case request_proto.Section_SetFaultOcc:
|
||||
return fi.AxleSectionFaultOccDrive(simulation.World, sectionUid, true)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -98,6 +98,11 @@ func initWorld(s *memory.VerifySimulation) error {
|
|||
|
||||
// 运行仿真第三方模块
|
||||
func runThirdParty(s *memory.VerifySimulation) error {
|
||||
/*
|
||||
if s != nil { //测试时不启动第三方服务
|
||||
return nil
|
||||
}
|
||||
*/
|
||||
// 动力学启动
|
||||
err := dynamics.Default().Start(s)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue