iscs pscada 一次图 电力传递实现

This commit is contained in:
xzb 2023-12-22 13:28:39 +08:00
parent 44ee9266f8
commit 19f14ec506

View File

@ -32,6 +32,46 @@ func TransBusbarBackupOperate(w ecs.World, deviceId string, input bool) error {
///////////////////////////////////////////////////////////
// CircuitBreakerOperate 断路器操作
func CircuitBreakerOperate(w ecs.World, deviceId string, close bool) error {
r := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
wd := entity.GetWorldData(w)
deviceEntry, ok := wd.EntityMap[deviceId]
if !ok {
return ecs.NewErrResult(fmt.Errorf("设备[%s]实体不存在", deviceId))
}
//
if !deviceEntry.HasComponent(component.CircuitBreakerType) {
return ecs.NewErrResult(fmt.Errorf("设备[%s]不是断路器", deviceId))
}
component.CircuitBreakerType.Get(deviceEntry).Closed = close
return ecs.NewOkEmptyResult()
})
return r.Err
}
////////////////////////////////////////////////////////
// DisconnectorOperate 隔离开关操作
func DisconnectorOperate(w ecs.World, deviceId string, close bool) error {
r := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
wd := entity.GetWorldData(w)
deviceEntry, ok := wd.EntityMap[deviceId]
if !ok {
return ecs.NewErrResult(fmt.Errorf("设备[%s]实体不存在", deviceId))
}
//
if !deviceEntry.HasComponent(component.DisconnectorType) {
return ecs.NewErrResult(fmt.Errorf("设备[%s]不是隔离开关", deviceId))
}
component.DisconnectorType.Get(deviceEntry).Closed = close
return ecs.NewOkEmptyResult()
})
return r.Err
}
//////////////////////////////////////////////////////////
// SwitchThreePositionOptEnum 三工位开关操作枚举定义
type SwitchThreePositionOptEnum = uint8