模型信息

模型ID: 149

模型中文名: 机组偏航工作异常

模型英文名:Model_149_Alarm_GenYawWorkAbnormal

当前版本: Model_149_AlarmRT0_GenAccNoiseInYaw_V6.3.100.0_IPHM

模板版本:R_WT_v6.2.0_20220301

首发日期:2024-10-28

最近一次更新:2024-11-13

设备类型:风机

设备类型配置:GW1500,GW2000,GW2500,GW3000,GW3S,GW4S,GW4H,GW4000,GW5H,GW6H等金风系列兆瓦机型

模型测点:2022-11-04:

model_iec

cn_name

possible_list

xacce

x方向加速度

WTUR_Acce_Ra_F32_x,WNAC_Acce_Ra_F32_Itilt,WTUR_Acce_Ra_F32_X,WTRM_Acce_Ra_F32_x,WTOW_Acce_Ra_F32_x,WTUR_Other_Rw_F32_ZD,WNAC_Other_Ra_F32_x,WNAC.Other.Ra.F32.VibrationX

yacce

y方向加速度

WTUR_Acce_Ra_F32_y,WNAC_Acce_Ra_F32_Iroll,WTUR_Acce_Ra_F32_Y,WTRM_Acce_Ra_F32_y,WTOW_Acce_Ra_F32_y,WTUR_Other_Rw_F32_NOZD,WNAC_Other_Ra_F32_y,WNAC.Other.Ra.F32.VibrationY

accavg

加速度有效值

WTUR_Acce_Ra_F32

accmax

加速度峰值

WTUR.Acce.Ra.F32.max

rpm

发电机转速

WGEN_Spd_Ra_F32

windspeed

风速

WTUR_WSpd_Ra_F32

yawspeed

偏航速度

WYAW_Spd_Ra_F32_Yaw

yawposi

偏航位置

WYAW_Posi_Ra_F32

untwist

解缆标志位

WYAW_Bool_Rd_b0_UnTwist

lyawflag

左偏航标志位

WYAW_Bool_Rd_b0_Lyaw,WNAC_Bool_Rd_b0_moveleft

yyawflag

右偏航标志位

WYAW_Bool_Rd_b0_Ryaw,WNAC_Bool_Rd_b0_moveright

yawhours

偏航电机工作时间

WYAW.CTim.Rt.F32.YGen1,WYAW.CTim.Rt.F32.YGen2,WYAW.CTim.Rt.F32.YGen3,WYAW_CTim_Rt_F32_YGen4

rectime

时间

rectime,WMAN.TM,rectime,WTUR_Tm_Rw_Dt

sectorpistart

扇区控制开始偏航位置

WYAW.Other.Ra.F32.SectorpositbeginCFG

sectorpiend

扇区控制结束偏航位置

WYAW.Other.Ra.F32.SectorpositendCFG

yawforwindallowtime

微风转动偏航对风允许时间

WYAW.Other.Ra.F32.YawforwindallowtimeCFG

yawforwindintervaltime

微风转动偏航对风间隔时间

WYAW.Other.Ra.F32.YawforwindintervaltimeCFG

yawgearnum

偏航轴承齿数

WYAW.Other.Rn.U16.GearnrselectCFG

yawcount

偏航动作次数

WYAW_Other_Rn_U32_DriveOnCount

应用项目:IPHM

算法说明:

理论依据:工作条件下,时间频次出现异常;

1.偏航状态下机组振动异常:偏航异响、磨损、偏航时振动大,偏航状态条件下,机组的振动加速度超限或濒临超限;

2.偏航频繁:偏航动作信号变换低于5分钟动作一次的情况;

3.偏航时间过长:连续偏航超过2个小时的情况,可以用偏航电机工作时间来确定;连续2个小时内超过1.5小时都在偏航的情况;

4.机组长时不偏航:偏航信号有变化或偏航启动信号使能信号有触发,但偏航位置没有变化的情况或信号时间长度和偏航电机工作时间异常。

测试时问题:SPHM转换到IPHM失败的地方:

1.同机组云服务的测点比IPHM实时库的测点要多的多;

2.IPHM的协议将不同数据类型混淆到一起,云服务的按数据类型进行了区分,绝不会在一种数据类型选测点或扩展测点时问题;

3.当一个产品觉得自己的模型很成熟时,这个产品算走到头了。有了停止前进的想法,总觉得自己的产品做的非常好的时候,就是在退步了。

4.模型模版sdk的失败,增加了更多的团队的维护量,不同版本反复维护和反复迭代;觉得省事了,技术进步了,但维护量和维护的人数增加了许多倍。原来是一个人维护,现在是三个人维护(开发人、算法、软件部署更新人),可能产品不承认,但事实确实如此。

