rts-sim-module/component/psd.go

115 lines
2.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package component
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component/component_proto"
)
var PsdTag = ecs.NewTag()
var PsdStateType = ecs.NewComponentType[component_proto.PsdState]()
var PsdCircuitType = ecs.NewComponentType[PsdCircuit]()
type PsdCircuit struct {
//屏蔽门驱动继电器
GMJ *ecs.Entry
//KMJ4 *ecs.Entry
//KMJ8 *ecs.Entry
KMJMap map[int32]*ecs.Entry //开门继电器k-编组
//屏蔽门表示继电器
MGJ *ecs.Entry
MPLJ *ecs.Entry
//启动探测继电器
QDTCJ *ecs.Entry
//停止探测继电器
TZTCJ *ecs.Entry
//大概就是表示探测过程中出现异常
ZAWJ *ecs.Entry
//间隙探测旁路继电器
JXTCPLJ *ecs.Entry
//一些不知道如何使用的继电器,为了使得采集、驱动逻辑正常,先构建出来
UnusedJ []*ecs.Entry
}
var AsdCannotOpenTag = ecs.NewTag()
var AsdCannotCloseTag = ecs.NewTag()
func GetAsdFaultTag(fault component_proto.Psd_Fault) (ecs.IComponentType, error) {
switch fault {
case component_proto.Psd_AsdCannotClose:
return AsdCannotCloseTag, nil
case component_proto.Psd_AsdCannotOpen:
return AsdCannotOpenTag, nil
default:
return nil, fmt.Errorf("未知的屏蔽门故障类型[%s]", fault)
}
}
var AsdTag = ecs.NewTag()
var AsdListType = ecs.NewComponentType[AsdList]()
// AsdList 滑动门列表
type AsdList struct {
List []*ecs.Entry
}
var AsdMotorStateType = ecs.NewComponentType[AsdMotorState]()
// AsdMotorState 滑动门电机状态
type AsdMotorState struct {
TD bool //电机通电
KM bool //向开门方向转动
MG bool //门是否关闭(继电器状态)
}
var AsdStateType = ecs.NewComponentType[component_proto.AsdState]()
// AsdForceType ture强制开门 false强制关门
var AsdForceType = ecs.NewComponentType[BitState]()
// AsdHasObstacleTag 滑动门有障碍物
var AsdHasObstacleTag = ecs.NewTag()
var PlatformMkxCircuitType = ecs.NewComponentType[PlatformMkxCircuit]()
// PlatformMkxCircuit 站台门控箱电路
type PlatformMkxCircuit struct {
MkxList []*ecs.Entry
PCBJ *ecs.Entry
POBJ *ecs.Entry
PABJ *ecs.Entry
WRZFJ *ecs.Entry
QKQRJ *ecs.Entry
}
var MkxType = ecs.NewComponentType[Mkx]()
type Mkx struct {
PCB *ecs.Entry
PCBPL *ecs.Entry
POB *ecs.Entry
POBPL *ecs.Entry
PAB *ecs.Entry
PABPL *ecs.Entry
WRZF *ecs.Entry
WRZFPL *ecs.Entry
QKQR *ecs.Entry
QKQRPL *ecs.Entry
MPL *ecs.Entry
JXTCPL *ecs.Entry
}
var PscType = ecs.NewComponentType[Psc]()
type Psc struct {
//InterlockKM4 bool
//InterlockKM8 bool
InterlockKmGroup map[int32]bool //开门编组。k-编组 v-设置开门
InterlockGM bool
//MkxKM bool 门控箱控制继电器->联锁采集继电器状态->联锁驱动屏蔽门控制继电器
//MkxGM bool
//MkxPL bool
}