wiki:epics/compress

Version 4 (modified by obina, 12 years ago) (diff)

--

compress レコードの使い方

10点のデータから計算するcompressレコードを作成(この例ではN to 1 Average)。INPレコードであるtest:janeは0.1秒ごとにプロセスするので、平均データは1秒ごとに更新される。

record(compress, "test:compAve")
{
    field(DESC, "compress")
    field(INP,  "test:jane CP")
    field(ALG,  "N to 1 Average")
    field(NSAM, "1")
    field(N,    "10")
    field(SCAN, "Passive")
    field(FLNK, "")
}

camonitor してみると、

pfrproc2:~ % camonitor test:compAve
test:compAve                   2012-06-04 22:08:31.000000 5.38322
test:compAve                   2012-06-04 22:08:32.000000 5.30311
test:compAve                   2012-06-04 22:08:33.000000 5.29409
test:compAve                   2012-06-04 22:08:33.000000 5.29909

このままでは分かりにくいので、アルゴリズム(ALG)フィールドを "N to 1 Average", "N to 1 High Value", "N to 1 Low Value"の3パターンでどのようになるか グラフに描いてみる。それぞれ直前10点のデータ区間の平均・最大・最小を値として持つことが分かる。

"N to 1 Average Value"
"N to 1 High Value"
"N to 1 Low Value"

もし0.1秒ごとに更新する移動平均のデータが欲しいならば、まずCircular Bufferでスカラーからwaveformをつくる レコードを作成し、次いそのwaveform全体のAverageを計算するのが簡単。

aiのデータから、Circular Buffer(waveform)を作成する。

record(compress, "test:compCircBuf")
{
    field(DESC, "compress")
    field(INP,  "test:jane CP")
    field(ALG,  "Circular Buffer")
    field(NSAM, "10")
    field(SCAN, "Passive")
    field(FLNK, "")
}
pfrproc2:~ % camonitor test:compCircBuf
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.67032 5.5943 5.67055 5.72319 5.67128 5.76206 5.80883 5.87064 5.93594 5.84581
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.5943 5.67055 5.72319 5.67128 5.76206 5.80883 5.87064 5.93594 5.84581 5.74938
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.67055 5.72319 5.67128 5.76206 5.80883 5.87064 5.93594 5.84581 5.74938 5.66817
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.72319 5.67128 5.76206 5.80883 5.87064 5.93594 5.84581 5.74938 5.66817 5.6667
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.67128 5.76206 5.80883 5.87064 5.93594 5.84581 5.74938 5.66817 5.6667 5.57069
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.76206 5.80883 5.87064 5.93594 5.84581 5.74938 5.66817 5.6667 5.57069 5.49197
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.80883 5.87064 5.93594 5.84581 5.74938 5.66817 5.6667 5.57069 5.49197 5.41715
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.87064 5.93594 5.84581 5.74938 5.66817 5.6667 5.57069 5.49197 5.41715 5.47384
test:compCircBuf               2012-06-04 22:08:11.000000 10 5.93594 5.84581 5.74938 5.66817 5.6667 5.57069 5.49197 5.41715 5.47384 5.51437
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.84581 5.74938 5.66817 5.6667 5.57069 5.49197 5.41715 5.47384 5.51437 5.45423
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.74938 5.66817 5.6667 5.57069 5.49197 5.41715 5.47384 5.51437 5.45423 5.55247
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.66817 5.6667 5.57069 5.49197 5.41715 5.47384 5.51437 5.45423 5.55247 5.46537
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.6667 5.57069 5.49197 5.41715 5.47384 5.51437 5.45423 5.55247 5.46537 5.45961
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.57069 5.49197 5.41715 5.47384 5.51437 5.45423 5.55247 5.46537 5.45961 5.53298
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.49197 5.41715 5.47384 5.51437 5.45423 5.55247 5.46537 5.45961 5.53298 5.56679
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.41715 5.47384 5.51437 5.45423 5.55247 5.46537 5.45961 5.53298 5.56679 5.48265
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.47384 5.51437 5.45423 5.55247 5.46537 5.45961 5.53298 5.56679 5.48265 5.51005
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.51437 5.45423 5.55247 5.46537 5.45961 5.53298 5.56679 5.48265 5.51005 5.5402
test:compCircBuf               2012-06-04 22:08:12.000000 10 5.45423 5.55247 5.46537 5.45961 5.53298 5.56679 5.48265 5.51005 5.5402 5.62897

Attachments (3)

Download all attachments as: .zip