5.调度平台迭代,第一代IPHM的调度太差了,各种不稳定。

版本修改

2024-10-25:

编写工程化代码

模型字段写入yaml

library(magrittr)
library(yaml)


# 获取配置文件内容
config <- read_yaml("ModelConfig.yaml")

config$get_excel_ieccn$model_iec  = 
  c('xacce','yacce','accavg','rpm','windspeed','yawspeed','yawposi','untwist','lyawflag','yyawflag','rectime')
config$get_excel_ieccn$possible_list  = 
  c('WTUR_Acce_Ra_F32_x,WNAC_Acce_Ra_F32_Itilt,WTUR_Acce_Ra_F32_X,WTRM_Acce_Ra_F32_x,WTOW_Acce_Ra_F32_x,WTUR_Other_Rw_F32_ZD,WNAC_Other_Ra_F32_x,WNAC.Other.Ra.F32.VibrationX' ,   
    'WTUR_Acce_Ra_F32_y,WNAC_Acce_Ra_F32_Iroll,WTUR_Acce_Ra_F32_Y,WTRM_Acce_Ra_F32_y,WTOW_Acce_Ra_F32_y,WTUR_Other_Rw_F32_NOZD,WNAC_Other_Ra_F32_y,WNAC.Other.Ra.F32.VibrationY',
    'WTUR_Acce_Ra_F32',
        'WGEN_Spd_Ra_F32',
        'WTUR_WSpd_Ra_F32',
        'WYAW_Spd_Ra_F32_Yaw',
        'WYAW_Posi_Ra_F32',
        'WYAW_Bool_Rd_b0_UnTwist',
        'WYAW_Bool_Rd_b0_Lyaw',
    'WYAW_Bool_Rd_b0_Ryaw',
        'rectime,WMAN.TM,rectime,WTUR_Tm_Rw_Dt'
    )
config$get_excel_ieccn$cn_name = 
  c('x方向加速度','y方向加速度','加速度有效值','发电机转速','风速','偏航速度','偏航位置','解缆标志位','左偏航标志位','右偏航标志位','时间')


# 获取模型配置的测点参数
get_excel_ieccn = config$get_excel_ieccn %>% data.frame()

# 在已有的yaml文件中追加写yaml文件
yaml_obj = NULL

# 加载已存在的YAML文件
yaml_obj$get_excel_ieccn = get_excel_ieccn

# 在加载的YAML对象上进行修改
yaml_obj$intervalHours <- 24
yaml_obj$projectName = '149'
yaml_obj$projectType = 'alarm'
yaml_obj$logFileName = 'a.txt'   # initial log file,required
yaml_obj$drawPicIf = F
yaml_obj$user_config_enable = F   # 是否启用用户参数配置:默认没有该配置,除非特定项目要求
yaml_obj$IS_TRANSLATE = F         # 是否启用国际化翻译:默认没有该配置,除非特定项目要求


# 再次写入文件
write_yaml(yaml_obj, "model_config.yaml")

代码加密

library(compiler)
options(encoding = 'UTF-8')
file_proj = basename(getwd())
if(!exists(file_proj)) {dir.create(file_proj)}
cmpfile(infile = 'Config.R' ,outfile = file.path('.',file_proj,'Config.Rc'))
cmpfile(infile = 'DataService.R' ,outfile = file.path('.',file_proj,'DataService.Rc'))
cmpfile(infile = 'DataReader.R' ,outfile = file.path('.',file_proj,'DataReader.Rc'))
cmpfile(infile = 'ENumType.R' ,outfile = file.path('.',file_proj,'ENumType.Rc'))
cmpfile(infile = 'Util.R' ,outfile = file.path('.',file_proj,'Util.Rc'))
cmpfile(infile = 'AlarmResult.R' ,outfile = file.path('.',file_proj,'AlarmResult.Rc'))
cmpfile(infile = 'DataWrite.R' ,outfile = file.path('.',file_proj,'DataWrite.Rc'))
cmpfile(infile = 'Model.R' ,outfile = file.path('.',file_proj,'Model.Rc'))     
cmpfile(infile = 'ModelUtil.R' ,outfile = file.path('.',file_proj,'ModelUtil.Rc') )
cmpfile(infile = 'DataReaderAWS.R' ,outfile = file.path('.',file_proj,'DataReaderAWS.Rc'))
cmpfile(infile = 'ModelUtil.R' ,outfile = file.path('.',file_proj,'ModelUtil.Rc') )
cmpfile(infile = 'SystemConfig.R' ,outfile = file.path('.',file_proj,'SystemConfig.Rc'))
cmpfile(infile = 'GetUserPara.R' ,outfile = file.path('.',file_proj,'GetUserPara.Rc'))
# 将其他文件不需要加密的文件copy到工程文件夹中,然后打压缩包
file.copy(from = 'Main.R',to = file.path('.',file_proj,'Main.R'),overwrite = T)
file.copy(from = 'MainLocal.R',to = file.path('.',file_proj,'MainLocal.R'),overwrite = T)
file.copy(from = 'ModelConfig.yaml',to = file.path('.',file_proj,'ModelConfig.yaml'),overwrite = T)
file.copy(from = list.files(pattern = '.Rproj')[1],to = file.path('.',file_proj,list.files(pattern = '.Rproj')[1]),overwrite = T)
file.copy(from = 'code_config.yaml',to = file.path('.',file_proj,'code_config.yaml'),overwrite = T)


