diff --git a/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/HilSession.java b/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/HilSession.java index 3fc9c48a9..440d4d8e4 100644 --- a/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/HilSession.java +++ b/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/HilSession.java @@ -49,6 +49,8 @@ interface Condition { private final long t0 = System.nanoTime(); private final List events = new ArrayList<>(); private final List samples = new ArrayList<>(); + /** Each recorded packet's raw device ticks (TIMESTAMP, UNCAL), since startRecording, across stretches. */ + private final List rawTicks = new ArrayList<>(); private final Set otherMessagesSeen = new HashSet<>(); private final ExecutorService calls = Executors.newSingleThreadExecutor(r -> { Thread t = new Thread(r, "HilCall"); @@ -140,14 +142,20 @@ private void recordPacket(ObjectCluster oc) { cal(oc, Configuration.Shimmer3.ObjectClusterSensorName.ACCEL_LN_X), cal(oc, Configuration.Shimmer3.ObjectClusterSensorName.ACCEL_LN_Y), cal(oc, Configuration.Shimmer3.ObjectClusterSensorName.ACCEL_LN_Z)); + double ticks = value(oc, Configuration.Shimmer3.ObjectClusterSensorName.TIMESTAMP, "UNCAL"); synchronized (samples) { samples.add(s); + rawTicks.add(ticks); } } private static double cal(ObjectCluster oc, String channel) { + return value(oc, channel, "CAL"); + } + + private static double value(ObjectCluster oc, String channel, String format) { Collection formats = oc.getCollectionOfFormatClusters(channel); - FormatCluster c = (FormatCluster) ObjectCluster.returnFormatCluster(formats, "CAL"); + FormatCluster c = (FormatCluster) ObjectCluster.returnFormatCluster(formats, format); return c == null ? Double.NaN : c.mData; } @@ -278,10 +286,21 @@ boolean configureAccelOnly(double rateHz, long timeoutMs) throws InterruptedExce void startRecording() { synchronized (samples) { samples.clear(); + rawTicks.clear(); } recording = true; } + /** + * The raw device ticks of every packet recorded since startRecording, in arrival order: the + * unit's own 3-byte counter, before the driver unwraps it (TimestampWraps counts its wraps). + */ + List rawTicksRecorded() { + synchronized (samples) { + return new ArrayList<>(rawTicks); + } + } + List stopRecording() { recording = false; synchronized (samples) { diff --git a/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/JavaHilScenariosTest.java b/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/JavaHilScenariosTest.java index b075df706..453c92756 100644 --- a/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/JavaHilScenariosTest.java +++ b/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/JavaHilScenariosTest.java @@ -35,6 +35,8 @@ * hil.stressSeconds queueStress duration, default 60 * hil.maxQueued queueStress queue length the threads keep below, default 8 * hil.stallSeconds queueStress: no progress for this long is a hang, default 10 + * hil.rolloverSeconds rollover duration, default 600 (past the 512 s wrap from any start) + * hil.idleSeconds idleStart: how long the link is left idle, default 60 * hil.crc off, 1 or 2; default: the driver's own default * hil.maxLossPercent default 1.0 * hil.outDir where reports go, default build/hil @@ -55,6 +57,10 @@ public class JavaHilScenariosTest { * timeout", or "[0x..]UNKNOWN" for an opcode the driver doesn't know. */ private static final java.util.regex.Pattern COMMAND_TIMEOUT = java.util.regex.Pattern.compile("Command:\t\\[0x[0-9A-F]{2}\\] ?\\S+ timeout"); + /** The slowest start idleStart accepts after the wait, as the C# and shimmer-logandstream HILs do. */ + private static final double MAX_START_AFTER_IDLE_MS = 500; + /** The rates samplingRates writes in turn, as the shimmer-logandstream HIL's config.sampling_rate does. */ + private static final double[] SAMPLING_RATES_HZ = {51.2, 256, 512}; private HilSession session; private HilReport report; @@ -129,6 +135,17 @@ private void putDriverCounts() { // --- shared checks ------------------------------------------------------------------------- private boolean connectAndConfigure(double rateHz) throws Exception { + if (!connectAndDescribe()) { + return false; + } + boolean configured = session.configureAccelOnly(rateHz, 20000); + report.put("rateOnDeviceHz", device.getSamplingRateShimmer()); + report.check(configured, "configuration did not complete within 20 s (state " + session.state() + ")"); + return configured; + } + + /** Connects, and records what the unit is: its hardware, firmware and the link CRC in use. */ + private boolean connectAndDescribe() throws Exception { long start = System.currentTimeMillis(); boolean connected = session.connect(30000); report.put("connectMs", System.currentTimeMillis() - start); @@ -139,10 +156,20 @@ private boolean connectAndConfigure(double rateHz) throws Exception { report.put("hardware", device.getHardwareVersionParsed()); report.put("firmware", device.getFirmwareVersionParsed()); report.put("crcMode", String.valueOf(device.getCurrentBtCommsCrcMode())); - boolean configured = session.configureAccelOnly(rateHz, 20000); - report.put("rateOnDeviceHz", device.getSamplingRateShimmer()); - report.check(configured, "configuration did not complete within 20 s (state " + session.state() + ")"); - return configured; + return true; + } + + /** The driver says the link has gone: lost, or closed under the test. */ + private boolean linkLost() { + BT_STATE s = session.state(); + return s == BT_STATE.CONNECTION_LOST || s == BT_STATE.DISCONNECTED; + } + + /** Accel at rest: NaN fails too, since the scenario configured the accel. */ + private void checkAccelAtRest(StreamAnalysis a) { + report.check(Math.abs(a.accelMagnitudeMean - GRAVITY) <= 1.0, String.format(Locale.ROOT, + "accel at rest %.3f m/s^2, expected %.2f±1.00 (NaN: no calibrated accel; otherwise is the unit lying still?)", + a.accelMagnitudeMean, GRAVITY)); } private void checkRate(double deviceRateHz, String what) { @@ -322,10 +349,7 @@ public void streamRest() throws Exception { report.putGaps(a); report.samples(samples); checkStream(a, samples, stoppedAtMs, maxLoss, deviceRate, "stream"); - // NaN fails too: the scenario configured the accel, so a stream without calibrated accel is a fault - report.check(Math.abs(a.accelMagnitudeMean - GRAVITY) <= 1.0, String.format(Locale.ROOT, - "accel at rest %.3f m/s^2, expected %.2f±1.00 (NaN: no calibrated accel; otherwise is the unit lying still?)", - a.accelMagnitudeMean, GRAVITY)); + checkAccelAtRest(a); checkDriverLog(logMark, "stream"); report.check(session.disconnect(10000), "did not disconnect within 10 s"); } @@ -611,4 +635,166 @@ public void queueStress() throws Exception { } finish(); } + + /** + * Streams for 10 minutes (hil.rolloverSeconds), past the 512 s wrap of the unit's 3-byte + * timestamp counter from wherever it starts, as the C# HIL's stream.rollover does. The driver's + * unwrap must carry the timeline straight across the wrap: DEV-1023 was that rule, wrong the same + * way in four APIs. Fails on the stream checks, or if the raw counter never wrapped. + */ + @Test + public void rollover() throws Exception { + begin("rollover"); + double rate = arg("rate", 256.0); + int seconds = arg("rolloverSeconds", 600); + double maxLoss = arg("maxLossPercent", 1.0); + if (connectAndConfigure(rate)) { + double deviceRate = device.getSamplingRateShimmer(); + checkRate(deviceRate, "stream"); + int logMark = device.logSize(); + session.startRecording(); + report.check(session.startStreaming(10000), "streaming did not start within 10 s"); + // Watched each second, so a lost link ends the wait instead of sitting out the 10 minutes + long start = System.nanoTime(); + while (System.nanoTime() - start < seconds * 1_000_000_000L && !linkLost()) { + Thread.sleep(1000); + } + double streamedSeconds = (System.nanoTime() - start) / 1e9; + double stoppedAtMs = session.nowMs(); + List samples = session.stopRecording(); + int wraps = TimestampWraps.count(session.rawTicksRecorded()); + report.put("streamedSeconds", Math.round(streamedSeconds * 10) / 10.0); + report.put("counterWraps", wraps); + boolean lost = linkLost(); + report.check(!lost, String.format(Locale.ROOT, "the link was lost %.0f s into the stream (state %s)", streamedSeconds, session.state())); + if (!lost) { + report.check(session.stopStreaming(10000), "streaming did not stop within 10 s"); + } + StreamAnalysis a = StreamAnalysis.analyse(samples, deviceRate); + session.event("stream: " + a + "; the unit's counter wrapped " + wraps + " time(s)"); + report.putStream("stream", a); + report.putGaps(a); + report.samples(samples); + checkStream(a, samples, stoppedAtMs, maxLoss, deviceRate, "stream"); + report.check(wraps >= 1, String.format(Locale.ROOT, + "the unit's counter did not wrap in %.0f s of streaming, so the stream never crossed the 512 s wrap", streamedSeconds)); + checkAccelAtRest(a); + checkDriverLog(logMark, "stream"); + if (!lost) { + report.check(session.disconnect(10000), "did not disconnect within 10 s"); + } + } + finish(); + } + + /** + * A link left idle, as an app's is between configuring a unit and starting it: 60 s + * (hil.idleSeconds) in which the test sends nothing, with the driver's timers running as they do + * in an app, then a 10 s stream. The link must survive the wait, the status timer's requests + * must be answered, and streaming must start within 500 ms of the call, as the C# and + * shimmer-logandstream HILs require: a Classic link left quiet otherwise answers its next command + * late. + */ + @Test + public void idleStart() throws Exception { + begin("idle_start"); + double rate = arg("rate", 256.0); + int idleSeconds = arg("idleSeconds", 60); + double maxLoss = arg("maxLossPercent", 1.0); + if (connectAndConfigure(rate)) { + double deviceRate = device.getSamplingRateShimmer(); + checkRate(deviceRate, "stream"); + int idleMark = device.logSize(); + session.event("idle for " + idleSeconds + " s: timers " + device.timers()); + long idleStarted = System.nanoTime(); + while (System.nanoTime() - idleStarted < idleSeconds * 1_000_000_000L && !linkLost()) { + Thread.sleep(200); + } + double idled = (System.nanoTime() - idleStarted) / 1e9; + int statusRequests = device.countSince(idleMark, "GET_STATUS_COMMAND Instruction added"); + report.put("idleSeconds", Math.round(idled * 10) / 10.0); + report.put("statusRequestsWhileIdle", statusRequests); + session.event(String.format(Locale.ROOT, "idle %.0f s: %d status requests by the driver, timers %s", idled, statusRequests, device.timers())); + boolean lost = linkLost(); + report.check(!lost, String.format(Locale.ROOT, "the link was lost %.0f s into the idle wait (state %s)", idled, session.state())); + if (!lost) { + checkDriverLog(idleMark, "idle"); + int logMark = device.logSize(); + session.startRecording(); + long asked = System.nanoTime(); + boolean started = session.startStreaming(10000); + double startMs = (System.nanoTime() - asked) / 1e6; + report.put("startMs", Math.round(startMs)); + session.event(String.format(Locale.ROOT, "streaming %s %.0f ms after startStreaming", started ? "started" : "had not started", startMs)); + report.check(started, "streaming did not start within 10 s after the idle wait"); + report.check(!started || startMs <= MAX_START_AFTER_IDLE_MS, String.format(Locale.ROOT, + "streaming started %.0f ms after startStreaming, over %.0f ms", startMs, MAX_START_AFTER_IDLE_MS)); + Thread.sleep(10000); + double stoppedAtMs = session.nowMs(); + List samples = session.stopRecording(); + report.check(session.stopStreaming(10000), "streaming did not stop within 10 s"); + StreamAnalysis a = StreamAnalysis.analyse(samples, deviceRate); + session.event("stream: " + a); + report.putStream("stream", a); + report.putGaps(a); + report.samples(samples); + checkStream(a, samples, stoppedAtMs, maxLoss, deviceRate, "stream"); + checkAccelAtRest(a); + checkDriverLog(logMark, "stream"); + report.check(session.disconnect(10000), "did not disconnect within 10 s"); + } + } + finish(); + } + + /** + * Writes 51.2, 256 and 512 Hz in turn, each the way Consensys's Bluetooth manager writes a + * configuration (configureAccelOnly), and streams 5 s at each: the unit must stream at the rate + * it was given, as the shimmer-logandstream HIL's config.sampling_rate checks. Then the unit's own + * rate is written back. The unit is left accel only, as every scenario leaves it. + */ + @Test + public void samplingRates() throws Exception { + begin("sampling_rates"); + double maxLoss = arg("maxLossPercent", 1.0); + if (connectAndDescribe()) { + double ownRate = device.getSamplingRateShimmer(); + report.put("ownRateHz", ownRate); + List streams = new ArrayList<>(); + for (double rate : SAMPLING_RATES_HZ) { + if (session.hung != null) { + break; + } + String what = String.format(Locale.ROOT, "%.1f Hz", rate); + boolean configured = session.configureAccelOnly(rate, 20000); + report.check(configured, String.format(Locale.ROOT, "%s: the configuration did not take within 20 s (rate on device %.2f Hz, state %s)", + what, device.getSamplingRateShimmer(), session.state())); + if (!configured) { + continue; + } + double deviceRate = device.getSamplingRateShimmer(); + int logMark = device.logSize(); + session.startRecording(); + report.check(session.startStreaming(10000), what + ": streaming did not start within 10 s"); + Thread.sleep(5000); + double stoppedAtMs = session.nowMs(); + List samples = session.stopRecording(); + report.check(session.stopStreaming(10000), what + ": streaming did not stop within 10 s"); + StreamAnalysis a = StreamAnalysis.analyse(samples, deviceRate); + session.event(what + " stream: " + a); + streams.add(what + ": " + a); + checkStream(a, samples, stoppedAtMs, maxLoss, deviceRate, what); + checkDriverLog(logMark, what); + } + report.put("streams", streams); + if (session.hung == null) { + boolean restored = session.configureAccelOnly(ownRate, 20000); + report.check(restored, String.format(Locale.ROOT, "the unit's own rate, %.2f Hz, was not written back (rate on device %.2f Hz)", + ownRate, device.getSamplingRateShimmer())); + report.put("rateOnDeviceHz", device.getSamplingRateShimmer()); + } + report.check(session.disconnect(10000), "did not disconnect within 10 s"); + } + finish(); + } } diff --git a/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/TimestampWraps.java b/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/TimestampWraps.java new file mode 100644 index 000000000..06493014a --- /dev/null +++ b/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/TimestampWraps.java @@ -0,0 +1,39 @@ +package com.shimmerresearch.hil; + +import java.util.List; + +/** + * Counts how often the unit's own timestamp counter wrapped during a stream, from the raw ticks the + * driver passes on over Bluetooth (the TIMESTAMP channel's UNCAL format; CAL is the unwrapped + * time). The counter is 3 bytes at 32768 Hz on Shimmer3 and Shimmer3R, so it wraps every 2^24 + * ticks, 512 s. Pure Java, so it is unit-tested on the JVM (TimestampWrapsTest, in the normal test + * task). Kept apart from StreamAnalysis, which is the same class as the Android HIL's. + */ +final class TimestampWraps { + + /** The raw counter's range: 3 bytes. */ + static final double RANGE_TICKS = 1 << 24; + + private TimestampWraps() { + } + + /** + * Steps where the raw counter fell by more than half its range: a wrap. A smaller step back is + * not a wrap but a fault the stream checks already count (StreamAnalysis.nonIncreasing). A packet + * without ticks (NaN) is skipped, so the step is taken from the last one that had them. + */ + static int count(List rawTicks) { + int wraps = 0; + double previous = Double.NaN; + for (double ticks : rawTicks) { + if (Double.isNaN(ticks)) { + continue; + } + if (previous - ticks > RANGE_TICKS / 2) { + wraps++; + } + previous = ticks; + } + return wraps; + } +} diff --git a/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/TimestampWrapsTest.java b/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/TimestampWrapsTest.java new file mode 100644 index 000000000..dc4c28320 --- /dev/null +++ b/ShimmerDriverPC/src/test/java/com/shimmerresearch/hil/TimestampWrapsTest.java @@ -0,0 +1,48 @@ +package com.shimmerresearch.hil; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +/** The rollover scenario's wrap count, checked without a unit. */ +public class TimestampWrapsTest { + + /** Raw 3-byte ticks at 256 Hz (128 ticks a sample) from startTicks, as the counter gives them. */ + private static List rawTicks(double startTicks, int count) { + List ticks = new ArrayList<>(); + for (int i = 0; i < count; i++) { + ticks.add((startTicks + i * 128.0) % TimestampWraps.RANGE_TICKS); + } + return ticks; + } + + @Test + public void countsNoWrapInAShortStream() { + assertEquals(0, TimestampWraps.count(rawTicks(1000, 2560))); + } + + @Test + public void countsTheWrapInTenMinutesWhereverTheStreamStarts() { + // 600 s at 256 Hz is 153,600 samples: one wrap from any start, two from one just before a wrap + assertEquals(1, TimestampWraps.count(rawTicks(0, 153600))); + assertEquals(1, TimestampWraps.count(rawTicks(TimestampWraps.RANGE_TICKS / 2, 153600))); + assertEquals(2, TimestampWraps.count(rawTicks(TimestampWraps.RANGE_TICKS - 1000, 153600))); + } + + @Test + public void aSmallStepBackIsNotAWrap() { + List ticks = rawTicks(5000000, 100); + ticks.set(50, ticks.get(49) - 1000); + assertEquals(0, TimestampWraps.count(ticks)); + } + + @Test + public void ignoresTicksTheDriverDidNotGive() { + List ticks = rawTicks(TimestampWraps.RANGE_TICKS - 640, 10); + ticks.set(4, Double.NaN); + assertEquals(1, TimestampWraps.count(ticks)); + } +} diff --git a/tools/hil/README.md b/tools/hil/README.md index 0cacbd5c9..d73eb49a5 100644 --- a/tools/hil/README.md +++ b/tools/hil/README.md @@ -44,6 +44,9 @@ If anything merges after step 1, the commit changes, so test again. In an emerge | `reconnectLoop` | Connects, streams for 5 s and disconnects, five times on the same `ShimmerPC`. Every connect starts the driver's status timer, which is when the DEV-1266 lock inversion is most likely. | Any cycle fails to connect within 30 s, loses packets, fails the timestamp checks, or the driver logs a parser error or command timeout. | | `inStream` | While streaming: first each in-stream reply on its own, three rounds: status (`0x8A 0x71`), directory (`0x8A 0x88`) and battery (`0x8A 0x94`). Then five overlaps as Consensys meets them: with the unit streaming and logging (logging started the Consensys way), stop SD logging mid-stream and request status and battery at once, so in-stream replies, including any status the unit pushes as logging stops, arrive while that command waits for its ACK (DEV-1262). | A reply doesn't arrive within 3 s or isn't decoded; an overlap doesn't complete within 5 s (both replies decoded, logging stopped, the queue empty); the driver logs a command timeout; or the stream fails the checks above. | | `queueStress` | While streaming, four app threads call `readBattery()` and `readStatusLogAndStream()` and check the queue length, in tight loops for 60 s, keeping the queue under 8. Each of those calls locks the device and then the instruction list, so one is nearly always under way while the IO thread fetches the next instruction. That is the window DEV-1266's lock inversion needs (#334). No SD logging is involved. | The calls and replies stop for 10 s, or the JVM finds a deadlock; the queue doesn't drain afterwards. Without the DEV-1266 fix a Shimmer3R deadlocked within 0.3 s in every run. | +| `rollover` | Configures as `streamRest` does and streams for 10 minutes with the unit lying still. That is past the 512 s wrap of the unit's 3-byte timestamp counter from wherever it starts, so the driver's unwrap has to carry the timeline across it (DEV-1023, the same rule wrong in four APIs). The C# HIL's `stream.rollover` does the same. | The stream fails `streamRest`'s checks, or the link is lost; the unit's raw counter never wrapped (counted from the TIMESTAMP channel's raw ticks, so a shortened run doesn't pass). | +| `idleStart` | Connects and configures, then leaves the link idle for 60 s, with the driver's timers running as they do in an app, before streaming 10 s. The C# and shimmer-logandstream HILs check the same: a Bluetooth Classic link left quiet otherwise answers its next command late. The report counts the status timer's requests during the wait. | The link is lost during the wait, or the driver logs a command timeout or parser error in it; streaming starts more than 500 ms after `startStreaming()`; or the stream fails `streamRest`'s checks. | +| `samplingRates` | Writes 51.2, 256 and 512 Hz in turn, each the way Consensys's Bluetooth manager writes a configuration, and streams 5 s at each, as the shimmer-logandstream HIL's `config.sampling_rate` does. Then it writes the unit's own rate back, accel only as every scenario leaves it. | A configuration doesn't take within 20 s, or the unit reads back another rate; a stream loses packets, fails the timestamp checks, or has a rate more than 1 % off the one written; the driver logs a parser error or command timeout; or the unit's own rate isn't written back. | Every API call runs under a watchdog. If one doesn't return within 10 s, the scenario stops, and its events hold every thread's stack with the locks each holds and waits on, plus any deadlock the JVM @@ -65,7 +68,8 @@ which driver timers were running after connect, after configure and while stream Starting SD logging mid-stream (`startSDLogging()` while streaming) writes the RTC mid-stream, which a Shimmer3R answers with out-of-order timestamps (DEV-1245). Consensys never does that, and neither do these scenarios. The stream checks are the Android HIL's (`StreamAnalysis`, the same class in ShimmerAndroidAPI's -`shimmerHilTest`), so the two judge a stream by the same rules. `StreamAnalysisTest` runs in CI. +`shimmerHilTest`), so the two judge a stream by the same rules. `StreamAnalysisTest` runs in CI, as +does `TimestampWrapsTest`, for the wrap count `rollover` relies on. ### What it does not test @@ -79,7 +83,7 @@ The stream checks are the Android HIL's (`StreamAnalysis`, the same class in Shi | | Default | Option | |---|---|---| | Units | every unit in the rig file | `-Unit s3r-86f8` | -| Scenarios | all five | `-Scenario inStream` | +| Scenarios | all eight (`rollover` alone streams 10 minutes a unit) | `-Scenario inStream` | | Sampling rate, stream duration | 256 Hz, 30 s | `-Rate 512`, `-Seconds 60` | | Link CRC | the driver's default (1 byte) | `-Crc off`, `-Crc 2` | | Pause between runs | 10 s | `-SettleSeconds 30` | @@ -90,7 +94,7 @@ The stream checks are the Android HIL's (`StreamAnalysis`, the same class in Shi 1. **Pair each unit with the PC** in Windows Settings → Bluetooth (PIN `1234`). Windows creates an outgoing serial port for it; the script finds that port from the unit's MAC. 2. **Prepare each unit:** SD sync and Bluetooth disable off (either keeps Bluetooth off, DEV-1228), an - SD card in for `midStreamSet`, lying still during `streamRest`. + SD card in for `midStreamSet`, lying still during `streamRest`, `rollover` and `idleStart`. 3. **List the units:** copy `rig-java.example.json` to `rig-java.json` and fill in each name, MAC and `type` (`Shimmer3` or `Shimmer3R`). Add `comPort` only to override the port the script finds. That file is gitignored. diff --git a/tools/hil/run-java-hil.ps1 b/tools/hil/run-java-hil.ps1 index 047038bd2..f2986fb88 100644 --- a/tools/hil/run-java-hil.ps1 +++ b/tools/hil/run-java-hil.ps1 @@ -22,8 +22,8 @@ Before "Release Java API": the full run on this commit, recorded on GitHub as th #> param( [string]$Rig = (Join-Path $PSScriptRoot 'rig-java.json'), - [ValidateSet('streamRest', 'midStreamSet', 'reconnectLoop', 'inStream', 'queueStress')] - [string[]]$Scenario = @('streamRest', 'midStreamSet', 'reconnectLoop', 'inStream', 'queueStress'), + [ValidateSet('streamRest', 'midStreamSet', 'reconnectLoop', 'inStream', 'queueStress', 'rollover', 'idleStart', 'samplingRates')] + [string[]]$Scenario = @('streamRest', 'midStreamSet', 'reconnectLoop', 'inStream', 'queueStress', 'rollover', 'idleStart', 'samplingRates'), [string[]]$Unit, [double]$Rate = 256, [int]$Seconds = 30,