With the user's approval: item blocking and string length, alarm raise / acknowledge / delay / repeat and INFO event, report generate / print / item trigger / rptstp / SPOOL, class change and reset and attribute change. All results match R1.03 (ISS-028 still holds). Everything was removed again; before/after snapshot identical. ISS-129 and ISS-158 closed. Test package saved in examples/CI-Eng-Sample/shared/write_test; snapshot.ps1 now removes the dss_*.tmp files its own exports leave. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
139 lines
8 KiB
PowerShell
139 lines
8 KiB
PowerShell
# V9, V10, V12, V15 on the R1.05 test server, after write_test\load_write_test.cmd (all files copied into the sample folder). Prints results only.
|
|
param([string]$Part = 'all')
|
|
Set-Location -LiteralPath $PSScriptRoot
|
|
$P = 'CI-Eng-Sample'
|
|
function V($n) { (& itmval -g -n "$P.$n" 2>&1 | Out-String).Trim() -replace '\s+', ' ' }
|
|
function W($n, $v, [switch]$o) { if ($o) { $r = & itmval -p -n "$P.$n" -v $v -o 2>&1 } else { $r = & itmval -p -n "$P.$n" -v $v 2>&1 }; " write $n=$v$(if($o){' -o'}) exit=$LASTEXITCODE $r" }
|
|
function Q($mode, $file) { $r = & dssqld $mode $file -l ($file -replace '\.qli$', '.qlo') 2>&1 | Out-String; ($r -split "`n" | Where-Object { $_ -match '^[A-Z_]+_(DF|VAL|CURRENT)\s+\d' }) -join ' / ' }
|
|
function E($filter, $out) { $null = & dssqld -e $out $filter -c 2>&1; if (Test-Path $out) { Get-Content $out } }
|
|
function Umh($pat) { Select-String -Path "$env:TLS_LOG_PATH\umhlog.log" -Pattern $pat -SimpleMatch | Select-Object -Last 3 | ForEach-Object { ' umh: ' + $_.Line.Trim() } }
|
|
|
|
if ($Part -in 'all','v9') {
|
|
"=== V9 block / unblock (TANK1.INFLOW)"
|
|
W 'TANK1.INFLOW' 10
|
|
" before: $(V 'TANK1.INFLOW')"
|
|
" block: $(Q '-m' 't_block.qli')"
|
|
" blocked: $(V 'TANK1.INFLOW')"
|
|
W 'TANK1.INFLOW' 77
|
|
" after write without -o: $(V 'TANK1.INFLOW')"
|
|
W 'TANK1.INFLOW' 88 -o
|
|
" after write with -o: $(V 'TANK1.INFLOW')"
|
|
" unblock: $(Q '-m' 't_unblock.qli')"
|
|
" unblocked: $(V 'TANK1.INFLOW')"
|
|
"=== V9 string item (length 100, write 120 characters)"
|
|
$s = ('0123456789' * 12)
|
|
W 'DEMO.STR100' $s
|
|
$g = (& itmval -g -n "$P.DEMO.STR100" 2>&1 | Out-String)
|
|
$val = ([regex]::Match($g, 'Value\s*=\s*(.*)')).Groups[1].Value.Trim()
|
|
" stored length: $($val.Length) status: $(([regex]::Match($g, 'Status\s*=\s*(\d+)')).Groups[1].Value)"
|
|
}
|
|
|
|
if ($Part -in 'all','v10') {
|
|
"=== V10 alarm raise / acknowledge (TANK1.LEVEL, limits 10/20/80/90)"
|
|
W 'TANK1.LEVEL' 50; Start-Sleep 2
|
|
" start: $(V 'TANK1.LEVEL')"
|
|
$t0 = (Get-Date).ToString('dd-MM-yyyy HH:mm:ss')
|
|
W 'TANK1.LEVEL' 85; Start-Sleep 3
|
|
" high: $(V 'TANK1.LEVEL')"
|
|
$cur = E 'f_almcur.qli' 'almcur.qlo'
|
|
" ALARM_CURRENT rows: $(@($cur).Count - 1)"
|
|
$hdr = ($cur | Select-Object -First 1) -split ','
|
|
$row = $cur | Select-Object -Skip 1 | Select-Object -Last 1
|
|
if ($row) {
|
|
$name = ($row -split '","')[0].Trim('"')
|
|
" alarm NAME: $name"
|
|
"@LANGUAGE`r`nENGLISH`r`n`r`n@VERSION`r`n1.03.00`r`n`r`n@FIELDS`r`nNAME,ACK`r`n`r`n@ALARM_CURRENT`r`n""$name"",1`r`n" | Set-Content -Encoding ascii t_ack.qli
|
|
" acknowledge: $(Q '-m' 't_ack.qli')"
|
|
Start-Sleep 2
|
|
" after ack: $(V 'TANK1.LEVEL')"
|
|
}
|
|
W 'TANK1.LEVEL' 50; Start-Sleep 3
|
|
" back to 50: $(V 'TANK1.LEVEL'); ALARM_CURRENT rows: $(@(E 'f_almcur.qli' 'almcur.qlo').Count - 1)"
|
|
"=== V10 delay 5 s / repeat 10 s"
|
|
" set: $(Q '-m' 't_dr.qli')"
|
|
Start-Sleep 2
|
|
W 'TANK1.LEVEL' 85; Start-Sleep 27
|
|
W 'TANK1.LEVEL' 50; Start-Sleep 3
|
|
"@LANGUAGE`r`nENGLISH`r`n`r`n@VERSION`r`n1.03.00`r`n`r`n@FIELDS`r`nNAME,ALARM_TIME,EVENT_TYPE,NEW_STATE,RPT_COUNT,ACK`r`n`r`n@SELECT`r`n'ITEM_NAME = ""CI-Eng-Sample.TANK1.LEVEL"" and ALARM_TIME > ""$t0""'`r`n@ALARM_CHRONO`r`n" | Set-Content -Encoding ascii f_chrono.qli
|
|
E 'f_chrono.qli' 'chrono.qlo' | ForEach-Object { " chrono: $_" }
|
|
" reset delay/repeat: $(Q '-m' 't_dr0.qli')"
|
|
Start-Sleep 2
|
|
" ALARM_CURRENT rows after reset: $(@(E 'f_almcur.qli' 'almcur.qlo').Count - 1)"
|
|
"=== V10 INFO event (almdbg 16)"
|
|
$t1 = (Get-Date).ToString('dd-MM-yyyy HH:mm:ss')
|
|
$null = ("16`n`n0`n15`n$P.TANK1.LEVEL`nV10 test`nCI-Eng-Sample INFO test event`n-1`n" | & almdbg 2>&1)
|
|
Start-Sleep 2
|
|
"@LANGUAGE`r`nENGLISH`r`n`r`n@VERSION`r`n1.03.00`r`n`r`n@FIELDS`r`nNAME,ALARM_TIME,EVENT_TYPE,ITEM_NAME,ALARM_TEXT,DESCRIPTION,PRIORITY,ACK`r`n`r`n@SELECT`r`n'EVENT_TYPE = ""INFO"" and ALARM_TIME > ""$t1""'`r`n@ALARM_CHRONO`r`n" | Set-Content -Encoding ascii f_info.qli
|
|
E 'f_info.qli' 'info.qlo' | ForEach-Object { " info: $_" }
|
|
}
|
|
|
|
if ($Part -in 'all','v12') {
|
|
"=== V12 generate CIENG_TANK1 (dssqld)"
|
|
" generate: $(Q '-m' 't_gen.qli')"
|
|
Start-Sleep 5
|
|
E 'f_repdf.qli' 'repdf.qlo' | ForEach-Object { " report_df: $_" }
|
|
$rv = E 'f_repval.qli' 'repval.qlo'
|
|
$rv | ForEach-Object { " report_val: $_" }
|
|
$gen = $rv | Select-Object -Skip 1 | Where-Object { $_ -like '"CIENG_TANK1.*' } | Select-Object -Last 1
|
|
Umh 'PRT_UNKUSER'
|
|
if ($gen) {
|
|
$gname = ($gen -split '","')[0].Trim('"')
|
|
"@LANGUAGE`r`nENGLISH`r`n`r`n@VERSION`r`n1.03.00`r`n`r`n@FIELDS`r`nNAME,DEST_NAME,PRINT`r`n`r`n@REPORT_VAL`r`n""$gname"",""CIENG_FILE"",1`r`n" | Set-Content -Encoding ascii t_print.qli
|
|
" print $gname to CIENG_FILE: $(Q '-m' 't_print.qli')"
|
|
Start-Sleep 5
|
|
$f = "$env:TLS_LST_PATH\cieng_report.txt"
|
|
" output file: $(if (Test-Path $f) { (Get-Item $f).Length.ToString() + ' bytes, first line: ' + (Get-Content $f -TotalCount 1) } else { 'missing' })"
|
|
}
|
|
"=== V12 item trigger CIENG_INFLOW_HI (0 -> 450)"
|
|
W 'TANK1.INFLOW' 0; Start-Sleep 3
|
|
W 'TANK1.INFLOW' 450; Start-Sleep 12
|
|
E 'f_repval.qli' 'repval.qlo' | Where-Object { $_ -like '*INFLOW_HI*' } | ForEach-Object { " report_val: $_" }
|
|
$f = "$env:TLS_LST_PATH\cieng_report.txt"
|
|
if (Test-Path $f) { " file now: " + ((Get-Content $f) -match 'inflow high' | Select-Object -Last 1) }
|
|
W 'TANK1.INFLOW' 0
|
|
"=== V12 rptstp on an endless report"
|
|
" generate CIENG_LOOP: $(Q '-m' 't_loop_gen.qli')"
|
|
Start-Sleep 5
|
|
E 'f_repdf.qli' 'repdf.qlo' | Where-Object { $_ -like '*CIENG_LOOP*' } | ForEach-Object { " while running: $_" }
|
|
$r = & rptstp rptge1 2>&1 | Out-String
|
|
" rptstp: exit=$LASTEXITCODE $($r.Trim())"
|
|
Start-Sleep 4
|
|
E 'f_repdf.qli' 'repdf.qlo' | Where-Object { $_ -like '*CIENG_LOOP*' } | ForEach-Object { " after rptstp: $_" }
|
|
" RPTGE1 attached (0 = yes): " + $(& durwfp -p RPTGE1 -t 0 2>&1 | Out-Null; $LASTEXITCODE)
|
|
"=== V12 SPOOL to CSV"
|
|
$csv = "$env:TLS_LST_PATH\cieng_levels.csv"
|
|
"set @next 0;`nset @page_size 0;`nspool '$csv';`nset @export 1;`nselect name, item_value, status from item_val where name like 'CI-Eng-Sample.TANK1.%';`nspool;`nset @export 0;`nquit;`n" | Set-Content -Encoding ascii q_spool.rql
|
|
$null = Get-Content q_spool.rql | & rptgen -s rptgen.rpt 2>&1
|
|
if (Test-Path $csv) { Get-Content $csv | ForEach-Object { " csv: $_" }; Remove-Item $csv } else { ' csv: file not written' }
|
|
}
|
|
|
|
if ($Part -in 'all','v15') {
|
|
"=== V15 change and reset class CIENG_TANK"
|
|
W 'TANK1.LEVEL' 50; Start-Sleep 2
|
|
E 'f_class.qli' 'cls.qlo' | ForEach-Object { " before: $_" }
|
|
" compile changed source: $(Q '-m' 't_cls.qli')"
|
|
Start-Sleep 3
|
|
E 'f_class.qli' 'cls.qlo' | ForEach-Object { " after compile: $_" }
|
|
W 'TANK1.LEVEL' 85; Start-Sleep 3
|
|
Umh 'CIENG_TANK CI-Eng-Sample.TANK1'
|
|
W 'TANK1.LEVEL' 50
|
|
"@LANGUAGE`r`nENGLISH`r`n`r`n@VERSION`r`n1.03.00`r`n`r`n@FIELDS`r`nNAME,RESET`r`n`r`n@CLASS_DF`r`n""CIENG_TANK"",1`r`n" | Set-Content -Encoding ascii t_rst_dss.qli
|
|
" dssqld reset (ISS-028): $(Q '-m' 't_rst_dss.qli')"
|
|
Start-Sleep 3
|
|
E 'f_class.qli' 'cls.qlo' | Select-Object -Last 1 | ForEach-Object { " after dssqld reset: $_" }
|
|
$job = Start-Job { param($d) Set-Location $d; "2`n8`nCIENG_TANK`n0`n`n-1`n-1`n" | & opcdbg 0 2>&1 | Out-String } -ArgumentList $PSScriptRoot
|
|
if (Wait-Job $job -Timeout 30) { $o = Receive-Job $job; " opcdbg reset: " + (($o -split "`n" | Where-Object { $_ -match 'reset|Reset|error|Error' } | Select-Object -Last 3) -join ' | ') } else { Stop-Job $job; ' opcdbg reset: timed out' }
|
|
Remove-Job $job -Force
|
|
Get-Process opcdbg -ErrorAction SilentlyContinue | Where-Object { $_.StartTime -gt (Get-Date).AddMinutes(-2) } | Stop-Process -Force
|
|
Start-Sleep 3
|
|
E 'f_class.qli' 'cls.qlo' | Select-Object -Last 1 | ForEach-Object { " after opcdbg reset: $_" }
|
|
W 'TANK1.LEVEL' 85; Start-Sleep 3
|
|
Umh 'CIENG_TANK CI-Eng-Sample.TANK1'
|
|
W 'TANK1.LEVEL' 50; Start-Sleep 2
|
|
"=== V15 change attribute CAPACITY 200 -> 400"
|
|
E 'f_attr.qli' 'attr.qlo' | ForEach-Object { " before: $_" }
|
|
" set: $(Q '-m' 't_cap.qli')"
|
|
Start-Sleep 2
|
|
W 'TANK1.LEVEL' 49; Start-Sleep 1; W 'TANK1.LEVEL' 50; Start-Sleep 3
|
|
" VOLUME at level 50 (expect 200): $(V 'TANK1.CALC.VOLUME')"
|
|
}
|