# 将加密的文件批量上传更新到SVN发版位置
files = list.files(file.path(getwd(),file_proj),full.names = T)
target_dir = 'D:\\SVN\\WiTur_box\\异常告警\\发版版本\\MODEL_NEW'
target_dir2 = file.path(target_dir,file_proj)
if (!dir.exists(target_dir2)) {
    dir.create(target_dir2, recursive = TRUE)
}
file.copy(files, target_dir2, overwrite = TRUE)
owd::owd(target_dir)

# 删除本地的文件夹及测试的日志文件,只保留加密的最新版本
unlink(file_proj, recursive = TRUE)
logfilename = list.files(pattern = '.log')
 file.remove(logfilename)  # 删除日志文件

相关报告

本地批量测试示例

本地测试是引用本地的案例进行测试,也可以通过Model文件进行个例测试或通过Main文件进行测试。

rm(list = ls())

if (file.exists('Util.R')){
    source('Util.R',encoding = 'UTF-8')
} else {
    compiler::loadcmp('Util.Rc')
}
# 故障测试 =========
load("加速度超限故障.RData")
RfileChoose('AlarmResult')
RfileChoose('Model')
runmode = 0
aResultList = ''
pjmResult  = PJMResult

# which(rpm_fault$风机编号 == '622127098')

purrr::map(1:nrow(rpm_fault),function(i){
    message('第',i,'个案例测试...')
    result <- try({

        pjmResult$ScadaWTID =  rpm_fault$风机编号[i]
        pjmResult$ScadaWFID = rpm_fault$风场编号[i]
        pjmResult$trigger_time = as.POSIXct(rpm_fault$故障截至时间[i])   + lubridate::duration(hour =  24)
        pjmResult$RunDate = gsub('-|:| ','',pjmResult$trigger_time) %>% substring(first = 1,last = 8)
        aResultList = runModel(pjmResult = pjmResult,aResultList = aResultList)
        aResultList_DF = aResultList   %>% bind_rows()
    
        write.table(aResultList_DF,file = '加速度超限4.xls',append = T,row.names = F,sep = ';',fileEncoding = 'GBK')
    print(aResultList_DF)

        # RfileChoose('DataWrite')
        # Warning_ResultInfo1 = aResultList
        # lapply(1:length(Warning_ResultInfo1), function(x){Warning_ResultInfo1[[x]]$jobRecordID <<- pjmResult$jobRecordID})
        # Warning_ResultInfo1[[1]]$jobRecordID <- pjmResult$jobRecordID
        # Warning_ComentList = lapply(1:length(Warning_ResultInfo1), function(x){paste0('Model',x,':',Warning_ResultInfo1[[x]]$Comment)}) %>% unlist %>% paste(collapse = '。')
        # Warning_ErrorMessages = lapply(1:length(Warning_ResultInfo1), function(x){paste0(Warning_ResultInfo1[[x]]$ErrorMessage)}) %>% unlist %>% paste(collapse = ' ')
        # Warning_StateList = lapply(1:length(Warning_ResultInfo1), function(x){paste0('Model',x,':',Warning_ResultInfo1[[x]]$ModelStatus)}) %>% unlist %>% paste(collapse = ' ')
        # pjmResult$WTStatus = ifelse(length(grep('error|Error',c(Warning_ErrorMessages))) == 0,PJMStatus$PROJECT_STATUS_STATE_FINISHED,PJMStatus$PROJECT_STATUS_STATE_ERROR)
        # # 将结果推送到库里
        # todymodbST = writeBatchEarlyWarningResult(Warning_ResultInfo1) %>% unlist()

    },silent = T)
    if (inherits(result, "try-error")) {
        cat(i,"获取数据时发生了一个错误",'跳过错误继续运行...')

    }
})