rts-sim-module/component/relay.go
walker 9401b15142 组件调整
实体加载调整
继电器、断相保护器、道岔转辙机、道岔、道岔电路等系统调整
继电器、道岔对外接口调整
2024-01-12 18:20:21 +08:00

44 lines
1.9 KiB
Go
Raw Permalink 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 (
"unsafe"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component/component_data"
"joylink.club/rtsssimulation/component/relation"
)
// 标签
var (
// 继电器
RelayTag = ecs.NewTag()
// 继电器模型数据关系组件类型
RelayModelRelaType = relation.RelayModelRelaType
// 继电器状态组件
RelayStateType = ecs.NewComponentType[component_data.RelayState]()
// 继电器故障强制组件
RelayFaultForceType = ecs.NewComponentType[component_data.RelayFaultForce]()
)
func AddOrUpdateRelayFaultForce(entry *ecs.Entry, q bool) {
if entry.HasComponent(RelayFaultForceType) {
entry.SetComponent(RelayFaultForceType, unsafe.Pointer(&component_data.RelayFaultForce{Q: q}))
} else {
entry.AddComponent(RelayFaultForceType, unsafe.Pointer(&component_data.RelayFaultForce{Q: q}))
}
}
// // 无极继电器和偏极继电器稳态为落下,也就是后接点(8组采集接点中的1,3接点1为中接点)吸气为前接点1,2接点
// // 有极继电器是定位反位双稳态(有永久磁钢),前接点为定位,后接点为反位
// // 有极继电器对于道岔中的2DQJ励磁接点12接通为反位34接通为定位
// // 定义继电器状态时false表示落下/反位/后接点true表示吸起/定位/前接点
// // 缓动继电器指从通电或断电起至接点转接止所需时间在0.3s以上的继电器。可分为缓放继电器(如无极缓放继电器等)和缓吸继电器(如热力继电器和时间继电器等)。
// // 偏极继电器:只有通过规定方向的电流时,才吸起
// // 继电器驱动组件
// type RelayDrive struct {
// Td bool // 是否通电
// Xq bool // 是否驱动到吸起位置true驱动吸起,false:驱动落下(此状态只对有极继电器有效)
// }
// var RelayDriveType = ecs.NewComponentType[RelayDrive]()