ci-server-engineer/examples/CI-Eng-Sample/displays/trend_feed.ps1
2026-10-02 13:57:57 +10:00

16 lines
868 B
PowerShell

# Feed test values into the CI-Eng-Sample tank items so trends have a moving line.
# CI Server R1.03.00. TANK1.LEVEL and TANK1.INFLOW are internal items: after a restart they
# stay NOT INIT until something writes them. Writes every 5 s with itmval; stop with Ctrl+C.
# LEVEL = 50 +/- 25 % (period 10 min, stays inside the L 20 / H 80 alarm limits)
# INFLOW = 250 +/- 150 m3/h (period 4 min)
param([int]$Seconds = 3600)
$end = (Get-Date).AddSeconds($Seconds)
while ((Get-Date) -lt $end) {
$t = [double]((Get-Date) - (Get-Date).Date).TotalSeconds
$level = [math]::Round(50 + 25 * [math]::Sin(2 * [math]::PI * $t / 600), 1)
$inflow = [math]::Round(250 + 150 * [math]::Sin(2 * [math]::PI * $t / 240), 1)
itmval -p -n CI-Eng-Sample.TANK1.LEVEL -v $level > $null
itmval -p -n CI-Eng-Sample.TANK1.INFLOW -v $inflow > $null
Start-Sleep -Seconds 5
}