【修改列车上下行逻辑】【修改道岔状态属性】
This commit is contained in:
parent
4c7da31d24
commit
ff2ac2b74a
|
@ -210,14 +210,14 @@ type SwitchState struct {
|
|||
|
||||
// 道岔索引
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// 道岔处于定位
|
||||
// 道岔处于定位(表示)
|
||||
Normal bool `protobuf:"varint,2,opt,name=normal,proto3" json:"normal,omitempty"`
|
||||
// 道岔处于反位
|
||||
// 道岔处于反位(表示)
|
||||
Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"`
|
||||
// 道岔处于转动
|
||||
Turning bool `protobuf:"varint,4,opt,name=turning,proto3" json:"turning,omitempty"`
|
||||
// 道岔处于失表状态
|
||||
Split bool `protobuf:"varint,5,opt,name=split,proto3" json:"split,omitempty"`
|
||||
// 道岔处于定位(实际)
|
||||
Dw bool `protobuf:"varint,4,opt,name=dw,proto3" json:"dw,omitempty"`
|
||||
// 道岔处于反位(实际)
|
||||
Fw bool `protobuf:"varint,5,opt,name=fw,proto3" json:"fw,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SwitchState) Reset() {
|
||||
|
@ -273,16 +273,16 @@ func (x *SwitchState) GetReverse() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (x *SwitchState) GetTurning() bool {
|
||||
func (x *SwitchState) GetDw() bool {
|
||||
if x != nil {
|
||||
return x.Turning
|
||||
return x.Dw
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *SwitchState) GetSplit() bool {
|
||||
func (x *SwitchState) GetFw() bool {
|
||||
if x != nil {
|
||||
return x.Split
|
||||
return x.Fw
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -1532,15 +1532,14 @@ var file_device_state_proto_rawDesc = []byte{
|
|||
0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63,
|
||||
0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63,
|
||||
0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x7f, 0x0a, 0x0b, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
|
||||
0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x6f, 0x0a, 0x0b, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
|
||||
0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x75, 0x72, 0x6e, 0x69,
|
||||
0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x74, 0x75, 0x72, 0x6e, 0x69, 0x6e,
|
||||
0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x22, 0x1d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x77, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x02, 0x64, 0x77, 0x12, 0x0e, 0x0a, 0x02, 0x66, 0x77, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x02, 0x66, 0x77, 0x22, 0x1d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1f, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f,
|
||||
0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
|
|
|
@ -91,13 +91,13 @@ func CreateSimulation(projectId int32, mapIds []int32) string {
|
|||
}
|
||||
verifySimulation.SimulationId = simulationId
|
||||
//通知动力学
|
||||
// lineBaseInfo := buildLineBaseInfo(verifySimulation)
|
||||
// httpCode, _, err := dynamics.SendSimulationStartReq(lineBaseInfo)
|
||||
// if httpCode != http.StatusOK || err != nil {
|
||||
// panic(dto.ErrorDto{Code: dto.DynamicsError, Message: fmt.Sprintf("动力学接口调用失败:[%d][%s]", httpCode, err)})
|
||||
// }
|
||||
lineBaseInfo := buildLineBaseInfo(verifySimulation)
|
||||
httpCode, _, err := dynamics.SendSimulationStartReq(lineBaseInfo)
|
||||
if httpCode != http.StatusOK || err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.DynamicsError, Message: fmt.Sprintf("动力学接口调用失败:[%d][%s]", httpCode, err)})
|
||||
}
|
||||
simulationMap.Store(simulationId, verifySimulation)
|
||||
// dynamicsRun(verifySimulation)
|
||||
dynamicsRun(verifySimulation)
|
||||
}
|
||||
return simulationId
|
||||
}
|
||||
|
@ -216,8 +216,8 @@ func dynamicsRun(verifySimulation *memory.VerifySimulation) {
|
|||
}
|
||||
info := dynamics.TurnoutInfo{
|
||||
Code: uint16(code64),
|
||||
NPosition: sta.Normal,
|
||||
RPosition: sta.Reverse,
|
||||
NPosition: sta.Dw,
|
||||
RPosition: sta.Fw,
|
||||
}
|
||||
turnoutInfoSlice = append(turnoutInfoSlice, &info)
|
||||
}
|
||||
|
|
|
@ -102,11 +102,19 @@ func sectionMapToEcsLink(repo *repository.Repository, id string, offset int64, r
|
|||
// 上行
|
||||
var up, abDirection bool
|
||||
if runDirection {
|
||||
up = (ao < bo) == (ak < bk)
|
||||
abDirection = ak < bk
|
||||
if abDirection {
|
||||
up = ao < bo
|
||||
} else {
|
||||
up = ao > bo
|
||||
}
|
||||
} else {
|
||||
up = (ao > bo) == (ak > bk)
|
||||
abDirection = ak > bk
|
||||
if abDirection {
|
||||
up = ao < bo
|
||||
} else {
|
||||
up = ao > bo
|
||||
}
|
||||
}
|
||||
linkId, _ := strconv.Atoi(section.ALinkPosition().Link().Identity.Id())
|
||||
trainKilometer := concertTrainKilometer(ak, offset, up)
|
||||
|
@ -263,9 +271,17 @@ func ecsLinkMapToSection(offset int64, up bool, link *repository.Link) (
|
|||
ao, bo := section.ALinkPosition().Offset(), section.BLinkPosition().Offset()
|
||||
ak, bk := section.AKilometer().Value, section.BKilometer().Value
|
||||
if up {
|
||||
runDirection = (ak > bk) == (ao > bo)
|
||||
if ao < bo {
|
||||
runDirection = ak < bk
|
||||
} else {
|
||||
runDirection = ak > bk
|
||||
}
|
||||
} else {
|
||||
runDirection = (ao > bo) == (ak < bk)
|
||||
if ao > bo {
|
||||
runDirection = ak < bk
|
||||
} else {
|
||||
runDirection = ak > bk
|
||||
}
|
||||
}
|
||||
pointTo = runDirection == (ak < bk)
|
||||
// a点偏移 大于 b点偏移
|
||||
|
|
|
@ -59,11 +59,9 @@ func handlerTurnoutState(w ecs.World, uid string) *state.SwitchState {
|
|||
fmt.Printf("id=%s的道岔不存在", uid)
|
||||
return nil
|
||||
}
|
||||
if !entry.HasComponent(component.Zdj9TwoElectronicType) {
|
||||
if !entry.HasComponent(component.TurnoutPositionType) {
|
||||
return nil
|
||||
}
|
||||
zdj9 := component.Zdj9TwoElectronicType.Get(entry)
|
||||
dcj := component.BitStateType.Get(zdj9.TDC_DCJ)
|
||||
fcj := component.BitStateType.Get(zdj9.TDC_FCJ)
|
||||
return &state.SwitchState{Normal: dcj.Val, Reverse: fcj.Val, Split: !(dcj.Val || fcj.Val)}
|
||||
pos := component.TurnoutPositionType.Get(entry)
|
||||
return &state.SwitchState{Normal: pos.Db, Reverse: pos.Fb, Dw: pos.Dw, Fw: pos.Fw}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 62bbe3a0dee7954dce5fd4fb4ad4d186c0e5430b
|
||||
Subproject commit 6702c9ad5890c1a9bf21f4f4ed777346d04327c7
|
|
@ -1 +1 @@
|
|||
Subproject commit 6a6bd7ec7eb51cd0079be4219bd4384894fa427b
|
||||
Subproject commit 665adde46e266c800217bbf2033168698dafa284
|
Loading…
Reference in New Issue