459 lines
15 KiB
Go
459 lines
15 KiB
Go
package circuit_sys
|
||
|
||
import (
|
||
"fmt"
|
||
|
||
"github.com/yohamta/donburi/filter"
|
||
"joylink.club/ecs"
|
||
"joylink.club/rtsssimulation/component"
|
||
)
|
||
|
||
// ZDJ9双机牵引道岔电路系统
|
||
type ZDJ9TwoDragSys struct {
|
||
query *ecs.Query
|
||
}
|
||
|
||
func NewZdj9TwoDragSys() *ZDJ9TwoDragSys {
|
||
return &ZDJ9TwoDragSys{
|
||
query: ecs.NewQuery(filter.Contains(component.Zdj9TwoElectronicType, component.TurnoutZzjType)),
|
||
}
|
||
}
|
||
|
||
// 电路更新
|
||
func (zdj9 *ZDJ9TwoDragSys) Update(w ecs.World) {
|
||
zdj9.query.Each(w, func(entry *ecs.Entry) {
|
||
elec := component.Zdj9TwoElectronicType.Get(entry)
|
||
// 转辙机一机电路相关动作
|
||
// 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)
|
||
// 定表/反表继电器
|
||
zdj9.exciteM1_TDFJ1_DFBJ(entry, elec)
|
||
|
||
// 转辙机二机电路相关动作
|
||
// 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)
|
||
// 定表/反表继电器
|
||
zdj9.exciteM2_TDFJ1_DFBJ(entry, elec)
|
||
|
||
// 总定表/反表继电器
|
||
zdj9.exciteZDFBJ(elec)
|
||
})
|
||
}
|
||
|
||
// 总定表、反表继电器控制
|
||
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
|
||
}
|
||
}
|
||
}
|
||
|
||
// 二极管整流电路为继电器励磁电路提供半波整流电源
|
||
// 转辙机一定表/反表继电器控制
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ1_DFBJ(entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
||
_1dqj := component.BitStateType.Get(elec.TDFJ1_1DQJ)
|
||
_2dqj := component.BitStateType.Get(elec.TDFJ1_2DQJ)
|
||
zzj := component.GetTurnoutZzj1State(entry)
|
||
dbj_drive := component.RelayDriveType.Get(elec.TDFJ1_DBJ)
|
||
fbj_drive := component.RelayDriveType.Get(elec.TDFJ1_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
|
||
}
|
||
}
|
||
}
|
||
|
||
// 转辙机二定表/反表继电器控制
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ1_DFBJ(entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
||
_1dqj := component.BitStateType.Get(elec.TDFJ2_1DQJ)
|
||
_2dqj := component.BitStateType.Get(elec.TDFJ2_2DQJ)
|
||
zzj := component.GetTurnoutZzj2State(entry)
|
||
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
|
||
}
|
||
}
|
||
}
|
||
|
||
// 切断继电器延时缓放电路缓放时间,单位ms
|
||
const QDJ_DELAY = 3 * 1000
|
||
|
||
// 切断继电器控制
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_QDJ(w ecs.World, entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
||
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 { // 落下状态
|
||
if !drive.Td && (!tdfj1_bhj.Val && !tdfj2_bhj.Val) || tdfj1_zbhj.Val { // 电路导通
|
||
drive.Td = true
|
||
elec.TDFJ1_QDJ_Remain = QDJ_DELAY
|
||
fmt.Println("切断继电器通电")
|
||
// if entry.HasComponent(component.CounterDownType) {
|
||
// entry.RemoveComponent(component.CounterDownType)
|
||
// }
|
||
}
|
||
} else { // 吸起状态
|
||
if drive.Td && !tdfj1_zbhj.Val && !(!tdfj1_bhj.Val && !tdfj2_bhj.Val) { // 电路断开
|
||
// 延时电路
|
||
if elec.TDFJ1_QDJ_Remain > 0 {
|
||
remain := elec.TDFJ1_QDJ_Remain - w.Tick()
|
||
if remain <= 0 {
|
||
elec.TDFJ1_QDJ_Remain = 0
|
||
drive.Td = false
|
||
fmt.Println("切断继电器断电")
|
||
} else {
|
||
elec.TDFJ1_QDJ_Remain = remain
|
||
}
|
||
}
|
||
// 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(),
|
||
// }))
|
||
// }
|
||
}
|
||
}
|
||
}
|
||
|
||
// 总保护继电器控制
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_ZBHJ(elec *component.Zdj9TwoElectronic) {
|
||
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
|
||
}
|
||
}
|
||
}
|
||
|
||
// 转辙机一断相保护器控制
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_DBQ(w ecs.World, entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
||
_1dqj := component.BitStateType.Get(elec.TDFJ1_1DQJ)
|
||
_1dqjf := component.BitStateType.Get(elec.TDFJ1_1DQJF)
|
||
_2dqj := component.BitStateType.Get(elec.TDFJ1_2DQJ)
|
||
zzj := component.GetTurnoutZzj1State(entry)
|
||
dbq := component.DBQStateType.Get(elec.TDFJ1_DBQ)
|
||
zdj9.exciteDBQ(_1dqj, _1dqjf, _2dqj, dbq, zzj)
|
||
// 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 zzj.Dw && !_2dqj.Val {
|
||
// zzj.Dw = false
|
||
// } else if !zzj.Dw && _2dqj.Val {
|
||
// zzj.Dw = true
|
||
// }
|
||
// }
|
||
// } else { // 未通电
|
||
// if _1dqj.Val && _1dqjf.Val && ((!zzj.JD12 && !_2dqj.Val) || (zzj.JD34 && _2dqj.Val)) { // 通电
|
||
// dbq.Td = true
|
||
// zzj.Td = true
|
||
// }
|
||
// }
|
||
}
|
||
|
||
// 转辙机二断相保护器控制
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_DBQ(w ecs.World, entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
||
_1dqj := component.BitStateType.Get(elec.TDFJ2_1DQJ)
|
||
_1dqjf := component.BitStateType.Get(elec.TDFJ2_1DQJF)
|
||
_2dqj := component.BitStateType.Get(elec.TDFJ2_2DQJ)
|
||
zzj := component.GetTurnoutZzj2State(entry)
|
||
dbq := component.DBQStateType.Get(elec.TDFJ2_DBQ)
|
||
zdj9.exciteDBQ(_1dqj, _1dqjf, _2dqj, dbq, zzj)
|
||
// 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
|
||
// }
|
||
// }
|
||
}
|
||
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteDBQ(_1dqj *component.BitState, _1dqjf *component.BitState, _2dqj *component.BitState,
|
||
dbq *component.DBQState, zzj *component.ZzjState) {
|
||
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
|
||
fmt.Println("转辙机断电")
|
||
} else { // 处理正反转
|
||
if zzj.Dw && !_2dqj.Val {
|
||
zzj.Dw = false
|
||
fmt.Println("转辙机转到反位")
|
||
} else if !zzj.Dw && _2dqj.Val {
|
||
zzj.Dw = true
|
||
fmt.Println("转辙机转到定位")
|
||
}
|
||
}
|
||
} else { // 未通电
|
||
if _1dqj.Val && _1dqjf.Val && ((!zzj.JD12 && !_2dqj.Val) || (zzj.JD34 && _2dqj.Val)) { // 通电
|
||
dbq.Td = true
|
||
zzj.Td = true
|
||
fmt.Println("转辙机通电")
|
||
}
|
||
}
|
||
}
|
||
|
||
// 转辙机一TDFJ_BHJ保护继电器励磁状态控制
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_BHJ(elec *component.Zdj9TwoElectronic) {
|
||
dbq := component.DBQStateType.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保护继电器励磁状态控制
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_BHJ(elec *component.Zdj9TwoElectronic) {
|
||
dbq := component.DBQStateType.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励磁电路逻辑
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_1DQJF(elec *component.Zdj9TwoElectronic) {
|
||
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励磁电路逻辑
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_1DQJF(elec *component.Zdj9TwoElectronic) {
|
||
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励磁电路逻辑
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_1DQJ(elec *component.Zdj9TwoElectronic) {
|
||
// 暂时先实现非应急按钮操作
|
||
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)
|
||
tdfj1_2dqj := component.BitStateType.Get(elec.TDFJ1_2DQJ)
|
||
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 && ((tdfj1_2dqj.Val && fcj.Val) || (!tdfj1_2dqj.Val && dcj.Val))) { // 电路断开
|
||
drive.Td = false
|
||
fmt.Println("TDFJ1_1DQJ断电")
|
||
}
|
||
} else { // 未通电
|
||
if (ycj.Val && ((tdfj1_2dqj.Val && fcj.Val) || (!tdfj1_2dqj.Val && dcj.Val))) ||
|
||
(tdfj1_1dqj.Val && qdj.Val && bhj.Val) { // 电路导通
|
||
drive.Td = true
|
||
fmt.Println("TDFJ1_1DQJ通电")
|
||
}
|
||
}
|
||
}
|
||
|
||
// 转辙机二TDFJ_1DQJ励磁电路逻辑
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_1DQJ(elec *component.Zdj9TwoElectronic) {
|
||
// 暂时先实现非应急按钮操作
|
||
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)
|
||
tdfj2_1dqj := component.BitStateType.Get(elec.TDFJ2_1DQJ)
|
||
tdfj2_2dqj := component.BitStateType.Get(elec.TDFJ2_2DQJ)
|
||
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 && ((tdfj2_2dqj.Val && fcj.Val) || (!tdfj2_2dqj.Val && dcj.Val))) { // 电路断开
|
||
drive.Td = false
|
||
fmt.Println("TDFJ2_1DQJ断电")
|
||
}
|
||
} else { // 未通电
|
||
if (tdfj1_1dqj.Val && ycj.Val && ((tdfj2_2dqj.Val && fcj.Val) || (!tdfj2_2dqj.Val && dcj.Val))) || (tdfj2_1dqj.Val && qdj.Val && bhj.Val) { // 电路导通
|
||
drive.Td = true
|
||
fmt.Println("TDFJ2_1DQJ通电")
|
||
}
|
||
}
|
||
}
|
||
|
||
// 转辙机一TDFJ_2DQJ励磁电路逻辑(暂时未考虑应急盘操作按钮电路)
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_2DQJ(elec *component.Zdj9TwoElectronic) {
|
||
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
|
||
fmt.Println("TDFJ1_2DQJ到定位")
|
||
} else if drive.Xq && tdfj1_1dqjf.Val && fcj.Val {
|
||
drive.Xq = false
|
||
fmt.Println("TDFJ1_2DQJ到反位")
|
||
} else if !(tdfj1_1dqjf.Val && (dcj.Val || fcj.Val)) { // 断电
|
||
drive.Td = false
|
||
fmt.Println("TDFJ1_2DQJ断电")
|
||
}
|
||
} else { // 未通电
|
||
if tdfj1_1dqjf.Val {
|
||
if dcj.Val { // 通电,到吸起位
|
||
drive.Td = true
|
||
drive.Xq = true
|
||
fmt.Println("TDFJ1_2DQJ通电,到吸起位")
|
||
} else if fcj.Val { // 通电,到落下位
|
||
drive.Td = true
|
||
drive.Xq = false
|
||
fmt.Println("TDFJ1_2DQJ通电,到落下位")
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// 转辙机二TDFJ_2DQJ励磁电路逻辑(暂时未考虑应急盘操作按钮电路)
|
||
func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_2DQJ(elec *component.Zdj9TwoElectronic) {
|
||
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
|
||
fmt.Println("TDFJ2_2DQJ到定位")
|
||
} else if drive.Xq && tdfj2_1dqjf.Val && fcj.Val {
|
||
drive.Xq = false
|
||
fmt.Println("TDFJ2_2DQJ到反位")
|
||
} else if !(tdfj2_1dqjf.Val && (dcj.Val || fcj.Val)) { // 断电
|
||
drive.Td = false
|
||
fmt.Println("TDFJ2_2DQJ断电")
|
||
}
|
||
} else { // 未通电
|
||
if tdfj2_1dqjf.Val {
|
||
if dcj.Val { // 通电,到吸起位
|
||
drive.Td = true
|
||
drive.Xq = true
|
||
fmt.Println("TDFJ2_2DQJ通电,到吸起位")
|
||
} else if fcj.Val { // 通电,到落下位
|
||
drive.Td = true
|
||
drive.Xq = false
|
||
fmt.Println("TDFJ2_2DQJ通电,到落下位")
|
||
}
|
||
}
|
||
}
|
||
}
|