rts-sim-module/component/psd.go

82 lines
1.7 KiB
Go
Raw Normal View History

package component
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/consts"
)
var PsdTag = ecs.NewTag()
var PsdStateType = ecs.NewComponentType[component_proto.PsdState]()
var PsdInfoType = ecs.NewComponentType[PsdInfo]()
type PsdInfo struct {
PlatformId string
}
var PsdCircuitType = ecs.NewComponentType[PsdCircuit]()
type PsdCircuit struct {
//屏蔽门驱动继电器
GMJ *ecs.Entry
KMJ4 *ecs.Entry
KMJ8 *ecs.Entry
//屏蔽门表示继电器
MGJ *ecs.Entry
MPLJ *ecs.Entry
}
var PsdMotorType = ecs.NewComponentType[ecs.Entry]()
var PsdMotorStateType = ecs.NewComponentType[PsdMotorState]()
// PsdMotorState 屏蔽门电机状态
type PsdMotorState struct {
//4编组开门通电
Km4_Td bool
//8编组开门通电
Km8_Td bool
//关门通电
Gm_Td bool
//4编组开门进度
Km4 int32
//8编组与4编组差集的门的开门进度
Km8_4 int32
//开关门速度
Speed int32
}
// Is4Km 是否4编组开门不用开到位
func (p *PsdMotorState) Is4Km() bool {
return p.Km4 != consts.TwoPosMin && p.Km8_4 == consts.TwoPosMin
}
// Is4Km 是否4编组开门不用开到位
func (p *PsdMotorState) Is8Km() bool {
return p.Km4 != consts.TwoPosMin && p.Km8_4 != consts.TwoPosMin
}
var PsdDriveCircuitType = ecs.NewComponentType[PsdDriveCircuit]()
// PsdDriveCircuit 屏蔽门驱动电路
type PsdDriveCircuit struct {
//屏蔽门驱动继电器接通状态
GMJ bool
KMJ4 bool
KMJ8 bool
}
var PsdCollectionCircuitType = ecs.NewComponentType[PsdCollectionCircuit]()
type PsdCollectionCircuit struct {
GMJ bool
KMJ4 bool
KMJ8 bool
//MGJ吸起
MGJ_X bool
//MGJ落下
MGJ_L bool
MPLJ_X bool
MPLJ_L bool
}