Merge branch 'develop' into local-test
This commit is contained in:
commit
c700a78613
@ -51,7 +51,7 @@ jobs:
|
||||
script: |
|
||||
docker rm -f rts-sim-testing-service || echo "rts-sim-testing-service not exist"
|
||||
docker pull gitea.joylink.club/joylink/rts-sim-testing-service:local-test
|
||||
docker run --name rts-sim-testing-service --restart=always --network net --ip 192.168.53.191 -d -p 9091:9091 -p 4000:4000 -v /usr/local/joylink/logs/bjrtsts:/logs/bjrtsts gitea.joylink.club/joylink/rts-sim-testing-service:local-test rts-sim-testing-service -config test_local
|
||||
docker run --name rts-sim-testing-service --restart=always --network net --ip 192.168.53.191 -d -p 9091:9091 -p 4000:4000/udp -v /usr/local/joylink/logs/bjrtsts:/logs/bjrtsts gitea.joylink.club/joylink/rts-sim-testing-service:local-test rts-sim-testing-service -config test_local
|
||||
- name: 清理tag为none的镜像
|
||||
run: |
|
||||
docker rmi $(docker images --filter "dangling=true" -q)
|
@ -239,15 +239,20 @@ func addTrain(c *gin.Context) {
|
||||
if req.TrainId < 0 || req.TrainId >= 255 {
|
||||
panic(sys_error.New("列车编号不能小于0,大于255"))
|
||||
}
|
||||
if req.TrainSpeed < 0 || req.TrainSpeed > 90 {
|
||||
panic(sys_error.New("列车编号不能小于0,大于255"))
|
||||
}
|
||||
rsp := &state_proto.TrainState{
|
||||
Id: fmt.Sprintf("%v", req.TrainId),
|
||||
HeadDeviceId: req.Id,
|
||||
HeadOffset: req.HeadOffset,
|
||||
DevicePort: req.DevicePort,
|
||||
RunDirection: req.RunDirection,
|
||||
Id: fmt.Sprintf("%v", req.TrainId),
|
||||
HeadDeviceId: req.Id,
|
||||
HeadOffset: req.HeadOffset,
|
||||
DevicePort: req.DevicePort,
|
||||
TrainRunUp: req.RunDirection,
|
||||
//RunDirection: req.RunDirection,
|
||||
TrainLength: req.TrainLength,
|
||||
WheelDiameter: req.WheelDiameter,
|
||||
Speed: req.TrainSpeed,
|
||||
Show: true,
|
||||
ConnState: &state_proto.TrainConnState{TrainControlMapId: req.TrainControlMapId, Conn: false, ConnType: state_proto.TrainConnState_NONE},
|
||||
}
|
||||
var err *sys_error.BusinessError = memory.AddTrainStateNew(simulation,
|
||||
|
61
bin/acc_conn-example.go
Normal file
61
bin/acc_conn-example.go
Normal file
@ -0,0 +1,61 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/viper"
|
||||
"joylink.club/bj-rtsts-server/bin/config"
|
||||
"joylink.club/bj-rtsts-server/third_party/message"
|
||||
"joylink.club/bj-rtsts-server/third_party/udp"
|
||||
"log/slog"
|
||||
"time"
|
||||
)
|
||||
|
||||
const config_name = "example"
|
||||
|
||||
var exampleConfig config.ExampleConfig
|
||||
|
||||
func initConfig() {
|
||||
cnf := viper.New()
|
||||
cnf.SetConfigName(config_name)
|
||||
cnf.SetConfigType("yml")
|
||||
cnf.AddConfigPath("./config/")
|
||||
cnf.AddConfigPath(".")
|
||||
err := cnf.ReadInConfig()
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("读取配置文件错误: %w", err))
|
||||
}
|
||||
err = cnf.Unmarshal(&exampleConfig)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("解析配置文件错误: %w", err))
|
||||
}
|
||||
slog.Info("成功加载配置", "config", exampleConfig)
|
||||
}
|
||||
func main() {
|
||||
initConfig()
|
||||
testAcc()
|
||||
}
|
||||
func testAcc() {
|
||||
var client udp.UdpClient
|
||||
defer func() {
|
||||
if client != nil {
|
||||
client.Close()
|
||||
}
|
||||
slog.Info("连接关闭")
|
||||
}()
|
||||
client = udp.NewClient(fmt.Sprintf("%v:%v", exampleConfig.Acc.RemoteIp, exampleConfig.Acc.RemotePort))
|
||||
ac := message.Accelerometer{Acc: 1}
|
||||
var index int64
|
||||
for {
|
||||
err := client.Send(ac.Encode())
|
||||
index++
|
||||
if index%10 == 0 {
|
||||
slog.Info(fmt.Sprintf("发送数据,时间戳:%v,发送次数:%v", time.Now().Unix(), index))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
slog.Error("发送数据失败", "err", err)
|
||||
}
|
||||
time.Sleep(time.Millisecond * 200)
|
||||
}
|
||||
|
||||
}
|
3
bin/config/example.yml
Normal file
3
bin/config/example.yml
Normal file
@ -0,0 +1,3 @@
|
||||
acc:
|
||||
remoteIp: "127.0.0.1"
|
||||
remotePort: 1234
|
9
bin/config/example_config.go
Normal file
9
bin/config/example_config.go
Normal file
@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
type ExampleConfig struct {
|
||||
Acc acc
|
||||
}
|
||||
type acc struct {
|
||||
RemoteIp string
|
||||
RemotePort int
|
||||
}
|
@ -236,7 +236,7 @@ type TrainEndsState struct {
|
||||
SpeedSensorEnableB bool `protobuf:"varint,2,opt,name=speedSensorEnableB,proto3" json:"speedSensorEnableB,omitempty"`
|
||||
// 雷达是否有效
|
||||
RadarEnable bool `protobuf:"varint,3,opt,name=radarEnable,proto3" json:"radarEnable,omitempty"`
|
||||
// 雷达测速差值(米/秒)
|
||||
// 雷达测速差值(千米/小时)
|
||||
RadarCheckSpeedDiff float32 `protobuf:"fixed32,4,opt,name=radarCheckSpeedDiff,proto3" json:"radarCheckSpeedDiff,omitempty"`
|
||||
// 雷达检测时间(秒)
|
||||
RadarCheckTime int32 `protobuf:"varint,5,opt,name=radarCheckTime,proto3" json:"radarCheckTime,omitempty"`
|
||||
@ -246,9 +246,9 @@ type TrainEndsState struct {
|
||||
AccCheckSpeedDiff float32 `protobuf:"fixed32,7,opt,name=accCheckSpeedDiff,proto3" json:"accCheckSpeedDiff,omitempty"`
|
||||
// 加速度持续时间
|
||||
AccCheckTime int32 `protobuf:"varint,8,opt,name=accCheckTime,proto3" json:"accCheckTime,omitempty"`
|
||||
// 速传速度输出(米/秒)
|
||||
// 速传速度输出(千米/小时)
|
||||
AccOutSpeed int32 `protobuf:"varint,9,opt,name=accOutSpeed,proto3" json:"accOutSpeed,omitempty"`
|
||||
// 雷达速度输出(米/秒)
|
||||
// 雷达速度输出(千米/小时)
|
||||
RadarOutSpeed int32 `protobuf:"varint,10,opt,name=radarOutSpeed,proto3" json:"radarOutSpeed,omitempty"`
|
||||
// 记录雷达设置检测时间的时间点,用于计算周期内的数字
|
||||
RadarCheckTimeOverAt int64 `protobuf:"varint,11,opt,name=radarCheckTimeOverAt,proto3" json:"radarCheckTimeOverAt,omitempty"`
|
||||
|
@ -927,7 +927,7 @@ type RtssGraphicStorage struct {
|
||||
TrackSections []*TrackSection `protobuf:"bytes,28,rep,name=trackSections,proto3" json:"trackSections,omitempty"` //轨道区段
|
||||
TrackLogicSections []*TrackLogicSection `protobuf:"bytes,29,rep,name=trackLogicSections,proto3" json:"trackLogicSections,omitempty"` //轨道逻辑区段
|
||||
// UniqueIdType UniqueIdPrefix = 30;//设备唯一编码--前缀
|
||||
UniqueIdPrefix *UniqueIdOfStationLayout `protobuf:"bytes,31,opt,name=UniqueIdPrefix,proto3" json:"UniqueIdPrefix,omitempty"` //设备唯一编码--前缀
|
||||
UniqueIdPrefix *UniqueIdOfStationLayout `protobuf:"bytes,31,opt,name=UniqueIdPrefix,proto3" json:"UniqueIdPrefix,omitempty"` //地图唯一信息
|
||||
KilometerConvertList []*KilometerConvert `protobuf:"bytes,32,rep,name=kilometerConvertList,proto3" json:"kilometerConvertList,omitempty"` //公里标转换列表
|
||||
ScreenDoors []*ScreenDoor `protobuf:"bytes,33,rep,name=screenDoors,proto3" json:"screenDoors,omitempty"`
|
||||
StationRelateDeviceList []*StationRelateDevice `protobuf:"bytes,34,rep,name=stationRelateDeviceList,proto3" json:"stationRelateDeviceList,omitempty"` // 关联设备列表
|
||||
|
@ -587,6 +587,55 @@ func (TrainControl_TrainControlType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_request_proto_rawDescGZIP(), []int{14, 0}
|
||||
}
|
||||
|
||||
type TrainControl_Direction int32
|
||||
|
||||
const (
|
||||
TrainControl_BACKWARD TrainControl_Direction = 0 //后退
|
||||
TrainControl_FORWARD TrainControl_Direction = 1 //前进
|
||||
TrainControl_NEUTRALWARD TrainControl_Direction = 2 //中位
|
||||
)
|
||||
|
||||
// Enum value maps for TrainControl_Direction.
|
||||
var (
|
||||
TrainControl_Direction_name = map[int32]string{
|
||||
0: "BACKWARD",
|
||||
1: "FORWARD",
|
||||
2: "NEUTRALWARD",
|
||||
}
|
||||
TrainControl_Direction_value = map[string]int32{
|
||||
"BACKWARD": 0,
|
||||
"FORWARD": 1,
|
||||
"NEUTRALWARD": 2,
|
||||
}
|
||||
)
|
||||
|
||||
func (x TrainControl_Direction) Enum() *TrainControl_Direction {
|
||||
p := new(TrainControl_Direction)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x TrainControl_Direction) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (TrainControl_Direction) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_request_proto_enumTypes[11].Descriptor()
|
||||
}
|
||||
|
||||
func (TrainControl_Direction) Type() protoreflect.EnumType {
|
||||
return &file_request_proto_enumTypes[11]
|
||||
}
|
||||
|
||||
func (x TrainControl_Direction) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use TrainControl_Direction.Descriptor instead.
|
||||
func (TrainControl_Direction) EnumDescriptor() ([]byte, []int) {
|
||||
return file_request_proto_rawDescGZIP(), []int{14, 1}
|
||||
}
|
||||
|
||||
type Ckm_Operation int32
|
||||
|
||||
const (
|
||||
@ -617,11 +666,11 @@ func (x Ckm_Operation) String() string {
|
||||
}
|
||||
|
||||
func (Ckm_Operation) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_request_proto_enumTypes[11].Descriptor()
|
||||
return file_request_proto_enumTypes[12].Descriptor()
|
||||
}
|
||||
|
||||
func (Ckm_Operation) Type() protoreflect.EnumType {
|
||||
return &file_request_proto_enumTypes[11]
|
||||
return &file_request_proto_enumTypes[12]
|
||||
}
|
||||
|
||||
func (x Ckm_Operation) Number() protoreflect.EnumNumber {
|
||||
@ -666,11 +715,11 @@ func (x Ckm_Force) String() string {
|
||||
}
|
||||
|
||||
func (Ckm_Force) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_request_proto_enumTypes[12].Descriptor()
|
||||
return file_request_proto_enumTypes[13].Descriptor()
|
||||
}
|
||||
|
||||
func (Ckm_Force) Type() protoreflect.EnumType {
|
||||
return &file_request_proto_enumTypes[12]
|
||||
return &file_request_proto_enumTypes[13]
|
||||
}
|
||||
|
||||
func (x Ckm_Force) Number() protoreflect.EnumNumber {
|
||||
@ -712,11 +761,11 @@ func (x Ckm_Fault) String() string {
|
||||
}
|
||||
|
||||
func (Ckm_Fault) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_request_proto_enumTypes[13].Descriptor()
|
||||
return file_request_proto_enumTypes[14].Descriptor()
|
||||
}
|
||||
|
||||
func (Ckm_Fault) Type() protoreflect.EnumType {
|
||||
return &file_request_proto_enumTypes[13]
|
||||
return &file_request_proto_enumTypes[14]
|
||||
}
|
||||
|
||||
func (x Ckm_Fault) Number() protoreflect.EnumNumber {
|
||||
@ -758,11 +807,11 @@ func (x Xcj_Operation) String() string {
|
||||
}
|
||||
|
||||
func (Xcj_Operation) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_request_proto_enumTypes[14].Descriptor()
|
||||
return file_request_proto_enumTypes[15].Descriptor()
|
||||
}
|
||||
|
||||
func (Xcj_Operation) Type() protoreflect.EnumType {
|
||||
return &file_request_proto_enumTypes[14]
|
||||
return &file_request_proto_enumTypes[15]
|
||||
}
|
||||
|
||||
func (x Xcj_Operation) Number() protoreflect.EnumNumber {
|
||||
@ -804,11 +853,11 @@ func (x Xcj_Fault) String() string {
|
||||
}
|
||||
|
||||
func (Xcj_Fault) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_request_proto_enumTypes[15].Descriptor()
|
||||
return file_request_proto_enumTypes[16].Descriptor()
|
||||
}
|
||||
|
||||
func (Xcj_Fault) Type() protoreflect.EnumType {
|
||||
return &file_request_proto_enumTypes[15]
|
||||
return &file_request_proto_enumTypes[16]
|
||||
}
|
||||
|
||||
func (x Xcj_Fault) Number() protoreflect.EnumNumber {
|
||||
@ -2386,7 +2435,7 @@ var file_request_proto_rawDesc = []byte{
|
||||
0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x2e, 0x50, 0x73, 0x64, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c,
|
||||
0x74, 0x22, 0xb3, 0x05, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x74, 0x22, 0xec, 0x05, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x49,
|
||||
@ -2429,59 +2478,62 @@ var file_request_proto_rawDesc = []byte{
|
||||
0x56, 0x45, 0x52, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x57, 0x49, 0x54, 0x43, 0x48, 0x10, 0x01,
|
||||
0x12, 0x18, 0x0a, 0x14, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4b, 0x45,
|
||||
0x59, 0x5f, 0x53, 0x57, 0x49, 0x54, 0x43, 0x48, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x41,
|
||||
0x4e, 0x44, 0x4c, 0x45, 0x52, 0x10, 0x03, 0x22, 0xc6, 0x01, 0x0a, 0x0f, 0x43, 0x6b, 0x6d, 0x4f,
|
||||
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73,
|
||||
0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
|
||||
0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49,
|
||||
0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43,
|
||||
0x6b, 0x6d, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70,
|
||||
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x2e, 0x43, 0x6b, 0x6d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x22, 0x82, 0x01, 0x0a, 0x03, 0x43, 0x6b, 0x6d, 0x22, 0x29, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e,
|
||||
0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x73, 0x10, 0x01, 0x22, 0x27, 0x0a, 0x05, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x0a, 0x0a, 0x06,
|
||||
0x46, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x5f, 0x4b, 0x4d,
|
||||
0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x5f, 0x47, 0x4d, 0x10, 0x02, 0x22, 0x27, 0x0a, 0x05,
|
||||
0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41, 0x5f, 0x4e, 0x4f, 0x4e, 0x45,
|
||||
0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x41, 0x5f, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x4c,
|
||||
0x6f, 0x73, 0x73, 0x10, 0x01, 0x22, 0x5e, 0x0a, 0x08, 0x43, 0x6b, 0x6d, 0x50, 0x61, 0x72, 0x61,
|
||||
0x6d, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,
|
||||
0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x2e, 0x46,
|
||||
0x6f, 0x72, 0x63, 0x65, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66,
|
||||
0x61, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05,
|
||||
0x66, 0x61, 0x75, 0x6c, 0x74, 0x22, 0xc6, 0x01, 0x0a, 0x0f, 0x58, 0x63, 0x6a, 0x4f, 0x70, 0x65,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d,
|
||||
0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61,
|
||||
0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12,
|
||||
0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a,
|
||||
0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58,
|
||||
0x63, 0x6a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x54,
|
||||
0x0a, 0x03, 0x58, 0x63, 0x6a, 0x22, 0x29, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10,
|
||||
0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0x01,
|
||||
0x22, 0x22, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41, 0x5f,
|
||||
0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x41, 0x5f, 0x46, 0x61, 0x75,
|
||||
0x6c, 0x74, 0x10, 0x01, 0x22, 0x34, 0x0a, 0x08, 0x58, 0x63, 0x6a, 0x50, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||
0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x2e, 0x46, 0x61,
|
||||
0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x42, 0x30, 0x5a, 0x2e, 0x6a, 0x6f,
|
||||
0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74,
|
||||
0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x4e, 0x44, 0x4c, 0x45, 0x52, 0x10, 0x03, 0x22, 0x37, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x43, 0x4b, 0x57, 0x41, 0x52, 0x44,
|
||||
0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x4f, 0x52, 0x57, 0x41, 0x52, 0x44, 0x10, 0x01, 0x12,
|
||||
0x0f, 0x0a, 0x0b, 0x4e, 0x45, 0x55, 0x54, 0x52, 0x41, 0x4c, 0x57, 0x41, 0x52, 0x44, 0x10, 0x02,
|
||||
0x22, 0xc6, 0x01, 0x0a, 0x0f, 0x43, 0x6b, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75,
|
||||
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d,
|
||||
0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70,
|
||||
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e,
|
||||
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x2e, 0x4f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x11, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x50, 0x61, 0x72,
|
||||
0x61, 0x6d, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x82, 0x01, 0x0a, 0x03, 0x43, 0x6b,
|
||||
0x6d, 0x22, 0x29, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d,
|
||||
0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a,
|
||||
0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0x01, 0x22, 0x27, 0x0a, 0x05,
|
||||
0x46, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10,
|
||||
0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x5f, 0x4b, 0x4d, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x46,
|
||||
0x5f, 0x47, 0x4d, 0x10, 0x02, 0x22, 0x27, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x0b,
|
||||
0x0a, 0x07, 0x46, 0x41, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x46,
|
||||
0x41, 0x5f, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x4c, 0x6f, 0x73, 0x73, 0x10, 0x01, 0x22, 0x5e,
|
||||
0x0a, 0x08, 0x43, 0x6b, 0x6d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x6f,
|
||||
0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x2e, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x52, 0x05, 0x66,
|
||||
0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b,
|
||||
0x6d, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x22, 0xc6,
|
||||
0x01, 0x0a, 0x0f, 0x58, 0x63, 0x6a, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
||||
0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08,
|
||||
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27,
|
||||
0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e,
|
||||
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x50, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x54, 0x0a, 0x03, 0x58, 0x63, 0x6a, 0x22, 0x29,
|
||||
0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55,
|
||||
0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x65,
|
||||
0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0x01, 0x22, 0x22, 0x0a, 0x05, 0x46, 0x61, 0x75,
|
||||
0x6c, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12,
|
||||
0x0c, 0x0a, 0x08, 0x46, 0x41, 0x5f, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x10, 0x01, 0x22, 0x34, 0x0a,
|
||||
0x08, 0x58, 0x63, 0x6a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75,
|
||||
0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61,
|
||||
0x75, 0x6c, 0x74, 0x42, 0x30, 0x5a, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63,
|
||||
0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -2496,7 +2548,7 @@ func file_request_proto_rawDescGZIP() []byte {
|
||||
return file_request_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 16)
|
||||
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 17)
|
||||
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 25)
|
||||
var file_request_proto_goTypes = []interface{}{
|
||||
(Relay_Operation)(0), // 0: request.Relay.Operation
|
||||
@ -2510,64 +2562,65 @@ var file_request_proto_goTypes = []interface{}{
|
||||
(Psd_Force)(0), // 8: request.Psd.Force
|
||||
(Psd_Fault)(0), // 9: request.Psd.Fault
|
||||
(TrainControl_TrainControlType)(0), // 10: request.TrainControl.TrainControlType
|
||||
(Ckm_Operation)(0), // 11: request.Ckm.Operation
|
||||
(Ckm_Force)(0), // 12: request.Ckm.Force
|
||||
(Ckm_Fault)(0), // 13: request.Ckm.Fault
|
||||
(Xcj_Operation)(0), // 14: request.Xcj.Operation
|
||||
(Xcj_Fault)(0), // 15: request.Xcj.Fault
|
||||
(*Relay)(nil), // 16: request.Relay
|
||||
(*RelayOperationReq)(nil), // 17: request.RelayOperationReq
|
||||
(*Points)(nil), // 18: request.Points
|
||||
(*PointsOperationReq)(nil), // 19: request.PointsOperationReq
|
||||
(*PointsParam)(nil), // 20: request.PointsParam
|
||||
(*Signal)(nil), // 21: request.Signal
|
||||
(*SignalOperationReq)(nil), // 22: request.SignalOperationReq
|
||||
(*SignalParam)(nil), // 23: request.SignalParam
|
||||
(*Section)(nil), // 24: request.Section
|
||||
(*SectionOperationReq)(nil), // 25: request.SectionOperationReq
|
||||
(*SectionParam)(nil), // 26: request.SectionParam
|
||||
(*Psd)(nil), // 27: request.Psd
|
||||
(*PsdOperationReq)(nil), // 28: request.PsdOperationReq
|
||||
(*PsdParam)(nil), // 29: request.PsdParam
|
||||
(*TrainControl)(nil), // 30: request.TrainControl
|
||||
(*CkmOperationReq)(nil), // 31: request.CkmOperationReq
|
||||
(*Ckm)(nil), // 32: request.Ckm
|
||||
(*CkmParam)(nil), // 33: request.CkmParam
|
||||
(*XcjOperationReq)(nil), // 34: request.XcjOperationReq
|
||||
(*Xcj)(nil), // 35: request.Xcj
|
||||
(*XcjParam)(nil), // 36: request.XcjParam
|
||||
(*TrainControl_EmergentButton)(nil), // 37: request.TrainControl.EmergentButton
|
||||
(*TrainControl_DriverKeySwitch)(nil), // 38: request.TrainControl.DriverKeySwitch
|
||||
(*TrainControl_DirectionKeySwitch)(nil), // 39: request.TrainControl.DirectionKeySwitch
|
||||
(*TrainControl_PushHandler)(nil), // 40: request.TrainControl.PushHandler
|
||||
(TrainControl_Direction)(0), // 11: request.TrainControl.Direction
|
||||
(Ckm_Operation)(0), // 12: request.Ckm.Operation
|
||||
(Ckm_Force)(0), // 13: request.Ckm.Force
|
||||
(Ckm_Fault)(0), // 14: request.Ckm.Fault
|
||||
(Xcj_Operation)(0), // 15: request.Xcj.Operation
|
||||
(Xcj_Fault)(0), // 16: request.Xcj.Fault
|
||||
(*Relay)(nil), // 17: request.Relay
|
||||
(*RelayOperationReq)(nil), // 18: request.RelayOperationReq
|
||||
(*Points)(nil), // 19: request.Points
|
||||
(*PointsOperationReq)(nil), // 20: request.PointsOperationReq
|
||||
(*PointsParam)(nil), // 21: request.PointsParam
|
||||
(*Signal)(nil), // 22: request.Signal
|
||||
(*SignalOperationReq)(nil), // 23: request.SignalOperationReq
|
||||
(*SignalParam)(nil), // 24: request.SignalParam
|
||||
(*Section)(nil), // 25: request.Section
|
||||
(*SectionOperationReq)(nil), // 26: request.SectionOperationReq
|
||||
(*SectionParam)(nil), // 27: request.SectionParam
|
||||
(*Psd)(nil), // 28: request.Psd
|
||||
(*PsdOperationReq)(nil), // 29: request.PsdOperationReq
|
||||
(*PsdParam)(nil), // 30: request.PsdParam
|
||||
(*TrainControl)(nil), // 31: request.TrainControl
|
||||
(*CkmOperationReq)(nil), // 32: request.CkmOperationReq
|
||||
(*Ckm)(nil), // 33: request.Ckm
|
||||
(*CkmParam)(nil), // 34: request.CkmParam
|
||||
(*XcjOperationReq)(nil), // 35: request.XcjOperationReq
|
||||
(*Xcj)(nil), // 36: request.Xcj
|
||||
(*XcjParam)(nil), // 37: request.XcjParam
|
||||
(*TrainControl_EmergentButton)(nil), // 38: request.TrainControl.EmergentButton
|
||||
(*TrainControl_DriverKeySwitch)(nil), // 39: request.TrainControl.DriverKeySwitch
|
||||
(*TrainControl_DirectionKeySwitch)(nil), // 40: request.TrainControl.DirectionKeySwitch
|
||||
(*TrainControl_PushHandler)(nil), // 41: request.TrainControl.PushHandler
|
||||
}
|
||||
var file_request_proto_depIdxs = []int32{
|
||||
0, // 0: request.RelayOperationReq.operation:type_name -> request.Relay.Operation
|
||||
1, // 1: request.PointsOperationReq.operation:type_name -> request.Points.Operation
|
||||
20, // 2: request.PointsOperationReq.param:type_name -> request.PointsParam
|
||||
21, // 2: request.PointsOperationReq.param:type_name -> request.PointsParam
|
||||
2, // 3: request.PointsParam.forcePosition:type_name -> request.Points.Force
|
||||
3, // 4: request.SignalOperationReq.operation:type_name -> request.Signal.Operation
|
||||
23, // 5: request.SignalOperationReq.param:type_name -> request.SignalParam
|
||||
24, // 5: request.SignalOperationReq.param:type_name -> request.SignalParam
|
||||
5, // 6: request.SignalParam.force:type_name -> request.Signal.Force
|
||||
4, // 7: request.SignalParam.dsList:type_name -> request.Signal.DS
|
||||
6, // 8: request.SectionOperationReq.operation:type_name -> request.Section.Operation
|
||||
26, // 9: request.SectionOperationReq.param:type_name -> request.SectionParam
|
||||
27, // 9: request.SectionOperationReq.param:type_name -> request.SectionParam
|
||||
7, // 10: request.PsdOperationReq.operation:type_name -> request.Psd.Operation
|
||||
29, // 11: request.PsdOperationReq.param:type_name -> request.PsdParam
|
||||
30, // 11: request.PsdOperationReq.param:type_name -> request.PsdParam
|
||||
8, // 12: request.PsdParam.force:type_name -> request.Psd.Force
|
||||
9, // 13: request.PsdParam.fault:type_name -> request.Psd.Fault
|
||||
10, // 14: request.TrainControl.controlType:type_name -> request.TrainControl.TrainControlType
|
||||
37, // 15: request.TrainControl.button:type_name -> request.TrainControl.EmergentButton
|
||||
38, // 16: request.TrainControl.driverKey:type_name -> request.TrainControl.DriverKeySwitch
|
||||
39, // 17: request.TrainControl.dirKey:type_name -> request.TrainControl.DirectionKeySwitch
|
||||
40, // 18: request.TrainControl.handler:type_name -> request.TrainControl.PushHandler
|
||||
11, // 19: request.CkmOperationReq.operation:type_name -> request.Ckm.Operation
|
||||
33, // 20: request.CkmOperationReq.param:type_name -> request.CkmParam
|
||||
12, // 21: request.CkmParam.force:type_name -> request.Ckm.Force
|
||||
13, // 22: request.CkmParam.fault:type_name -> request.Ckm.Fault
|
||||
14, // 23: request.XcjOperationReq.operation:type_name -> request.Xcj.Operation
|
||||
36, // 24: request.XcjOperationReq.param:type_name -> request.XcjParam
|
||||
15, // 25: request.XcjParam.fault:type_name -> request.Xcj.Fault
|
||||
38, // 15: request.TrainControl.button:type_name -> request.TrainControl.EmergentButton
|
||||
39, // 16: request.TrainControl.driverKey:type_name -> request.TrainControl.DriverKeySwitch
|
||||
40, // 17: request.TrainControl.dirKey:type_name -> request.TrainControl.DirectionKeySwitch
|
||||
41, // 18: request.TrainControl.handler:type_name -> request.TrainControl.PushHandler
|
||||
12, // 19: request.CkmOperationReq.operation:type_name -> request.Ckm.Operation
|
||||
34, // 20: request.CkmOperationReq.param:type_name -> request.CkmParam
|
||||
13, // 21: request.CkmParam.force:type_name -> request.Ckm.Force
|
||||
14, // 22: request.CkmParam.fault:type_name -> request.Ckm.Fault
|
||||
15, // 23: request.XcjOperationReq.operation:type_name -> request.Xcj.Operation
|
||||
37, // 24: request.XcjOperationReq.param:type_name -> request.XcjParam
|
||||
16, // 25: request.XcjParam.fault:type_name -> request.Xcj.Fault
|
||||
26, // [26:26] is the sub-list for method output_type
|
||||
26, // [26:26] is the sub-list for method input_type
|
||||
26, // [26:26] is the sub-list for extension type_name
|
||||
@ -2887,7 +2940,7 @@ func file_request_proto_init() {
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_request_proto_rawDesc,
|
||||
NumEnums: 16,
|
||||
NumEnums: 17,
|
||||
NumMessages: 25,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
|
File diff suppressed because it is too large
Load Diff
12
go.mod
12
go.mod
@ -4,7 +4,8 @@ go 1.21
|
||||
|
||||
require (
|
||||
github.com/appleboy/gin-jwt/v2 v2.9.1
|
||||
github.com/eclipse/paho.golang v0.12.0
|
||||
//github.com/eclipse/paho.golang v0.12.0
|
||||
github.com/eclipse/paho.golang v0.21.0
|
||||
github.com/gin-contrib/cors v1.4.0
|
||||
github.com/golang/protobuf v1.5.3
|
||||
github.com/google/uuid v1.4.0
|
||||
@ -40,7 +41,7 @@ require (
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/goburrow/serial v0.1.0 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.1 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
@ -54,7 +55,6 @@ require (
|
||||
go.uber.org/multierr v1.9.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
|
||||
golang.org/x/mod v0.12.0 // indirect
|
||||
golang.org/x/sync v0.5.0 // indirect
|
||||
golang.org/x/tools v0.13.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c // indirect
|
||||
@ -92,9 +92,9 @@ require (
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.16.0 // indirect
|
||||
golang.org/x/net v0.19.0 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
golang.org/x/crypto v0.19.0 // indirect
|
||||
golang.org/x/net v0.21.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/protobuf v1.32.0
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
|
20
go.sum
20
go.sum
@ -17,8 +17,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/eclipse/paho.golang v0.12.0 h1:EXQFJbJklDnUqW6lyAknMWRhM2NgpHxwrrL8riUmp3Q=
|
||||
github.com/eclipse/paho.golang v0.12.0/go.mod h1:TSDCUivu9JnoR9Hl+H7sQMcHkejWH2/xKK1NJGtLbIE=
|
||||
github.com/eclipse/paho.golang v0.21.0 h1:cxxEReu+iFbA5RrHfRGxJOh8tXZKDywuehneoeBeyn8=
|
||||
github.com/eclipse/paho.golang v0.21.0/go.mod h1:GHF6vy7SvDbDHBguaUpfuBkEB5G6j0zKxMG4gbh6QRQ=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
@ -85,8 +85,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
|
||||
@ -237,8 +237,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
|
||||
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
|
||||
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
@ -251,8 +251,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
||||
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
|
||||
@ -270,8 +270,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
|
||||
|
@ -176,6 +176,7 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
||||
github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o=
|
||||
github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw=
|
||||
@ -267,10 +268,14 @@ golang.org/x/image v0.1.0 h1:r8Oj8ZA2Xy12/b5KZYj3tuv7NG/fBz3TwQVvpJ9l8Rk=
|
||||
golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c=
|
||||
golang.org/x/mobile v0.0.0-20221012134814-c746ac228303 h1:K4fp1rDuJBz0FCPAWzIJwnzwNEM7S6yobdZzMrZ/Zws=
|
||||
golang.org/x/mobile v0.0.0-20221012134814-c746ac228303/go.mod h1:M32cGdzp91A8Ex9qQtyZinr19EYxzkFqDjW2oyHzTDQ=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ=
|
||||
golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM=
|
||||
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
|
||||
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
|
||||
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
|
||||
|
@ -293,6 +293,14 @@ func handlerSectionState(w ecs.World, uid string) *state_proto.SectionState {
|
||||
}
|
||||
}
|
||||
return sectionState
|
||||
} else if entry.HasComponent(component.TrackCircuitType) { //轨道电路
|
||||
sectionState := &state_proto.SectionState{
|
||||
Occupied: component.BitStateType.Get(component.TrackCircuitType.Get(entry).GJ).Val,
|
||||
AxleFault: false,
|
||||
AxleDrst: false,
|
||||
AxlePdrst: false,
|
||||
}
|
||||
return sectionState
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -435,20 +443,20 @@ func collectTrainStates(vs *memory.VerifySimulation) ([]*state_proto.TrainMapSta
|
||||
|
||||
func convertTrainState(v *state_proto.TrainState) *state_proto.TrainMapState {
|
||||
t := &state_proto.TrainMapState{
|
||||
Id: v.Id,
|
||||
Up: v.Up,
|
||||
InitialSpeed: v.Speed,
|
||||
TrainLength: v.TrainLength,
|
||||
Show: v.Show,
|
||||
HeadDeviceId: v.HeadDeviceId,
|
||||
HeadOffset: v.HeadOffset,
|
||||
DevicePort: v.DevicePort,
|
||||
PointTo: v.PointTo,
|
||||
RunDirection: v.RunDirection,
|
||||
HeadDirection: v.HeadDirection,
|
||||
TrainKilometer: v.TrainKilometer,
|
||||
ControlDelayTime: v.ControlDelayTime,
|
||||
WheelDiameter: v.WheelDiameter,
|
||||
Id: v.Id,
|
||||
Up: v.Up,
|
||||
InitialSpeed: v.Speed,
|
||||
TrainLength: v.TrainLength,
|
||||
Show: v.Show,
|
||||
HeadDeviceId: v.HeadDeviceId,
|
||||
HeadOffset: v.HeadOffset,
|
||||
DevicePort: v.DevicePort,
|
||||
DriftTo: v.DriftTo,
|
||||
TrainRunUp: v.TrainRunUp,
|
||||
TrainActiveDirection: v.TrainActiveDirection,
|
||||
TrainKilometer: v.TrainKilometer,
|
||||
ControlDelayTime: v.ControlDelayTime,
|
||||
WheelDiameter: v.WheelDiameter,
|
||||
// 动力学
|
||||
DynamicHeartbeat: v.DynamicState.Heartbeat,
|
||||
HeadLinkId: v.DynamicState.HeadLinkId,
|
||||
|
@ -29,10 +29,15 @@ func Startup(cmc *MqttOptions) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cm, err := autopaho.NewConnection(context.Background(), *cc)
|
||||
ctx := context.Background()
|
||||
cm, err := autopaho.NewConnection(ctx, *cc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//添加等待连接,如果连接失败,则等待重连
|
||||
if err = cm.AwaitConnection(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mqttClient = &MqttClient{cc: cc, cm: cm}
|
||||
return nil
|
||||
}
|
||||
@ -90,6 +95,20 @@ func (client *MqttClient) pub(topic string, data protoreflect.ProtoMessage) erro
|
||||
return err
|
||||
}
|
||||
|
||||
// 订阅mqtt服务
|
||||
/*func subHandle(p *paho.Publish) {
|
||||
fmt.Println(fmt.Sprintf("%v-%v"), hex.EncodeToString(p.Payload), len(p.Payload))
|
||||
}
|
||||
func (client *MqttClient) SubSimulationState(simulationId string) (*paho.Suback, error) {
|
||||
topIc := GetStateTopic(simulationId)
|
||||
_, err2 := client.cm.Subscribe(context.Background(), &paho.Subscribe{Subscriptions: []paho.SubscribeOptions{{Topic: topIc, QoS: 0}}})
|
||||
if err2 != nil {
|
||||
fmt.Println(err2)
|
||||
}
|
||||
client.cc.Router.RegisterHandler(topIc, subHandle)
|
||||
return nil, nil
|
||||
}*/
|
||||
|
||||
// 发送仿真状态数据
|
||||
func (client *MqttClient) PubSimulationState(simulationId string, msg *state_proto.SimulationStatus) error {
|
||||
return client.pub(GetStateTopic(simulationId), msg)
|
||||
|
@ -22,6 +22,7 @@ type MqttOptions struct {
|
||||
KeepAlive uint16 // 保活时间间隔,单位s,默认为60
|
||||
ConnectRetryDelay uint16 // 连接重试延时,单位s,默认为3
|
||||
ConnectTimeout uint16 // 连接操作超时,单位s,默认为3
|
||||
route *paho.StandardRouter
|
||||
}
|
||||
|
||||
func NewMqttOptions(address, username, password string) *MqttOptions {
|
||||
@ -53,6 +54,7 @@ func (c *MqttOptions) tryInto() (*autopaho.ClientConfig, error) {
|
||||
if c.ConnectTimeout == 0 {
|
||||
c.ConnectTimeout = 3
|
||||
}
|
||||
router := paho.NewStandardRouter()
|
||||
cc := &autopaho.ClientConfig{
|
||||
BrokerUrls: []*url.URL{
|
||||
addr,
|
||||
@ -73,8 +75,15 @@ func (c *MqttOptions) tryInto() (*autopaho.ClientConfig, error) {
|
||||
OnServerDisconnect: func(d *paho.Disconnect) {
|
||||
fmt.Printf("%s 连接断开; reason code: %d,properties: %v\n", c.ClientId, d.ReasonCode, d.Properties)
|
||||
},
|
||||
//添加订阅路由功能,以支持订阅
|
||||
OnPublishReceived: []func(paho.PublishReceived) (bool, error){
|
||||
func(pr paho.PublishReceived) (bool, error) {
|
||||
router.Route(pr.Packet.Packet())
|
||||
return true, nil // we assume that the router handles all messages (todo: amend router API)
|
||||
}},
|
||||
},
|
||||
}
|
||||
cc.SetUsernamePassword(c.Username, []byte(c.Password))
|
||||
c.route = router
|
||||
return cc, nil
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8ccd46aa6c97a933fd12c7b308da929115c9aa8e
|
||||
Subproject commit 468cc7896408951a5627777aa862a58716642317
|
@ -1 +1 @@
|
||||
Subproject commit 121134778a38df672562fd8d1acb1482a327702f
|
||||
Subproject commit aac1484a6f64cc43146cabd89784b92c933a0298
|
2
third_party/dynamics/dynamics.go
vendored
2
third_party/dynamics/dynamics.go
vendored
@ -133,6 +133,7 @@ func (d *dynamics) requestStartSimulation(base *message.LineBaseInfo) error {
|
||||
}
|
||||
url := d.buildUrl("/api/start/")
|
||||
data, _ := json.Marshal(base)
|
||||
fmt.Println(string(data))
|
||||
resp, err := d.httpClient.Post(url, "application/json", bytes.NewBuffer(data))
|
||||
if err != nil {
|
||||
return sys_error.New("动力学开始仿真请求发送错误", err)
|
||||
@ -171,6 +172,7 @@ func (d *dynamics) RequestAddTrain(info *message.InitTrainInfo) error {
|
||||
}
|
||||
url := d.buildUrl("/api/aerodynamics/init/train/")
|
||||
data, _ := json.Marshal(info)
|
||||
fmt.Println(string(data))
|
||||
resp, err := d.httpClient.Post(url, "application/json", bytes.NewBuffer(data))
|
||||
if err != nil {
|
||||
return fmt.Errorf("动力学添加列车请求异常: %v", err)
|
||||
|
23
third_party/interlock/beijing11/beijing11_const.go
vendored
Normal file
23
third_party/interlock/beijing11/beijing11_const.go
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
package beijing11
|
||||
|
||||
var (
|
||||
FrameHead byte = 0x0E //帧头
|
||||
FrameTail byte = 0x0E //帧尾
|
||||
ControlWord = controlWord{
|
||||
HeartBeat: 0x00,
|
||||
ReadRegister: 0x01,
|
||||
WriteRegister: 0x02,
|
||||
Response: 0x03,
|
||||
Upstream: 0x06,
|
||||
DownStream: 0x07,
|
||||
}
|
||||
)
|
||||
|
||||
type controlWord struct {
|
||||
HeartBeat byte //心跳
|
||||
ReadRegister byte //读寄存器
|
||||
WriteRegister byte //写寄存器
|
||||
Response byte //回复
|
||||
Upstream byte //上行流数据
|
||||
DownStream byte //下行流数据
|
||||
}
|
126
third_party/interlock/beijing11/interlock.go
vendored
Normal file
126
third_party/interlock/beijing11/interlock.go
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
// Package beijing11 北京11号线联锁通信
|
||||
package beijing11
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"joylink.club/bj-rtsts-server/config"
|
||||
"joylink.club/bj-rtsts-server/third_party/udp"
|
||||
"log/slog"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
initMutex = sync.Mutex{}
|
||||
interlockMap = make(map[string]*InterlockProxy)
|
||||
logTag = "[北京11号线联锁通信]"
|
||||
)
|
||||
|
||||
func GetInstant(c *config.InterlockConfig, msgManager MsgManager) *InterlockProxy {
|
||||
initMutex.Lock()
|
||||
defer initMutex.Unlock()
|
||||
if interlockMap[c.Code] == nil {
|
||||
interlockMap[c.Code] = &InterlockProxy{runConfig: c, msgManager: msgManager}
|
||||
}
|
||||
return interlockMap[c.Code]
|
||||
}
|
||||
|
||||
type MsgManager interface {
|
||||
HandleReadRegisterMsg(req *ReadRegisterReq) (*ReadRegisterRes, error)
|
||||
HandleWriteRegisterMsg(req *WriteRegisterReq) error
|
||||
HandleDownstreamMsg(data []byte) error
|
||||
CollectUpstreamMsg() []byte
|
||||
}
|
||||
|
||||
type msgManager struct {
|
||||
}
|
||||
|
||||
type InterlockProxy struct {
|
||||
runConfig *config.InterlockConfig //联锁通信配置
|
||||
msgManager MsgManager //消息获取与处理接口0
|
||||
client udp.UdpClient //向上位机发送数据的UDP客户端
|
||||
server udp.UdpServer //接收上位机数据的UDP服务端
|
||||
running bool //此服务正在运行的标志
|
||||
}
|
||||
|
||||
func (i *InterlockProxy) Start() {
|
||||
if i.runConfig == nil || i.runConfig.Ip == "" || !i.runConfig.Open {
|
||||
return
|
||||
}
|
||||
if i.running {
|
||||
panic("启动联锁消息服务错误: 存在正在运行的任务")
|
||||
}
|
||||
//UDP通信设施
|
||||
i.server = udp.NewServer(fmt.Sprintf(":%d", i.runConfig.LocalPort), i.handleUpperData)
|
||||
err := i.server.Listen()
|
||||
if err != nil {
|
||||
panic("启动联锁消息服务错误:无法启动UDP服务")
|
||||
}
|
||||
i.running = true
|
||||
i.client = udp.NewClient(fmt.Sprintf("%v:%v", i.runConfig.Ip, i.runConfig.RemotePort))
|
||||
}
|
||||
|
||||
// 处理来自上位机的数据
|
||||
func (i *InterlockProxy) handleUpperData(data []byte) {
|
||||
baseData := &BaseStruct{}
|
||||
err := baseData.Decode(data)
|
||||
if err != nil {
|
||||
slog.Error(logTag + "数据解析出错:" + err.Error())
|
||||
return
|
||||
}
|
||||
switch baseData.ControlWord {
|
||||
case ControlWord.ReadRegister:
|
||||
req := &ReadRegisterReq{}
|
||||
err := req.Decode(baseData.Data)
|
||||
if err != nil {
|
||||
slog.Error(logTag + "读寄存器数据解析出错:" + err.Error())
|
||||
return
|
||||
}
|
||||
res, err := i.msgManager.HandleReadRegisterMsg(req)
|
||||
if err != nil {
|
||||
slog.Error(logTag + "读寄存器数据处理出错:" + err.Error())
|
||||
return
|
||||
}
|
||||
resData := &BaseStruct{
|
||||
ID: baseData.ID,
|
||||
ControlWord: ControlWord.Response,
|
||||
Data: res.Encode(),
|
||||
}
|
||||
i.SendToUpper(resData.Encode())
|
||||
case ControlWord.WriteRegister:
|
||||
req := &WriteRegisterReq{}
|
||||
err := req.Decode(baseData.Data)
|
||||
if err != nil {
|
||||
slog.Error(logTag + "写寄存器数据解析出错:" + err.Error())
|
||||
return
|
||||
}
|
||||
err = i.msgManager.HandleWriteRegisterMsg(req)
|
||||
if err != nil {
|
||||
slog.Error(logTag + "写寄存器数据处理出错:" + err.Error())
|
||||
return
|
||||
}
|
||||
case ControlWord.DownStream:
|
||||
err = i.msgManager.HandleDownstreamMsg(baseData.Data)
|
||||
if err != nil {
|
||||
slog.Error(logTag + "下行数据处理出错:" + err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InterlockProxy) SendToUpper(data []byte) {
|
||||
err := i.client.Send(data)
|
||||
slog.Error(logTag + "向上位机发送数据失败:" + err.Error())
|
||||
}
|
||||
|
||||
func (i *InterlockProxy) Stop() {
|
||||
initMutex.Lock()
|
||||
defer initMutex.Unlock()
|
||||
delete(interlockMap, i.runConfig.Code)
|
||||
if i.client != nil {
|
||||
i.client.Close()
|
||||
}
|
||||
if i.server != nil {
|
||||
i.server.Close()
|
||||
}
|
||||
i.running = false
|
||||
}
|
86
third_party/interlock/beijing11/msg.go
vendored
Normal file
86
third_party/interlock/beijing11/msg.go
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
package beijing11
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
)
|
||||
|
||||
type BaseStruct struct {
|
||||
ID byte
|
||||
ControlWord byte
|
||||
Data []byte
|
||||
}
|
||||
|
||||
func (m *BaseStruct) Decode(buf []byte) error {
|
||||
if buf[0] != FrameHead {
|
||||
return sys_error.New(logTag + "帧头不正确:" + fmt.Sprintf("%02X", buf[0]))
|
||||
}
|
||||
if buf[len(buf)-1] != FrameTail {
|
||||
return sys_error.New(logTag + "帧尾不正确:" + fmt.Sprintf("%02X", buf[len(buf)-1]))
|
||||
}
|
||||
crc := crc32.ChecksumIEEE(buf[1 : len(buf)-5])
|
||||
if crc != binary.BigEndian.Uint32(buf[len(buf)-5:len(buf)-1]) {
|
||||
return sys_error.New(logTag + "CRC校验失败")
|
||||
}
|
||||
m.ID = buf[1]
|
||||
m.ControlWord = buf[2]
|
||||
m.Data = buf[5 : len(buf)-5]
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *BaseStruct) Encode() []byte {
|
||||
var data []byte
|
||||
data = append(data, FrameHead)
|
||||
data = append(data, m.ID)
|
||||
data = append(data, m.ControlWord)
|
||||
data = binary.BigEndian.AppendUint16(data, uint16(len(m.Data)))
|
||||
data = append(data, m.Data...)
|
||||
crc := crc32.ChecksumIEEE(data[1:])
|
||||
data = binary.BigEndian.AppendUint32(data, crc)
|
||||
data = append(data, FrameTail)
|
||||
return data
|
||||
}
|
||||
|
||||
type ReadRegisterReq struct {
|
||||
RegisterAddr []uint16 //寄存器地址
|
||||
}
|
||||
|
||||
func (r *ReadRegisterReq) Decode(buf []byte) error {
|
||||
if len(buf)%2 != 0 {
|
||||
return sys_error.New(logTag + "读寄存器数据字节长度不是2的倍数")
|
||||
}
|
||||
for i := 0; i < len(buf); i += 2 {
|
||||
r.RegisterAddr = append(r.RegisterAddr, binary.BigEndian.Uint16(buf[i:i+2]))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReadRegisterRes struct {
|
||||
RegisterData [][]byte //寄存器数据
|
||||
}
|
||||
|
||||
func (r *ReadRegisterRes) Encode() []byte {
|
||||
var data []byte
|
||||
for _, datum := range r.RegisterData {
|
||||
data = append(data, datum...)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
type WriteRegisterReq struct {
|
||||
RegisterAddr []uint16 //寄存器地址
|
||||
RegisterData [][]byte //寄存器数据
|
||||
}
|
||||
|
||||
func (w *WriteRegisterReq) Decode(buf []byte) error {
|
||||
if len(buf)%6 != 0 {
|
||||
return sys_error.New(logTag + "写寄存器数据字节长度不是6的倍数")
|
||||
}
|
||||
for i := 0; i < len(buf); i += 6 {
|
||||
w.RegisterAddr = append(w.RegisterAddr, binary.BigEndian.Uint16(buf[i:i+2]))
|
||||
w.RegisterData = append(w.RegisterData, buf[i+2:i+6])
|
||||
}
|
||||
return nil
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
package interlock
|
||||
// Package beijing12 北京12号线联锁通信
|
||||
package beijing12
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -52,6 +53,7 @@ type interlockProxy struct {
|
||||
|
||||
// 驱动信息进行转发
|
||||
func (i *interlockProxy) handleDriverInfo(b []byte) {
|
||||
slog.Info("收到联锁驱动继电器数据:", fmt.Sprintf("%x", b))
|
||||
handler := i.manager
|
||||
if handler != nil {
|
||||
handler.HandleInterlockDriverInfo(i.runConfig.Code, b)
|
||||
@ -100,7 +102,12 @@ func (i *interlockProxy) collectInfoStateTask(ctx context.Context) {
|
||||
if collectInfoState != nil {
|
||||
serialNumber++
|
||||
collectInfoState.SetSerialNumber(serialNumber)
|
||||
i.sendCollectUdpClient.SendMsg(collectInfoState)
|
||||
err := i.sendCollectUdpClient.SendMsg(collectInfoState)
|
||||
if err != nil {
|
||||
slog.Error("向联锁发送继电器状态失败:", err)
|
||||
} else {
|
||||
slog.Error("向联锁发送继电器数据成功:", fmt.Sprintf("%x", collectInfoState.Encode()))
|
||||
}
|
||||
}
|
||||
time.Sleep(time.Millisecond * InterlockMessageSendInterval)
|
||||
}
|
22
third_party/message/dynamics.go
vendored
22
third_party/message/dynamics.go
vendored
@ -3,6 +3,7 @@ package message
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DynamicsTurnoutInfo struct {
|
||||
@ -77,7 +78,10 @@ type DynamicsTrainInfo struct {
|
||||
//此次计算所使用的半实物消息的生命信号
|
||||
VobcLifeSignal uint16
|
||||
//位移(mm)
|
||||
Displacement uint16
|
||||
Displacement uint16
|
||||
TrainActToMax bool
|
||||
TrainActToMin bool
|
||||
UpdateTime int64
|
||||
}
|
||||
|
||||
// 解析动力学的列车信息
|
||||
@ -89,8 +93,19 @@ func (t *DynamicsTrainInfo) Decode(buf []byte) error {
|
||||
t.LinkOffset = binary.BigEndian.Uint32(buf[8:12])
|
||||
t.Slope = binary.BigEndian.Uint16(buf[12:14])
|
||||
b := buf[14]
|
||||
t.UpSlope = (b & (1 << 7)) != 0
|
||||
t.Up = (b & (1 << 6)) != 0
|
||||
t.UpSlope = IsTrueForByte(GetBit(b, 7))
|
||||
t.Up = IsTrueForByte(GetBit(b, 6))
|
||||
t.TrainActToMax = IsTrueForByte(GetBit(b, 4))
|
||||
t.TrainActToMin = IsTrueForByte(GetBit(b, 5))
|
||||
|
||||
//t.UpSlope = (b & (1 << 7)) != 0
|
||||
//t.Up = (b & (1 << 6)) != 0
|
||||
//t.TrainActToMax = (b & (1 << 5)) != 0
|
||||
//t.TrainActToMin = (b & (1 << 4)) != 0
|
||||
|
||||
//t.TrainActToMax = (b & (1 << 4)) != 0
|
||||
//t.TrainActToMin = (b & (1 << 5)) != 0
|
||||
|
||||
t.TotalResistance = int32(binary.BigEndian.Uint32(buf[16:20]))
|
||||
t.AirResistance = int32(binary.BigEndian.Uint32(buf[20:24]))
|
||||
t.SlopeResistance = int32(binary.BigEndian.Uint32(buf[24:28]))
|
||||
@ -105,5 +120,6 @@ func (t *DynamicsTrainInfo) Decode(buf []byte) error {
|
||||
t.Acceleration = math.Float32frombits(binary.BigEndian.Uint32(buf[60:64]))
|
||||
t.VobcLifeSignal = binary.BigEndian.Uint16(buf[64:66])
|
||||
t.Displacement = binary.BigEndian.Uint16(buf[66:68])
|
||||
t.UpdateTime = time.Now().UnixMilli()
|
||||
return nil
|
||||
}
|
||||
|
1
third_party/message/train_control.go
vendored
1
third_party/message/train_control.go
vendored
@ -29,6 +29,7 @@ func (r *TrainControlMsg) Encode() []byte {
|
||||
if !r.FromVobc {
|
||||
ls := r.ControlInfo.LifeSignal
|
||||
r.ControlInfo.LifeSignal = ls + 1
|
||||
r.ControlInfo.UpdateTime = time.Now().UnixMilli()
|
||||
}
|
||||
//data := make([]byte, 0)
|
||||
//data = binary.BigEndian.AppendUint16(data, uint16(r.ControlInfo.LifeSignal))
|
||||
|
2
third_party/train_pc_sim/train_pc_sim.go
vendored
2
third_party/train_pc_sim/train_pc_sim.go
vendored
@ -186,7 +186,7 @@ func (d *trainPcSimService) sendTrainLocationAndSpeedTask(ctx context.Context) {
|
||||
|
||||
s1, s2 := train.PluseCount.PulseCount1, train.PluseCount.PulseCount2
|
||||
d.speedPlace.ParsePulseCount1(s1, s2)
|
||||
data := d.speedPlace.Encode(train.RunDirection, s1, s2)
|
||||
data := d.speedPlace.Encode(train.TrainRunUp, s1, s2)
|
||||
bm := &message.TrainPcSimBaseMessage{Type: SENDER_TRAIN_LOCATION_INFO, Data: data}
|
||||
train.PluseCount.PulseCount1 = 0
|
||||
train.PluseCount.PulseCount2 = 0
|
||||
|
@ -6,6 +6,14 @@ import (
|
||||
"joylink.club/bj-rtsts-server/third_party/message"
|
||||
)
|
||||
|
||||
const (
|
||||
SKQYS1 = "SKQYS1" //驾驶端1
|
||||
SKQYS2 = "SKQYS2" //驾驶端2
|
||||
JJZD = "JJZD" //紧急停车
|
||||
QHFXKZ = "QHFXKZ" //驾驶方向
|
||||
QYSB = "QYSB" //牵引制动手柄
|
||||
)
|
||||
|
||||
// 获取列车控制图形数据
|
||||
func findTrainTccGraphicData(vs *VerifySimulation) *data_proto.TccGraphicStorage {
|
||||
var tccGI *data_proto.TccGraphicStorage
|
||||
@ -51,6 +59,20 @@ func findTrainTccGraphicDataHandler(tccG *data_proto.TccGraphicStorage, id uint3
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func initTrainVobc(trainLoad int64, trainIsUp bool) (*state_proto.TrainVobcState, uint32) {
|
||||
vobc := &state_proto.TrainVobcState{TrainLoad: int64(trainLoad), BrakingStatus: true, BrakeForce: DEFAULT_BRAKE_FORCE, DirectionForward: true}
|
||||
var trainActDir uint32 = 0
|
||||
if trainIsUp {
|
||||
vobc.Tc1Active = true
|
||||
trainActDir = 1
|
||||
} else {
|
||||
//vobc.Tc1Active = true
|
||||
vobc.Tc2Active = true
|
||||
trainActDir = 2
|
||||
}
|
||||
return vobc, trainActDir
|
||||
}
|
||||
|
||||
// 初始化列车控制数据
|
||||
func initTrainTcc(vs *VerifySimulation, runDir bool) *state_proto.TrainControlState {
|
||||
var tccGI *data_proto.TccGraphicStorage
|
||||
@ -64,12 +86,12 @@ func initTrainTcc(vs *VerifySimulation, runDir bool) *state_proto.TrainControlSt
|
||||
tcc := &state_proto.TrainControlState{}
|
||||
if tccGI != nil {
|
||||
for _, b := range tccGI.TccButtons {
|
||||
if b.Code == "JJZD" {
|
||||
if b.Code == JJZD {
|
||||
tcc.Ebutton = &state_proto.TrainControlState_EmergentButton{Id: b.Common.Id, Passed: false}
|
||||
}
|
||||
}
|
||||
for _, b := range tccGI.TccHandles {
|
||||
if b.Code == "QYSB" {
|
||||
if b.Code == QYSB {
|
||||
tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: b.Common.Id, Val: 0}
|
||||
}
|
||||
}
|
||||
@ -77,12 +99,14 @@ func initTrainTcc(vs *VerifySimulation, runDir bool) *state_proto.TrainControlSt
|
||||
for _, b := range tccGI.TccKeys {
|
||||
if b.GetType() == data_proto.TccKey_driverControllerActivationClint {
|
||||
val := false
|
||||
if b.Code == "SKQYS1" {
|
||||
if b.Code == SKQYS1 && runDir {
|
||||
val = true
|
||||
} else if b.Code == SKQYS2 && !runDir {
|
||||
val = true
|
||||
}
|
||||
ds = append(ds, &state_proto.TrainControlState_DriverKeySwitch{Id: b.Common.Id, Val: val})
|
||||
} else if b.GetType() == data_proto.TccKey_frontAndRearDirectionalControl {
|
||||
tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: b.Common.Id, Val: uint32(message.IsTrue(runDir))}
|
||||
tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: b.Common.Id, Val: uint32(message.IsTrue(true))}
|
||||
}
|
||||
}
|
||||
tcc.DriverKey = ds
|
||||
|
125
ts/simulation/wayside/memory/wayside_memory_dir_transfer.go
Normal file
125
ts/simulation/wayside/memory/wayside_memory_dir_transfer.go
Normal file
@ -0,0 +1,125 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"joylink.club/rtsssimulation/repository"
|
||||
"joylink.club/rtsssimulation/util/number"
|
||||
)
|
||||
|
||||
// LinkRadialToDeviceRadial Link射线转设备(道岔/区段)射线
|
||||
func LinkRadialToDeviceRadial(repo *repository.Repository, linkPosition *repository.LinkPosition, toBig bool) (sr *DeviceRadial, err error) {
|
||||
link := linkPosition.Link()
|
||||
offset := linkPosition.Offset()
|
||||
if offset > link.Length() {
|
||||
return nil, errors.New(fmt.Sprintf("%d超出%s范围", offset, linkPosition.String()))
|
||||
}
|
||||
//先遍历所有的非道岔计轴区段
|
||||
for _, section := range link.PhysicalSections() {
|
||||
for _, linkRange := range section.LinkRanges() {
|
||||
if linkRange.Link() != link {
|
||||
continue
|
||||
}
|
||||
if linkRange.Start() <= offset && offset <= linkRange.End() {
|
||||
sectionOffset := number.Abs(offset - section.ALinkPosition().Offset())
|
||||
toB := toBig == (section.BLinkPosition().Offset() > section.ALinkPosition().Offset())
|
||||
aKm := convertRepoBaseKm(repo, section.AKilometer())
|
||||
bKm := convertRepoBaseKm(repo, section.BKilometer())
|
||||
runDirection := toB == (bKm.Value > aKm.Value)
|
||||
sr = &DeviceRadial{
|
||||
DeviceId: section.Id(),
|
||||
Offset: sectionOffset,
|
||||
PointTo: toB,
|
||||
RunDirection: runDirection,
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if sr != nil {
|
||||
return sr, nil
|
||||
}
|
||||
//Link位置不在非道岔计轴区段上
|
||||
aLinkPosition := link.ARelation().Turnout().FindLinkPositionByPort(link.ARelation().Port())
|
||||
if aLinkPosition.Offset() >= offset { //LinkPosition在A端道岔范围内
|
||||
pointTo := !toBig
|
||||
portKm := convertRepoBaseKm(repo, link.ARelation().Turnout().GetTurnoutKm(link.ARelation().Port()))
|
||||
km := convertRepoBaseKm(repo, link.ARelation().Turnout().Km())
|
||||
runDir := pointTo == (km.Value > portKm.Value)
|
||||
sr = &DeviceRadial{
|
||||
DeviceId: link.ARelation().Turnout().Id(),
|
||||
Offset: offset,
|
||||
PointTo: !toBig,
|
||||
RunDirection: runDir,
|
||||
}
|
||||
}
|
||||
err = nil
|
||||
return
|
||||
}
|
||||
|
||||
// SectionRadialToLinkRadial 区段射线转Link射线
|
||||
func SectionRadialToLinkRadial(sectionRadial *SectionRadial) (linkPosition *repository.LinkPosition, toBig bool) {
|
||||
toBig = SectionDirToLinkDir(sectionRadial.Section, sectionRadial.ToB)
|
||||
var offset int64
|
||||
if sectionRadial.ToB == toBig { //section与link偏移变化趋势相同
|
||||
offset = sectionRadial.Section.ALinkPosition().Offset() + sectionRadial.Offset
|
||||
} else {
|
||||
offset = sectionRadial.Section.BLinkPosition().Offset() - sectionRadial.Offset
|
||||
}
|
||||
linkPosition = repository.NewLinkPosition(sectionRadial.Section.ALinkPosition().Link(), offset)
|
||||
return
|
||||
}
|
||||
|
||||
// OperationRadialToLinkRadial 运营射线转Link射线
|
||||
func OperationRadialToLinkRadial(repo *repository.Repository, section *repository.PhysicalSection, offset int64, up bool) (linkPosition *repository.LinkPosition, toBig bool) {
|
||||
toB := OperationDirToSectionDir(repo, section, up)
|
||||
return SectionRadialToLinkRadial(&SectionRadial{
|
||||
Section: section,
|
||||
Offset: offset,
|
||||
ToB: toB,
|
||||
})
|
||||
}
|
||||
|
||||
// SectionDirToLinkDir 区段方向转Link方向
|
||||
func SectionDirToLinkDir(section *repository.PhysicalSection, toB bool) (toBig bool) {
|
||||
aOffset := section.ALinkPosition().Offset()
|
||||
bOffset := section.BLinkPosition().Offset()
|
||||
toBig = toB == (bOffset > aOffset)
|
||||
return
|
||||
}
|
||||
|
||||
// SectionDirToOperationDir 区段方向转运营方向
|
||||
func SectionDirToOperationDir(repo *repository.Repository, section *repository.PhysicalSection, toB bool) (up bool) {
|
||||
aKm := convertRepoBaseKm(repo, section.AKilometer())
|
||||
bKm := convertRepoBaseKm(repo, section.BKilometer())
|
||||
return toB == (bKm.Value > aKm.Value)
|
||||
}
|
||||
|
||||
// OperationDirToSectionDir 运营方向转区段方向
|
||||
func OperationDirToSectionDir(repo *repository.Repository, section *repository.PhysicalSection, up bool) (toB bool) {
|
||||
aKm := convertRepoBaseKm(repo, section.AKilometer())
|
||||
bKm := convertRepoBaseKm(repo, section.BKilometer())
|
||||
return up == (bKm.Value > aKm.Value)
|
||||
}
|
||||
|
||||
// OperationDirToLinkDir 运营方向转Link方向
|
||||
func OperationDirToLinkDir(repo *repository.Repository, section *repository.PhysicalSection, up bool) (toBig bool) {
|
||||
toB := OperationDirToSectionDir(repo, section, up)
|
||||
return SectionDirToLinkDir(section, toB)
|
||||
}
|
||||
|
||||
// SectionRadial 区段射线。包含一个区段位置+方向
|
||||
// 加这个结构体只是因为上面函数返回值过多
|
||||
type SectionRadial struct {
|
||||
Section *repository.PhysicalSection
|
||||
Offset int64
|
||||
ToB bool
|
||||
}
|
||||
|
||||
// DeviceRadial 设备射线,包含一个设备位置+方向
|
||||
type DeviceRadial struct {
|
||||
DeviceId string //区段或道岔
|
||||
Offset int64 //在设备上的偏移量
|
||||
PointTo bool //与TrainState结构体中同义。区段:A->B,道岔:->岔心
|
||||
RunDirection bool //与TrainState结构体中同义。公里标 上行:小 -> 大,下行:大 -> 小
|
||||
}
|
@ -243,7 +243,7 @@ func findCalcLinkIdAndOffset(sim *VerifySimulation, link *repository.Link, offse
|
||||
}
|
||||
// 没有找到连接信息,说明已经到尽头找不到位置
|
||||
if nextLink == nil {
|
||||
err = sys_error.New(fmt.Sprintf("未找到对应的link信息, linkId=%s, offset=%d", link.Id(), offset))
|
||||
err = sys_error.New(fmt.Sprintf("未找到对应的link信息, linkId=%s, Offset=%d", link.Id(), offset))
|
||||
return
|
||||
}
|
||||
// 下个link偏移
|
||||
@ -297,7 +297,7 @@ func getTurnoutNextPort(sim *VerifySimulation, turnoutId string, port string) (n
|
||||
return
|
||||
}
|
||||
|
||||
// 计算link offset 在道岔上的位置
|
||||
// 计算link Offset 在道岔上的位置
|
||||
// 入参:仿真Repository、link、是否从A端开始、link偏移量、link运行方向
|
||||
// 输出:设备Id、设备所在端口、设备偏移量、公里标信息(地图主坐标系)
|
||||
func calcTurnoutOffset(repo *repository.Repository, link *repository.Link, isA bool, offset int64, up bool) (
|
||||
@ -328,7 +328,7 @@ func calcTurnoutOffset(repo *repository.Repository, link *repository.Link, isA b
|
||||
return
|
||||
}
|
||||
|
||||
// 计算link offset 在区段上的位置
|
||||
// 计算link Offset 在区段上的位置
|
||||
// 入参:仿真Repository、link、link偏移量、link运行方向
|
||||
// 输出:设备Id、设备所在端口、设备偏移量、公里标信息(地图主坐标系)
|
||||
func calcSectionOffset(repo *repository.Repository, link *repository.Link, offset int64, up bool) (
|
||||
|
@ -50,11 +50,6 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
|
||||
return sys_error.New(fmt.Sprintf("列车【%s】已存在", status.Id))
|
||||
}
|
||||
}
|
||||
//tcc := createTrainControl(vs)
|
||||
//status.Tcc = tcc
|
||||
|
||||
// 显示状态
|
||||
status.Show = true
|
||||
//向动力学发送初始化请求
|
||||
trainIndex, _ := strconv.ParseUint(status.Id, 10, 16)
|
||||
slog.Debug("添加列车", "trainIndex", trainIndex, "HeadDeviceId", status.HeadDeviceId, "HeadOffset", status.HeadOffset)
|
||||
@ -65,12 +60,16 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
|
||||
} else {
|
||||
uid = QueryUidByMidAndComId(mapId, status.HeadDeviceId, &data_proto.Turnout{})
|
||||
}
|
||||
|
||||
// 车头所在link、link上的偏移
|
||||
linkId, loffset := QueryLinkAndOffsetByDevice(vs.Repo, uid, status.DevicePort, status.HeadOffset)
|
||||
// link上的运行方向、设备上的运行方向
|
||||
up, pointTo := QueryUpAndABByDevice(vs.Repo, uid, status.DevicePort, status.RunDirection)
|
||||
up, pointTo := QueryUpAndABByDevice(vs.Repo, uid, status.DevicePort, status.TrainRunUp)
|
||||
//up, pointTo, _ = QueryDirectionAndABByDevice(vs.Repo, uid, status.DevicePort, status.TrainRunUp)
|
||||
//fmt.Println(up2, pointTo2)
|
||||
|
||||
// 车头所在公里标
|
||||
kilometer := CalcTrainKilometer(vs.Repo, uid, status.DevicePort, status.RunDirection, status.HeadOffset)
|
||||
kilometer := CalcTrainKilometer(vs.Repo, uid, status.DevicePort, status.TrainRunUp, status.HeadOffset)
|
||||
// 车尾相对车头link的偏移量
|
||||
calctailOffset := calcTrailTailOffset(loffset, status.TrainLength, up)
|
||||
// 车尾位置
|
||||
@ -79,7 +78,7 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
|
||||
panic(sys_error.New("添加列车失败,列车车尾占用位置计算出错", e1))
|
||||
}
|
||||
status.Up = up
|
||||
status.PointTo = pointTo
|
||||
status.DriftTo = pointTo
|
||||
status.TrainKilometer = kilometer.Value
|
||||
|
||||
status.DynamicState = &state_proto.TrainDynamicState{
|
||||
@ -87,7 +86,8 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
|
||||
HeadLinkOffset: loffset,
|
||||
TailLinkId: tailLink,
|
||||
TailLinkOffset: tailLOffset,
|
||||
RunningUp: up,
|
||||
RunningUp: status.Up,
|
||||
//RunningUp: status.TrainRunUp,
|
||||
}
|
||||
status.TailDeviceId = vs.GetComIdByUid(tailDeviceId)
|
||||
status.TailOffset = tailDeviceOffset
|
||||
@ -98,22 +98,23 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
|
||||
if tl <= 0 {
|
||||
tl = DEFULAT_TRAIN_LOAD
|
||||
}
|
||||
status.VobcState = &state_proto.TrainVobcState{Tc1Active: true, TrainLoad: int64(tl), BrakingStatus: true, BrakeForce: DEFAULT_BRAKE_FORCE}
|
||||
if status.RunDirection {
|
||||
status.VobcState.DirectionForward = true
|
||||
} else {
|
||||
status.VobcState.DirectionBackward = true
|
||||
}
|
||||
status.Tcc = initTrainTcc(vs, status.RunDirection)
|
||||
|
||||
vobc, _ := initTrainVobc(int64(tl), status.TrainRunUp)
|
||||
status.VobcState = vobc
|
||||
|
||||
//status.TrainActiveDirection = trainActDir
|
||||
|
||||
status.Tcc = initTrainTcc(vs, status.TrainRunUp)
|
||||
|
||||
slog.Debug("列车初始化", "trainIndex", trainIndex, "linkId", linkId, "loffset", loffset)
|
||||
linkIdInt, _ := strconv.Atoi(linkId)
|
||||
err := dynamics.Default().RequestAddTrain(&message.InitTrainInfo{
|
||||
TrainIndex: uint16(trainIndex),
|
||||
LinkIndex: uint16(linkIdInt),
|
||||
LinkOffset: uint32(loffset),
|
||||
Speed: status.Speed / 3.6,
|
||||
Up: status.Up,
|
||||
TrainIndex: uint16(trainIndex),
|
||||
LinkIndex: uint16(linkIdInt),
|
||||
LinkOffset: uint32(loffset),
|
||||
Speed: status.Speed / 3.6,
|
||||
Up: status.Up,
|
||||
//Up: status.TrainRunUp,
|
||||
TrainOperationConfig: CreateMsgTrainConfig(int(trainIndex), status.TrainLength, configTrainData),
|
||||
})
|
||||
if err != nil {
|
||||
@ -290,62 +291,50 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
|
||||
panic(sys_error.New(fmt.Sprintf("动力学传输数据:列车【%s】不存在", trainId)))
|
||||
}
|
||||
sta := data.(*state_proto.TrainState)
|
||||
if !sta.Show {
|
||||
return sta
|
||||
}
|
||||
delayTime := time.Now().UnixMilli() - sta.VobcState.UpdateTime
|
||||
sta.ControlDelayTime = (int64(sta.VobcState.LifeSignal)-int64(info.VobcLifeSignal))*20 + delayTime
|
||||
|
||||
//slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
|
||||
inLinkId, inLinkOffset := strconv.Itoa(int(info.Link)), int64(info.LinkOffset)
|
||||
|
||||
outLinkId, id, port, outLinkOffset, offset, kilometer, e1 := CalcInitializeLink(vs, inLinkId, inLinkOffset, info.Up)
|
||||
if e1 != nil {
|
||||
panic(sys_error.New("动力学传输数据:列车车头位置计算出错", e1))
|
||||
}
|
||||
//runDirection 指定的是link方向
|
||||
//pointTO 指的是是否ab,或是否到岔心
|
||||
runDirection, pointTo := QueryDirectionAndABByDevice(vs.Repo, id, port, info.Up)
|
||||
//slog.Debug("处理动力学转换后的消息", "number", info.Number, "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
|
||||
|
||||
slog.Debug("处理动力学转换后的消息", "number", info.Number, "up", info.Up, "Link", info.Link, "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo, "t1Dir:", info.TrainActToMax, "t2Dir:", info.TrainActToMin)
|
||||
trainHeadActUp := true
|
||||
if info.TrainActToMax || info.TrainActToMin {
|
||||
if info.TrainActToMin {
|
||||
trainHeadActUp = false
|
||||
}
|
||||
}
|
||||
// 车尾相对车头link的偏移量
|
||||
calctailOffset := calcTrailTailOffset(outLinkOffset, int64(info.Len), info.Up)
|
||||
//calctailOffset := calcTrailTailOffset(outLinkOffset, int64(info.Len), info.Up)
|
||||
calctailOffset := calcTrailTailOffset(outLinkOffset, int64(info.Len), trainHeadActUp)
|
||||
tailLinkId, tailDeviceId, tailDevicePort, tailLinkOffset, tailOffset, _, e2 := CalcInitializeLink(vs, outLinkId, calctailOffset, !info.Up)
|
||||
if e2 != nil {
|
||||
panic(sys_error.New("动力学传输数据:列车车尾位置计算出错", e2))
|
||||
}
|
||||
//slog.Debug("车尾位置", tailDeviceId, "偏移", tailDeviceOffset, "所在设备端", tailDevicePort)
|
||||
// 更新BTM中列车位置信息
|
||||
can_btm.Default().HandleTrainHeadPositionInfo(vs.World, &fi.TrainHeadPositionInfo{
|
||||
TrainId: trainId,
|
||||
Up: info.Up,
|
||||
Link: outLinkId,
|
||||
LinkOffset: outLinkOffset,
|
||||
Speed: info.Speed,
|
||||
Acceleration: info.Acceleration,
|
||||
})
|
||||
state := can_btm.Default().GetState()
|
||||
sta.BtmState = &state
|
||||
updateTrainBtmPosition(vs, info, sta, outLinkId, outLinkOffset)
|
||||
// 修改world中的列车位置
|
||||
fi.UpdateTrainPositionFromDynamics(vs.World, fi.TrainPositionInfo{
|
||||
TrainId: trainId,
|
||||
Up: info.Up,
|
||||
Len: info.Len,
|
||||
HeadLink: outLinkId,
|
||||
HeadLinkOffset: uint32(outLinkOffset),
|
||||
TailLink: tailLinkId,
|
||||
TailLinkOffset: uint32(tailLinkOffset),
|
||||
})
|
||||
handleTrainPositionFromDynamic(vs, info, sta, outLinkId, outLinkOffset, tailLinkId, tailLinkOffset)
|
||||
//修改列车激活方向
|
||||
updateTrainActiveDirFromDynamic(vs, info, sta, id, port, trainHeadActUp)
|
||||
|
||||
sta.HeadDeviceId = vs.GetComIdByUid(id)
|
||||
sta.DevicePort = port
|
||||
sta.HeadOffset = offset
|
||||
sta.PointTo = pointTo
|
||||
sta.DriftTo = pointTo
|
||||
sta.TrainKilometer = kilometer.Value
|
||||
sta.RunDirection = runDirection
|
||||
//判定车头方向
|
||||
sta.HeadDirection = runDirection
|
||||
if sta.VobcState != nil {
|
||||
if sta.VobcState.DirectionForward {
|
||||
sta.HeadDirection = runDirection
|
||||
} else if sta.VobcState.DirectionBackward {
|
||||
sta.HeadDirection = !runDirection
|
||||
}
|
||||
}
|
||||
if info.Speed < 0 {
|
||||
sta.RunDirection = !sta.RunDirection
|
||||
}
|
||||
|
||||
sta.TailDeviceId = vs.GetComIdByUid(tailDeviceId)
|
||||
sta.TailOffset = tailOffset
|
||||
sta.TailDevicePort = tailDevicePort
|
||||
@ -377,6 +366,47 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
|
||||
return sta
|
||||
}
|
||||
|
||||
func updateTrainActiveDirFromDynamic(vs *VerifySimulation, info *message.DynamicsTrainInfo, sta *state_proto.TrainState, id, port string, trainHeadActUp bool) {
|
||||
sta.TrainActiveDirection = 0
|
||||
if info.TrainActToMax || info.TrainActToMin {
|
||||
_, pointTo2 := QueryDirectionAndABByDevice(vs.Repo, id, port, trainHeadActUp)
|
||||
pt := pointTo2
|
||||
if pt {
|
||||
sta.TrainActiveDirection = 1
|
||||
} else {
|
||||
sta.TrainActiveDirection = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 根据列车位置修改列车应答器
|
||||
func updateTrainBtmPosition(vs *VerifySimulation, info *message.DynamicsTrainInfo, sta *state_proto.TrainState, outLinkId string, outLinkOffset int64) {
|
||||
// 更新BTM中列车位置信息
|
||||
can_btm.Default().HandleTrainHeadPositionInfo(vs.World, &fi.TrainHeadPositionInfo{
|
||||
TrainId: sta.Id,
|
||||
Up: info.Up,
|
||||
Link: outLinkId,
|
||||
LinkOffset: outLinkOffset,
|
||||
Speed: info.Speed,
|
||||
Acceleration: info.Acceleration,
|
||||
})
|
||||
state := can_btm.Default().GetState()
|
||||
sta.BtmState = &state
|
||||
}
|
||||
|
||||
// 根据动力学修改列车位置
|
||||
func handleTrainPositionFromDynamic(vs *VerifySimulation, info *message.DynamicsTrainInfo, sta *state_proto.TrainState, outLinkId string, outLinkOffset int64, tailLinkId string, tailLinkOffset int64) {
|
||||
fi.UpdateTrainPositionFromDynamics(vs.World, fi.TrainPositionInfo{
|
||||
TrainId: sta.Id,
|
||||
Up: info.Up,
|
||||
Len: info.Len,
|
||||
HeadLink: outLinkId,
|
||||
HeadLinkOffset: uint32(outLinkOffset),
|
||||
TailLink: tailLinkId,
|
||||
TailLinkOffset: uint32(tailLinkOffset),
|
||||
})
|
||||
}
|
||||
|
||||
// 接受动力学时间15毫米
|
||||
const RECEIVE_DYNAMIC_DATA_RATE = 15
|
||||
|
||||
@ -388,7 +418,7 @@ func pluseCount(sta *state_proto.TrainState) {
|
||||
if sta.PluseCount == nil {
|
||||
return
|
||||
}
|
||||
if sta.RunDirection {
|
||||
if sta.TrainRunUp {
|
||||
p1 := uint32(formatSpeedTime(sta.DynamicState.HeadSensorSpeed1 * RECEIVE_DYNAMIC_DATA_RATE))
|
||||
p2 := uint32(formatSpeedTime(sta.DynamicState.HeadSensorSpeed2 * RECEIVE_DYNAMIC_DATA_RATE))
|
||||
if sta.TrainEndsA.SpeedSensorEnableA {
|
||||
@ -437,7 +467,13 @@ func removeTrain(vs *VerifySimulation, trainId string, train *state_proto.TrainS
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if train.VobcState != nil {
|
||||
vobc := train.VobcState
|
||||
vobc.TractionStatus = false
|
||||
vobc.BrakingStatus = true
|
||||
vobc.TractionForce = 0
|
||||
vobc.BrakeForce = DEFAULT_BRAKE_FORCE
|
||||
}
|
||||
train.Show = false
|
||||
train.ConnState.ConnType = state_proto.TrainConnState_NONE
|
||||
return fi.RemoveTrainFromWorld(vs.World, trainId)
|
||||
|
@ -35,96 +35,147 @@ func ControlTrainUpdate(s *VerifySimulation, ct *request_proto.TrainControl) {
|
||||
panic(sys_error.New("未找到TCC图形数据"))
|
||||
}
|
||||
sta := data.(*state_proto.TrainState)
|
||||
vobc := sta.VobcState
|
||||
tcc := sta.Tcc
|
||||
var tce []train_pc_sim.TrainControlEvent = nil
|
||||
if ct.ControlType == request_proto.TrainControl_EMERGENT_BUTTON {
|
||||
tce = trainControlEB(sta, ct.Button, ct.DeviceId, tccGraphicData)
|
||||
tce = trainControlEB(vobc, tcc, ct.Button, ct.DeviceId, tccGraphicData)
|
||||
} else if ct.ControlType == request_proto.TrainControl_DRIVER_KEY_SWITCH {
|
||||
tce = trainControlDriverKey(sta, ct.DriverKey, ct.DeviceId, tccGraphicData)
|
||||
train_pc_sim.Default().SendDriverActive(sta.ConnState, sta.VobcState)
|
||||
} else if ct.ControlType == request_proto.TrainControl_DIRECTION_KEY_SWITCH {
|
||||
tce = trainControlDirKey(sta, ct.DirKey, ct.DeviceId, tccGraphicData)
|
||||
tce = trainControlDirKey(sta.DynamicState.Speed, vobc, tcc, ct.DirKey, ct.DeviceId, tccGraphicData)
|
||||
//此处先注释,根据现场调试情况 2024-4-16
|
||||
//train_pc_sim.Default().SendTrainDirection(sta.VobcState.DirectionForward, sta.VobcState.DirectionBackward)
|
||||
} else if ct.ControlType == request_proto.TrainControl_HANDLER {
|
||||
oldTraction := sta.VobcState.TractionForce
|
||||
oldBrakeForce := sta.VobcState.BrakeForce
|
||||
isTraction := ct.Handler.Val > 0 //是否制动
|
||||
tce = trainControlHandle(sta, ct.Handler, ct.DeviceId, tccGraphicData)
|
||||
tce = trainControlHandle(vobc, tcc, ct.Handler, ct.DeviceId, tccGraphicData)
|
||||
train_pc_sim.Default().SendHandleSwitch(oldTraction, oldBrakeForce, isTraction, sta.ConnState, sta.VobcState)
|
||||
}
|
||||
|
||||
if !vobc.DirectionForward && !vobc.DirectionBackward {
|
||||
vobc.TractionStatus = false
|
||||
vobc.TractionForce = 0
|
||||
}
|
||||
if vobc.EmergencyBrakingStatus {
|
||||
vobc.TractionForce = 0
|
||||
}
|
||||
if sta.ConnState.Conn && sta.ConnState.ConnType == state_proto.TrainConnState_PC_SIM && tce != nil {
|
||||
train_pc_sim.Default().PublishTrainControlEvent(tce)
|
||||
}
|
||||
}
|
||||
|
||||
func trainControlEB(trainState *state_proto.TrainState, request *request_proto.TrainControl_EmergentButton, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
|
||||
|
||||
func trainControlEB(vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_EmergentButton, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
|
||||
if !request.Active {
|
||||
return nil
|
||||
}
|
||||
if tcc.Ebutton != nil && tcc.Ebutton.Passed {
|
||||
return nil
|
||||
}
|
||||
_, find := findTrainTccGraphicDataButton(tccGraphic, deviceId)
|
||||
if !find {
|
||||
slog.Error("未找到对应的紧急停车摁钮,deviceId:", deviceId)
|
||||
return nil
|
||||
}
|
||||
trainState.VobcState.EmergencyBrakingStatus = request.Active
|
||||
if trainState.Tcc.Ebutton == nil {
|
||||
trainState.Tcc.Ebutton = &state_proto.TrainControlState_EmergentButton{Id: deviceId, Passed: request.Active}
|
||||
} else {
|
||||
trainState.Tcc.Ebutton.Passed = request.Active
|
||||
if tcc.Ebutton == nil {
|
||||
tcc.Ebutton = &state_proto.TrainControlState_EmergentButton{Id: deviceId}
|
||||
}
|
||||
tcc.Ebutton.Passed = request.Active
|
||||
vobc.EmergencyBrakingStatus = true
|
||||
vobc.TractionForce = 0
|
||||
vobc.BrakeForce = DEFAULT_BRAKE_FORCE
|
||||
|
||||
return nil
|
||||
//return []train_pc_sim.TrainControlEvent{{Command: message.KEY_STATE, Status: message.IsTrue(request.Val)}}
|
||||
}
|
||||
|
||||
// 列车方向
|
||||
func trainControlDirKey(trainState *state_proto.TrainState, request *request_proto.TrainControl_DirectionKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
|
||||
func trainControlDirKey(trainSpeed int32, vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_DirectionKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
|
||||
_, find := findTrainTccGraphicDataKey(tccGraphic, deviceId)
|
||||
if !find {
|
||||
slog.Error("未找到对应的列车方向键deviceId:", deviceId)
|
||||
return nil
|
||||
panic(sys_error.New("未找到对应的列车方向键"))
|
||||
}
|
||||
if tcc.DirKey == nil {
|
||||
tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: deviceId}
|
||||
}
|
||||
|
||||
trainState.VobcState.DirectionForward = false
|
||||
trainState.VobcState.DirectionBackward = false
|
||||
direction := request_proto.TrainControl_Direction(request.Val)
|
||||
if trainSpeed > 0 {
|
||||
panic(sys_error.New("列车未停稳时,不能变更方向"))
|
||||
}
|
||||
vobc.DirectionBackward = false
|
||||
vobc.DirectionForward = false
|
||||
if direction == request_proto.TrainControl_FORWARD {
|
||||
vobc.DirectionForward = true
|
||||
} else if direction == request_proto.TrainControl_BACKWARD {
|
||||
vobc.DirectionBackward = true
|
||||
}
|
||||
/* if direction == request_proto.TrainControl_NEUTRALWARD {
|
||||
vobc.DirectionBackward = false
|
||||
vobc.DirectionForward = false
|
||||
} else if trainSpeed > 0 && direction != vobc.HistoryDir {
|
||||
tcc.DirKey.Val = uint32(vobc.HistoryDir.Number())
|
||||
if vobc.HistoryDir == request_proto.TrainControl_FORWARD {
|
||||
vobc.DirectionForward = true
|
||||
} else if vobc.HistoryDir == request_proto.TrainControl_BACKWARD {
|
||||
vobc.DirectionBackward = true
|
||||
}
|
||||
panic(sys_error.New("列车未停稳时,不能变更方向"))
|
||||
}
|
||||
vobc.DirectionBackward = false
|
||||
vobc.DirectionForward = false
|
||||
if direction == request_proto.TrainControl_FORWARD {
|
||||
vobc.DirectionForward = true
|
||||
vobc.HistoryDir = request_proto.TrainControl_FORWARD
|
||||
} else if direction == request_proto.TrainControl_BACKWARD {
|
||||
vobc.DirectionBackward = true
|
||||
vobc.HistoryDir = request_proto.TrainControl_BACKWARD
|
||||
}*/
|
||||
|
||||
if request.Val == 1 {
|
||||
trainState.VobcState.DirectionForward = true
|
||||
} else if request.Val == 0 {
|
||||
trainState.VobcState.DirectionBackward = true
|
||||
}
|
||||
if trainState.Tcc.DirKey == nil {
|
||||
trainState.Tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: deviceId, Val: request.Val}
|
||||
} else {
|
||||
trainState.Tcc.DirKey.Val = request.Val
|
||||
}
|
||||
tcc.DirKey.Val = request.Val
|
||||
tce := make([]train_pc_sim.TrainControlEvent, 0)
|
||||
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_FORWORD, Status: message.IsTrue(trainState.VobcState.DirectionForward)})
|
||||
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_BACKWORD, Status: message.IsTrue(trainState.VobcState.DirectionBackward)})
|
||||
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_FORWORD, Status: message.IsTrue(vobc.DirectionForward)})
|
||||
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_BACKWORD, Status: message.IsTrue(vobc.DirectionBackward)})
|
||||
return tce
|
||||
}
|
||||
|
||||
// 列车驾驶端激活
|
||||
func trainControlDriverKey(trainState *state_proto.TrainState, request *request_proto.TrainControl_DriverKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
|
||||
func trainControlDriverKey(train *state_proto.TrainState, request *request_proto.TrainControl_DriverKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
|
||||
obj, find := findTrainTccGraphicDataKey(tccGraphic, deviceId)
|
||||
if !find {
|
||||
slog.Error("未找到对应的驾驶端激活设备deviceId:", deviceId)
|
||||
return nil
|
||||
}
|
||||
|
||||
if obj.Code == "SKQYS1" {
|
||||
trainState.VobcState.Tc1Active = request.Val
|
||||
} else if obj.Code == "SKQYS2" {
|
||||
trainState.VobcState.Tc2Active = request.Val
|
||||
if train.DynamicState.Speed != 0 {
|
||||
panic(sys_error.New("因列车未停稳,不支持此操作"))
|
||||
}
|
||||
if trainState.VobcState.Tc1Active && trainState.VobcState.Tc2Active {
|
||||
if obj.Code == "SKQYS1" {
|
||||
trainState.VobcState.Tc1Active = false
|
||||
} else if obj.Code == "SKQYS2" {
|
||||
trainState.VobcState.Tc2Active = false
|
||||
vobc := train.VobcState
|
||||
tcc := train.Tcc
|
||||
if obj.Code == SKQYS1 {
|
||||
vobc.Tc1Active = request.Val
|
||||
} else if obj.Code == SKQYS2 {
|
||||
vobc.Tc2Active = request.Val
|
||||
}
|
||||
if vobc.Tc1Active && vobc.Tc2Active {
|
||||
if obj.Code == SKQYS1 {
|
||||
vobc.Tc1Active = false
|
||||
} else if obj.Code == SKQYS2 {
|
||||
vobc.Tc2Active = false
|
||||
}
|
||||
panic(sys_error.New("驾驶端不能同时激活"))
|
||||
}
|
||||
train.TrainActiveDirection = 0
|
||||
if vobc.Tc1Active {
|
||||
//train.TrainActiveDirection = 1
|
||||
train.TrainRunUp = true
|
||||
} else if vobc.Tc2Active {
|
||||
//train.TrainActiveDirection = 2
|
||||
train.TrainRunUp = false
|
||||
}
|
||||
var addNew = true
|
||||
for _, k := range trainState.Tcc.DriverKey {
|
||||
for _, k := range tcc.DriverKey {
|
||||
if k.Id == deviceId {
|
||||
k.Id = deviceId
|
||||
k.Val = request.Val
|
||||
@ -133,48 +184,45 @@ func trainControlDriverKey(trainState *state_proto.TrainState, request *request_
|
||||
}
|
||||
}
|
||||
if addNew {
|
||||
trainState.Tcc.DriverKey = append(trainState.Tcc.DriverKey, &state_proto.TrainControlState_DriverKeySwitch{Id: deviceId, Val: request.Val})
|
||||
tcc.DriverKey = append(tcc.DriverKey, &state_proto.TrainControlState_DriverKeySwitch{Id: deviceId, Val: request.Val})
|
||||
}
|
||||
return []train_pc_sim.TrainControlEvent{{Command: message.KEY_STATE, Status: message.IsTrue(request.Val)}}
|
||||
|
||||
}
|
||||
|
||||
// 列车牵引控制
|
||||
func trainControlHandle(trainState *state_proto.TrainState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
|
||||
func trainControlHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
|
||||
_, find := findTrainTccGraphicDataHandler(tccGraphic, deviceId)
|
||||
if !find {
|
||||
slog.Error("未找到对应的牵引制动手柄设备deviceId:", deviceId)
|
||||
return nil
|
||||
}
|
||||
|
||||
trainState.VobcState.TractionStatus = false
|
||||
trainState.VobcState.TractionForce = 0
|
||||
trainState.VobcState.BrakingStatus = false
|
||||
trainState.VobcState.BrakeForce = 0
|
||||
trainState.VobcState.MaintainBrakeStatus = false
|
||||
vobc.TractionStatus = false
|
||||
vobc.TractionForce = 0
|
||||
vobc.BrakingStatus = false
|
||||
vobc.BrakeForce = 0
|
||||
vobc.MaintainBrakeStatus = false
|
||||
tce := make([]train_pc_sim.TrainControlEvent, 0)
|
||||
//tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_FORWORD, Status: 0})
|
||||
//tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_BACKWORD, Status: 0})
|
||||
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_TO_ZERO, Status: 0})
|
||||
if request.Val > 0 {
|
||||
trainState.VobcState.TractionStatus = true
|
||||
trainState.VobcState.TractionForce = int64(request.Val * 180)
|
||||
//tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_FORWORD, Status: 1})
|
||||
vobc.TractionStatus = true
|
||||
vobc.TractionForce = int64(request.Val * 180)
|
||||
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.TRAIN_BRAKE_STATE, Status: 0})
|
||||
} else if request.Val < 0 {
|
||||
trainState.VobcState.BrakingStatus = true
|
||||
trainState.VobcState.BrakeForce = int64(-request.Val * 180)
|
||||
//tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_BACKWORD, Status: 1})
|
||||
vobc.BrakingStatus = true
|
||||
vobc.BrakeForce = int64(-request.Val * 180)
|
||||
vobc.EmergencyBrakingStatus = false
|
||||
if tcc.Ebutton != nil {
|
||||
tcc.Ebutton.Passed = false
|
||||
}
|
||||
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.TRAIN_BRAKE_STATE, Status: 1})
|
||||
} else {
|
||||
|
||||
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_TO_ZERO, Status: 1})
|
||||
}
|
||||
if trainState.Tcc.PushHandler == nil {
|
||||
trainState.Tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: deviceId, Val: request.Val}
|
||||
} else {
|
||||
trainState.Tcc.PushHandler.Val = request.Val
|
||||
if tcc.PushHandler == nil {
|
||||
tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: deviceId}
|
||||
}
|
||||
tcc.PushHandler.Val = request.Val
|
||||
return tce
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ts
|
||||
import (
|
||||
"fmt"
|
||||
"joylink.club/bj-rtsts-server/third_party/acc"
|
||||
"joylink.club/bj-rtsts-server/third_party/interlock/beijing12"
|
||||
"joylink.club/bj-rtsts-server/third_party/radar"
|
||||
"joylink.club/bj-rtsts-server/third_party/train_pc_sim"
|
||||
"log/slog"
|
||||
@ -20,7 +21,6 @@ import (
|
||||
"joylink.club/bj-rtsts-server/mqtt"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
"joylink.club/bj-rtsts-server/third_party/dynamics"
|
||||
"joylink.club/bj-rtsts-server/third_party/interlock"
|
||||
"joylink.club/bj-rtsts-server/third_party/semi_physical_train"
|
||||
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
|
||||
|
||||
@ -120,7 +120,7 @@ func runThirdParty(s *memory.VerifySimulation) error {
|
||||
semi_physical_train.Default().Start(s)
|
||||
// 联锁启动
|
||||
for _, c := range s.GetInterlockCodes() {
|
||||
interlock.Default(c).Start(s)
|
||||
beijing12.Default(c).Start(s)
|
||||
}
|
||||
// 计轴RSSP启动
|
||||
axle_device.StartLineAllRsspAxleServices(s)
|
||||
@ -149,7 +149,7 @@ func stopThirdParty(s *memory.VerifySimulation) {
|
||||
semi_physical_train.Default().Stop()
|
||||
// 联锁启动
|
||||
for _, c := range s.GetInterlockCodes() {
|
||||
interlock.Default(c).Stop()
|
||||
beijing12.Default(c).Stop()
|
||||
}
|
||||
//计轴RSSP启动销毁
|
||||
axle_device.StopLineAllRsspAxleServices()
|
||||
|
Loading…
Reference in New Issue
Block a user