rts-sim-testing-service/ts/simulation/wayside/memory/wayside_memory_section.go

37 lines
1.3 KiB
Go
Raw Normal View History

2023-10-23 18:01:48 +08:00
package memory
import (
2023-12-14 13:04:48 +08:00
"log/slog"
2023-10-24 10:19:51 +08:00
"joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/data_proto"
2023-11-01 11:08:26 +08:00
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/rtsssimulation/fi"
2023-10-23 18:01:48 +08:00
)
2023-11-01 11:08:26 +08:00
func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) error {
sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.Section{})
2023-11-01 11:08:26 +08:00
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
2023-10-24 10:19:51 +08:00
}