升级go版本到1.21
切换fmt输出为slog输出 继电器entity构建添加整流型
This commit is contained in:
parent
99ddf43372
commit
9e1d108c77
@ -8,8 +8,8 @@ var (
|
||||
RelayTag = ecs.NewTag()
|
||||
// 无极继电器
|
||||
WjRelayTag = ecs.NewTag()
|
||||
// 偏极继电器
|
||||
PjRelayTag = ecs.NewTag()
|
||||
// // 偏极继电器
|
||||
// PjRelayTag = ecs.NewTag()
|
||||
// 有极
|
||||
YjRelayTag = ecs.NewTag()
|
||||
// 缓放继电器
|
||||
|
@ -19,11 +19,8 @@ func NewRelayEntity(w ecs.World, relay *repository.Relay, entityMap map[string]*
|
||||
component.UidType.SetValue(entry, component.Uid{Id: uid})
|
||||
if strings.Contains(model, "Y") { // 有极继电器
|
||||
entry.AddComponent(component.YjRelayTag)
|
||||
} else if strings.Contains(model, "W") { // 无极继电器
|
||||
} else if strings.Contains(model, "W") || strings.Contains(model, "Z") || strings.Contains(model, "P") { // 无极继电器
|
||||
entry.AddComponent(component.WjRelayTag)
|
||||
} else if strings.Contains(model, "P") { // 偏极继电器
|
||||
entry.AddComponent(component.WjRelayTag)
|
||||
entry.AddComponent(component.PjRelayTag)
|
||||
}
|
||||
if strings.Contains(model, "H") { // 缓放继电器
|
||||
entry.AddComponent(component.HfRelayTag)
|
||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module joylink.club/rtsssimulation
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/yohamta/donburi v1.3.8
|
||||
|
@ -14,6 +14,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
|
||||
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
|
||||
golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c=
|
||||
golang.org/x/mobile v0.0.0-20221012134814-c746ac228303/go.mod h1:M32cGdzp91A8Ex9qQtyZinr19EYxzkFqDjW2oyHzTDQ=
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 47f78cb54ddc2673b87d3f85eea23e3769e417ad
|
||||
Subproject commit e7797346722a572814539d9a453789b89ffe6bf4
|
@ -1,7 +1,7 @@
|
||||
package circuit_sys
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
@ -147,7 +147,7 @@ func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_QDJ(w ecs.World, entry *ecs.Entry, ele
|
||||
if !drive.Td && (!tdfj1_bhj.Val && !tdfj2_bhj.Val) || tdfj1_zbhj.Val { // 电路导通
|
||||
drive.Td = true
|
||||
elec.TDFJ1_QDJ_Remain = consts.QDJ_DELAY
|
||||
fmt.Println("切断继电器通电")
|
||||
slog.Debug("切断继电器通电")
|
||||
}
|
||||
} else { // 吸起状态
|
||||
if drive.Td && !tdfj1_zbhj.Val && !(!tdfj1_bhj.Val && !tdfj2_bhj.Val) { // 电路断开
|
||||
@ -157,7 +157,7 @@ func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_QDJ(w ecs.World, entry *ecs.Entry, ele
|
||||
if remain <= 0 {
|
||||
elec.TDFJ1_QDJ_Remain = 0
|
||||
drive.Td = false
|
||||
fmt.Println("切断继电器断电")
|
||||
slog.Debug("切断继电器断电")
|
||||
} else {
|
||||
elec.TDFJ1_QDJ_Remain = remain
|
||||
}
|
||||
@ -211,21 +211,21 @@ func (zdj9 *ZDJ9TwoDragSys) exciteDBQ(i int, _1dqj *component.BitState, _1dqjf *
|
||||
!(_1dqj.Val && _1dqjf.Val && zzj.JD34 && _2dqj.Val) { // 断开
|
||||
dbq.Td = false
|
||||
zzj.Td = false
|
||||
fmt.Printf("转辙机%v断电\n", i)
|
||||
slog.Debug("转辙机%v断电\n", i)
|
||||
} else { // 处理正反转
|
||||
if zzj.Dw && !_2dqj.Val {
|
||||
zzj.Dw = false
|
||||
fmt.Printf("转辙机%v转到反位\n", i)
|
||||
slog.Debug("转辙机%v转到反位\n", i)
|
||||
} else if !zzj.Dw && _2dqj.Val {
|
||||
zzj.Dw = true
|
||||
fmt.Printf("转辙机%v转到定位\n", i)
|
||||
slog.Debug("转辙机%v转到定位\n", i)
|
||||
}
|
||||
}
|
||||
} else { // 未通电
|
||||
if _1dqj.Val && _1dqjf.Val && ((!zzj.JD12 && !_2dqj.Val) || (zzj.JD34 && _2dqj.Val)) { // 通电
|
||||
dbq.Td = true
|
||||
zzj.Td = true
|
||||
fmt.Printf("转辙机%v通电\n", i)
|
||||
slog.Debug("转辙机%v通电\n", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,13 +295,13 @@ func (zdj9 *ZDJ9TwoDragSys) exciteM1_TDFJ_1DQJ(elec *component.Zdj9TwoElectronic
|
||||
// 判定是否所有励磁电路断开(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断电")
|
||||
slog.Debug("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通电")
|
||||
slog.Debug("TDFJ1_1DQJ通电")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -321,12 +321,12 @@ func (zdj9 *ZDJ9TwoDragSys) exciteM2_TDFJ_1DQJ(elec *component.Zdj9TwoElectronic
|
||||
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断电")
|
||||
slog.Debug("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通电")
|
||||
slog.Debug("TDFJ2_1DQJ通电")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -356,24 +356,24 @@ func (zdj9 *ZDJ9TwoDragSys) excite2DQJ(i int, _1dqjf *component.BitState, dcj *c
|
||||
if drive.Td { // 通电
|
||||
if !drive.Xq && _1dqjf.Val && dcj.Val {
|
||||
drive.Xq = true
|
||||
fmt.Printf("TDFJ%v_2DQJ到定位\n", i)
|
||||
slog.Debug("TDFJ%v_2DQJ到定位\n", i)
|
||||
} else if drive.Xq && _1dqjf.Val && fcj.Val {
|
||||
drive.Xq = false
|
||||
fmt.Printf("TDFJ%v_2DQJ到反位\n", i)
|
||||
slog.Debug("TDFJ%v_2DQJ到反位\n", i)
|
||||
} else if !(_1dqjf.Val && (dcj.Val || fcj.Val)) { // 断电
|
||||
drive.Td = false
|
||||
fmt.Printf("TDFJ%v_2DQJ断电\n", i)
|
||||
slog.Debug("TDFJ%v_2DQJ断电\n", i)
|
||||
}
|
||||
} else { // 未通电
|
||||
if _1dqjf.Val {
|
||||
if dcj.Val { // 通电,到吸起位
|
||||
drive.Td = true
|
||||
drive.Xq = true
|
||||
fmt.Printf("TDFJ%v_2DQJ通电,到吸起位\n", i)
|
||||
slog.Debug("TDFJ%v_2DQJ通电,到吸起位\n", i)
|
||||
} else if fcj.Val { // 通电,到落下位
|
||||
drive.Td = true
|
||||
drive.Xq = false
|
||||
fmt.Printf("TDFJ%v_2DQJ通电,到落下位\n", i)
|
||||
slog.Debug("TDFJ%v_2DQJ通电,到落下位\n", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user