2023-09-26 18:06:15 +08:00
|
|
|
|
package circuit_sys
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"unsafe"
|
|
|
|
|
|
|
|
|
|
"github.com/yohamta/donburi/filter"
|
|
|
|
|
"joylink.club/ecs"
|
|
|
|
|
"joylink.club/rtsssimulation/component"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ZDJ9双机牵引道岔电路系统
|
2023-09-27 18:39:18 +08:00
|
|
|
|
type ZDJ9TwoDragSys struct {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
query *ecs.Query
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func NewZdj9TwoDragSys() *ZDJ9TwoDragSys {
|
|
|
|
|
return &ZDJ9TwoDragSys{
|
|
|
|
|
query: ecs.NewQuery(filter.Contains(component.Zdj9TwoElectronicType, component.TwoPositionTransformType)),
|
2023-09-26 18:06:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-27 18:39:18 +08:00
|
|
|
|
// 电路更新
|
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) Update(w ecs.World) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
fmt.Println("ZDJ9双机牵引道岔电路系统")
|
|
|
|
|
zdj9.query.Each(w, func(entry *ecs.Entry) {
|
2023-09-27 18:39:18 +08:00
|
|
|
|
elec := component.Zdj9TwoElectronicType.Get(entry)
|
2023-09-26 18:06:15 +08:00
|
|
|
|
// 转辙机一机电路相关动作
|
|
|
|
|
// 1DQJ励磁状态控制
|
|
|
|
|
zdj9.exciteM1_TDFJ_1DQJ(elec)
|
|
|
|
|
// 1DQJF励磁状态控制
|
|
|
|
|
zdj9.exciteM1_TDFJ_1DQJF(elec)
|
|
|
|
|
// TDFJ1_2DQJ励磁状态控制
|
|
|
|
|
zdj9.exciteM1_TDFJ_2DQJ(elec)
|
|
|
|
|
// 限时断相保护器
|
|
|
|
|
zdj9.exciteM1_TDFJ_DBQ(w, entry, elec)
|
|
|
|
|
// TDFJ1_BHJ励磁状态控制
|
|
|
|
|
zdj9.exciteM1_TDFJ_BHJ(elec)
|
|
|
|
|
// 总保护继电器
|
|
|
|
|
zdj9.exciteM1_TDFJ_ZBHJ(elec)
|
|
|
|
|
// 切断继电器
|
|
|
|
|
zdj9.exciteM1_TDFJ_QDJ(w, entry, elec)
|
|
|
|
|
// 定表/反表继电器
|
2023-09-27 18:39:18 +08:00
|
|
|
|
zdj9.exciteM1_TDFJ1_DFBJ(elec)
|
2023-09-26 18:06:15 +08:00
|
|
|
|
|
|
|
|
|
// 转辙机二机电路相关动作
|
|
|
|
|
// 1DQJ励磁状态控制
|
|
|
|
|
zdj9.exciteM2_TDFJ_1DQJ(elec)
|
|
|
|
|
// 1DQJF励磁状态控制
|
|
|
|
|
zdj9.exciteM2_TDFJ_1DQJF(elec)
|
|
|
|
|
// TDFJ1_2DQJ励磁状态控制
|
|
|
|
|
zdj9.exciteM2_TDFJ_2DQJ(elec)
|
|
|
|
|
// 限时断相保护器
|
|
|
|
|
zdj9.exciteM2_TDFJ_DBQ(w, entry, elec)
|
|
|
|
|
// TDFJ1_BHJ励磁状态控制
|
|
|
|
|
zdj9.exciteM2_TDFJ_BHJ(elec)
|
|
|
|
|
// 定表/反表继电器
|
2023-09-27 18:39:18 +08:00
|
|
|
|
zdj9.exciteM2_TDFJ1_DFBJ(elec)
|
2023-09-26 18:06:15 +08:00
|
|
|
|
|
|
|
|
|
// 总定表/反表继电器
|
2023-09-27 18:39:18 +08:00
|
|
|
|
zdj9.exciteZDFBJ(elec)
|
2023-09-26 18:06:15 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-27 18:39:18 +08:00
|
|
|
|
// 总定表、反表继电器控制
|
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteZDFBJ(elec *component.Zdj9TwoElectronic) {
|
|
|
|
|
tdfj1_dbj := component.BitStateType.Get(elec.TDFJ1_DBJ)
|
|
|
|
|
tdfj2_dbj := component.BitStateType.Get(elec.TDFJ2_DBJ)
|
|
|
|
|
tdfj1_fbj := component.BitStateType.Get(elec.TDFJ1_FBJ)
|
|
|
|
|
tdfj2_fbj := component.BitStateType.Get(elec.TDFJ2_FBJ)
|
|
|
|
|
zdbj_drive := component.RelayDriveType.Get(elec.TDC_ZDBJ)
|
|
|
|
|
zfbj_drive := component.RelayDriveType.Get(elec.TDC_ZDBJ)
|
|
|
|
|
// 总定表
|
|
|
|
|
if zdbj_drive.Td { // 总定表继电器通电,监测电路是否断开
|
|
|
|
|
if !(tdfj1_dbj.Val && tdfj2_dbj.Val) {
|
|
|
|
|
zdbj_drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if tdfj1_dbj.Val && tdfj2_dbj.Val {
|
|
|
|
|
zdbj_drive.Td = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 总反表
|
|
|
|
|
if zfbj_drive.Td {
|
|
|
|
|
if !(tdfj1_fbj.Val && tdfj2_fbj.Val) {
|
|
|
|
|
zfbj_drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if tdfj1_fbj.Val && tdfj2_fbj.Val {
|
|
|
|
|
zfbj_drive.Td = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 二极管整流电路为继电器励磁电路提供半波整流电源
|
2023-09-26 18:06:15 +08:00
|
|
|
|
// 转辙机一定表/反表继电器控制
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ1_DFBJ(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
_1dqj := component.BitStateType.Get(elec.TDFJ1_1DQJ)
|
|
|
|
|
_2dqj := component.BitStateType.Get(elec.TDFJ1_2DQJ)
|
|
|
|
|
zzj := component.ZzjType.Get(elec.Zzj1)
|
|
|
|
|
dbj_drive := component.RelayDriveType.Get(elec.TDFJ1_DBJ)
|
2023-09-27 18:39:18 +08:00
|
|
|
|
fbj_drive := component.RelayDriveType.Get(elec.TDFJ1_FBJ)
|
2023-09-26 18:06:15 +08:00
|
|
|
|
// 默认BB(道岔表示变压器)正常
|
2023-09-27 18:39:18 +08:00
|
|
|
|
if !dbj_drive.Td { // 定表继电器未通电
|
|
|
|
|
if !_1dqj.Val && _2dqj.Val && !zzj.JD12 && !zzj.JD34 { // 1DQJ落下,2DQJ定位,开闭器接点在1/3排
|
2023-09-26 18:06:15 +08:00
|
|
|
|
dbj_drive.Td = true
|
|
|
|
|
}
|
2023-09-27 18:39:18 +08:00
|
|
|
|
} else { // 定表继电器通电
|
|
|
|
|
if !(!_1dqj.Val && _2dqj.Val && !zzj.JD12 && !zzj.JD34) { // 励磁电路断开
|
2023-09-26 18:06:15 +08:00
|
|
|
|
dbj_drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-09-27 18:39:18 +08:00
|
|
|
|
if !fbj_drive.Td { // 反表继电器未通电
|
|
|
|
|
if !_1dqj.Val && !_2dqj.Val && zzj.JD12 && zzj.JD34 { // 2DQJ反位,开闭器在2/4排
|
2023-09-26 18:06:15 +08:00
|
|
|
|
fbj_drive.Td = true
|
|
|
|
|
}
|
2023-09-27 18:39:18 +08:00
|
|
|
|
} else { // 反表继电器通电
|
|
|
|
|
if !(!_1dqj.Val && !_2dqj.Val && zzj.JD12 && zzj.JD34) { // 电路断开
|
|
|
|
|
fbj_drive.Td = false
|
|
|
|
|
}
|
2023-09-26 18:06:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机二定表/反表继电器控制
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ1_DFBJ(elec *component.Zdj9TwoElectronic) {
|
|
|
|
|
_1dqj := component.BitStateType.Get(elec.TDFJ2_1DQJ)
|
|
|
|
|
_2dqj := component.BitStateType.Get(elec.TDFJ2_2DQJ)
|
|
|
|
|
zzj := component.ZzjType.Get(elec.Zzj2)
|
|
|
|
|
dbj_drive := component.RelayDriveType.Get(elec.TDFJ2_DBJ)
|
|
|
|
|
fbj_drive := component.RelayDriveType.Get(elec.TDFJ2_FBJ)
|
|
|
|
|
// 默认BB(道岔表示变压器)正常
|
|
|
|
|
if !dbj_drive.Td { // 定表继电器未通电
|
|
|
|
|
if !_1dqj.Val && _2dqj.Val && !zzj.JD12 && !zzj.JD34 { // 1DQJ落下,2DQJ定位,开闭器接点在1/3排
|
|
|
|
|
dbj_drive.Td = true
|
|
|
|
|
}
|
|
|
|
|
} else { // 定表继电器通电
|
|
|
|
|
if !(!_1dqj.Val && _2dqj.Val && !zzj.JD12 && !zzj.JD34) { // 励磁电路断开
|
|
|
|
|
dbj_drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !fbj_drive.Td { // 反表继电器未通电
|
|
|
|
|
if !_1dqj.Val && !_2dqj.Val && zzj.JD12 && zzj.JD34 { // 2DQJ反位,开闭器在2/4排
|
|
|
|
|
fbj_drive.Td = true
|
|
|
|
|
}
|
|
|
|
|
} else { // 反表继电器通电
|
|
|
|
|
if !(!_1dqj.Val && !_2dqj.Val && zzj.JD12 && zzj.JD34) { // 电路断开
|
|
|
|
|
fbj_drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-09-26 18:06:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 切断继电器延时缓放电路缓放时间,单位ms
|
|
|
|
|
const QDJ_DELAY = 3 * 1000
|
|
|
|
|
|
|
|
|
|
// 切断继电器控制
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_QDJ(w ecs.World, entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
tdfj1_bhj := component.BitStateType.Get(elec.TDFJ1_BHJ)
|
|
|
|
|
tdfj2_bhj := component.BitStateType.Get(elec.TDFJ2_BHJ)
|
|
|
|
|
tdfj1_zbhj := component.BitStateType.Get(elec.TDFJ1_ZBHJ)
|
|
|
|
|
tdfj1_qdj := component.BitStateType.Get(elec.TDFJ1_QDJ)
|
|
|
|
|
drive := component.RelayDriveType.Get(elec.TDFJ1_QDJ)
|
|
|
|
|
if !tdfj1_qdj.Val { // 落下状态
|
2023-09-27 18:39:18 +08:00
|
|
|
|
if (!tdfj1_bhj.Val && !tdfj2_bhj.Val) || tdfj1_zbhj.Val { // 电路导通
|
2023-09-26 18:06:15 +08:00
|
|
|
|
drive.Td = true
|
|
|
|
|
if entry.HasComponent(component.CounterDownType) {
|
|
|
|
|
entry.RemoveComponent(component.CounterDownType)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else { // 吸起状态
|
|
|
|
|
if drive.Td && !tdfj1_zbhj.Val && !(tdfj1_bhj.Val && tdfj2_bhj.Val) { // 电路断开
|
|
|
|
|
// 延时电路
|
|
|
|
|
if entry.HasComponent(component.CounterDownType) {
|
|
|
|
|
cd := component.CounterDownType.Get(entry)
|
|
|
|
|
if cd.Val <= 0 {
|
|
|
|
|
drive.Td = false
|
|
|
|
|
entry.RemoveComponent(component.CounterDownType)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
entry.AddComponent(component.CounterDownType, unsafe.Pointer(&component.CounterDown{
|
|
|
|
|
Val: QDJ_DELAY,
|
|
|
|
|
Step: w.Tick(),
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 总保护继电器控制
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_ZBHJ(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
tdfj1_bhj := component.BitStateType.Get(elec.TDFJ1_BHJ)
|
|
|
|
|
tdfj2_bhj := component.BitStateType.Get(elec.TDFJ2_BHJ)
|
|
|
|
|
tdfj1_zbhj := component.RelayDriveType.Get(elec.TDFJ1_ZBHJ)
|
|
|
|
|
if !tdfj1_zbhj.Td { // 未通电
|
|
|
|
|
if tdfj1_bhj.Val && tdfj2_bhj.Val { // 励磁电路导通
|
|
|
|
|
tdfj1_zbhj.Td = true
|
|
|
|
|
}
|
|
|
|
|
} else { // 通电
|
|
|
|
|
if !tdfj1_bhj.Val && !tdfj2_bhj.Val { // 励磁电路断开
|
|
|
|
|
tdfj1_zbhj.Td = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机一断相保护器控制
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_DBQ(w ecs.World, entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
_1dqj := component.BitStateType.Get(elec.TDFJ1_1DQJ)
|
|
|
|
|
_1dqjf := component.BitStateType.Get(elec.TDFJ1_1DQJF)
|
|
|
|
|
_2dqj := component.BitStateType.Get(elec.TDFJ1_2DQJ)
|
|
|
|
|
zzj := component.ZzjType.Get(elec.Zzj1)
|
|
|
|
|
dbq := component.DBQType.Get(elec.TDFJ1_DBQ)
|
|
|
|
|
if dbq.Td { // 通电
|
|
|
|
|
if !(_1dqj.Val && _1dqjf.Val && !zzj.JD12 && !_2dqj.Val) &&
|
|
|
|
|
!(_1dqj.Val && _1dqjf.Val && zzj.JD34 && _2dqj.Val) { // 断开
|
|
|
|
|
dbq.Td = false
|
|
|
|
|
zzj.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else { // 未通电
|
|
|
|
|
if _1dqj.Val && _1dqjf.Val && ((!zzj.JD12 && !_2dqj.Val) || (zzj.JD34 && _2dqj.Val)) { // 通电
|
|
|
|
|
dbq.Td = true
|
|
|
|
|
zzj.Td = true
|
|
|
|
|
zzj.Dw = _2dqj.Val
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机二断相保护器控制
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_DBQ(w ecs.World, entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
_1dqj := component.BitStateType.Get(elec.TDFJ2_1DQJ)
|
|
|
|
|
_1dqjf := component.BitStateType.Get(elec.TDFJ2_1DQJF)
|
|
|
|
|
_2dqj := component.BitStateType.Get(elec.TDFJ2_2DQJ)
|
|
|
|
|
zzj := component.ZzjType.Get(elec.Zzj2)
|
|
|
|
|
dbq := component.DBQType.Get(elec.TDFJ2_DBQ)
|
|
|
|
|
if dbq.Td { // 通电
|
|
|
|
|
if !(_1dqj.Val && _1dqjf.Val && !zzj.JD12 && !_2dqj.Val) &&
|
|
|
|
|
!(_1dqj.Val && _1dqjf.Val && zzj.JD34 && _2dqj.Val) { // 断开
|
|
|
|
|
dbq.Td = false
|
|
|
|
|
zzj.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else { // 未通电
|
|
|
|
|
if _1dqj.Val && _1dqjf.Val && ((!zzj.JD12 && !_2dqj.Val) || (zzj.JD34 && _2dqj.Val)) { // 通电
|
|
|
|
|
dbq.Td = true
|
|
|
|
|
zzj.Td = true
|
|
|
|
|
zzj.Dw = _2dqj.Val
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机一TDFJ_BHJ保护继电器励磁状态控制
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_BHJ(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
dbq := component.DBQType.Get(elec.TDFJ1_DBQ)
|
|
|
|
|
bhj := component.RelayDriveType.Get(elec.TDFJ1_BHJ)
|
|
|
|
|
if !bhj.Td && dbq.Dzkg { // BHJ励磁电路导通
|
|
|
|
|
bhj.Td = true
|
|
|
|
|
} else if bhj.Td && !dbq.Dzkg { // BHJ励磁电路断开
|
|
|
|
|
bhj.Td = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机二TDFJ_BHJ保护继电器励磁状态控制
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_BHJ(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
dbq := component.DBQType.Get(elec.TDFJ2_DBQ)
|
|
|
|
|
bhj := component.RelayDriveType.Get(elec.TDFJ2_BHJ)
|
|
|
|
|
if !bhj.Td && dbq.Dzkg { // BHJ励磁电路导通
|
|
|
|
|
bhj.Td = true
|
|
|
|
|
} else if bhj.Td && !dbq.Dzkg { // BHJ励磁电路断开
|
|
|
|
|
bhj.Td = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机一TDFJ_1DQJF励磁电路逻辑
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_1DQJF(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
tdfj_1dqj := component.BitStateType.Get(elec.TDFJ1_1DQJ)
|
|
|
|
|
tdfj_1dqjf_drive := component.RelayDriveType.Get(elec.TDFJ1_1DQJF)
|
|
|
|
|
if tdfj_1dqjf_drive.Td { // 通电
|
|
|
|
|
if !tdfj_1dqj.Val {
|
|
|
|
|
tdfj_1dqjf_drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else { // 未通电
|
|
|
|
|
if tdfj_1dqj.Val {
|
|
|
|
|
tdfj_1dqjf_drive.Td = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机二TDFJ_1DQJF励磁电路逻辑
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_1DQJF(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
tdfj_1dqj := component.BitStateType.Get(elec.TDFJ2_1DQJ)
|
|
|
|
|
tdfj_1dqjf_drive := component.RelayDriveType.Get(elec.TDFJ2_1DQJF)
|
|
|
|
|
if tdfj_1dqjf_drive.Td { // 通电
|
|
|
|
|
if !tdfj_1dqj.Val {
|
|
|
|
|
tdfj_1dqjf_drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else { // 未通电
|
|
|
|
|
if tdfj_1dqj.Val {
|
|
|
|
|
tdfj_1dqjf_drive.Td = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机一TDFJ_1DQJ励磁电路逻辑
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_1DQJ(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
// 暂时先实现非应急按钮操作
|
|
|
|
|
ycj := component.BitStateType.Get(elec.TDC_YCJ)
|
|
|
|
|
dcj := component.BitStateType.Get(elec.TDC_DCJ)
|
|
|
|
|
fcj := component.BitStateType.Get(elec.TDC_FCJ)
|
|
|
|
|
bhj := component.BitStateType.Get(elec.TDFJ1_BHJ)
|
|
|
|
|
qdj := component.BitStateType.Get(elec.TDFJ1_QDJ)
|
|
|
|
|
drive := component.RelayDriveType.Get(elec.TDFJ1_1DQJ)
|
|
|
|
|
if drive.Td { // 通电
|
|
|
|
|
// 判定是否所有励磁电路断开(todo 暂不考虑应急按钮)
|
|
|
|
|
if !(qdj.Val && bhj.Val) && !(ycj.Val && (fcj.Val || dcj.Val)) { // 电路断开
|
|
|
|
|
drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else { // 未通电
|
|
|
|
|
if ycj.Val && (fcj.Val || dcj.Val) { // 电路导通
|
|
|
|
|
drive.Td = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机二TDFJ_1DQJ励磁电路逻辑
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_1DQJ(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
// 暂时先实现非应急按钮操作
|
|
|
|
|
ycj := component.BitStateType.Get(elec.TDC_YCJ)
|
|
|
|
|
dcj := component.BitStateType.Get(elec.TDC_DCJ)
|
|
|
|
|
fcj := component.BitStateType.Get(elec.TDC_FCJ)
|
|
|
|
|
tdfj1_1dqj := component.BitStateType.Get(elec.TDFJ1_1DQJ)
|
|
|
|
|
bhj := component.BitStateType.Get(elec.TDFJ2_BHJ)
|
|
|
|
|
qdj := component.BitStateType.Get(elec.TDFJ1_QDJ)
|
|
|
|
|
drive := component.RelayDriveType.Get(elec.TDFJ2_1DQJ)
|
|
|
|
|
if drive.Td { // 通电
|
|
|
|
|
if !(qdj.Val && bhj.Val) && !(tdfj1_1dqj.Val && ycj.Val && (fcj.Val || dcj.Val)) { // 电路断开
|
|
|
|
|
drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else { // 未通电
|
|
|
|
|
if tdfj1_1dqj.Val && ycj.Val && (fcj.Val || dcj.Val) { // 电路导通
|
|
|
|
|
drive.Td = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机一TDFJ_2DQJ励磁电路逻辑(暂时未考虑应急盘操作按钮电路)
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_2DQJ(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
tdfj1_1dqjf := component.BitStateType.Get(elec.TDFJ1_1DQJF)
|
|
|
|
|
dcj := component.BitStateType.Get(elec.TDC_DCJ)
|
|
|
|
|
fcj := component.BitStateType.Get(elec.TDC_FCJ)
|
|
|
|
|
drive := component.RelayDriveType.Get(elec.TDFJ1_2DQJ)
|
|
|
|
|
|
|
|
|
|
if drive.Td { // 通电
|
|
|
|
|
if !drive.Xq && tdfj1_1dqjf.Val && dcj.Val {
|
|
|
|
|
drive.Xq = true
|
|
|
|
|
} else if drive.Xq && tdfj1_1dqjf.Val && fcj.Val {
|
|
|
|
|
drive.Xq = false
|
|
|
|
|
} else if !(tdfj1_1dqjf.Val && (dcj.Val || fcj.Val)) { // 断电
|
|
|
|
|
drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else { // 未通电
|
|
|
|
|
if tdfj1_1dqjf.Val {
|
|
|
|
|
if dcj.Val { // 通电,到吸起位
|
|
|
|
|
drive.Td = true
|
|
|
|
|
drive.Xq = true
|
|
|
|
|
} else if fcj.Val { // 通电,到落下位
|
|
|
|
|
drive.Td = true
|
|
|
|
|
drive.Xq = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转辙机二TDFJ_2DQJ励磁电路逻辑(暂时未考虑应急盘操作按钮电路)
|
2023-09-27 18:39:18 +08:00
|
|
|
|
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_2DQJ(elec *component.Zdj9TwoElectronic) {
|
2023-09-26 18:06:15 +08:00
|
|
|
|
tdfj2_1dqjf := component.BitStateType.Get(elec.TDFJ2_1DQJF)
|
|
|
|
|
dcj := component.BitStateType.Get(elec.TDC_DCJ)
|
|
|
|
|
fcj := component.BitStateType.Get(elec.TDC_FCJ)
|
|
|
|
|
drive := component.RelayDriveType.Get(elec.TDFJ2_2DQJ)
|
|
|
|
|
|
|
|
|
|
if drive.Td { // 通电
|
|
|
|
|
if !drive.Xq && tdfj2_1dqjf.Val && dcj.Val {
|
|
|
|
|
drive.Xq = true
|
|
|
|
|
} else if drive.Xq && tdfj2_1dqjf.Val && fcj.Val {
|
|
|
|
|
drive.Xq = false
|
|
|
|
|
} else if !(tdfj2_1dqjf.Val && (dcj.Val || fcj.Val)) { // 断电
|
|
|
|
|
drive.Td = false
|
|
|
|
|
}
|
|
|
|
|
} else { // 未通电
|
|
|
|
|
if tdfj2_1dqjf.Val {
|
|
|
|
|
if dcj.Val { // 通电,到吸起位
|
|
|
|
|
drive.Td = true
|
|
|
|
|
drive.Xq = true
|
|
|
|
|
} else if fcj.Val { // 通电,到落下位
|
|
|
|
|
drive.Td = true
|
|
|
|
|
drive.Xq = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|