Movensys.BlackBox.Core
1.1.1
dotnet add package Movensys.BlackBox.Core --version 1.1.1
NuGet\Install-Package Movensys.BlackBox.Core -Version 1.1.1
<PackageReference Include="Movensys.BlackBox.Core" Version="1.1.1" />
<PackageVersion Include="Movensys.BlackBox.Core" Version="1.1.1" />
<PackageReference Include="Movensys.BlackBox.Core" />
paket add Movensys.BlackBox.Core --version 1.1.1
#r "nuget: Movensys.BlackBox.Core, 1.1.1"
#:package Movensys.BlackBox.Core@1.1.1
#addin nuget:?package=Movensys.BlackBox.Core&version=1.1.1
#tool nuget:?package=Movensys.BlackBox.Core&version=1.1.1
Movensys.BlackBox.Core
A library for collecting motion, digital I/O, and analog I/O status data from WMX3-based systems. It records data in real-time using WMX3's memory logging feature and saves the data with pre/post trigger conditions. CSV and JSON files are automatically generated for analysis with MotionScope.
Requirements
- .NET Framework 4.5 or later
- WMX3 Runtime must be installed
Features
- Real-time data logging with WMX3 Memory Log
- Configurable monitored axes and I/O channels
- Pre-trigger / Post-trigger data collection support
- Auto-generation of CSV + JSON files compatible with MotionScope
- Launch MotionScope directly with the generated data
Basic Usage Example
using Movensys.BlackBox.Core;
using Movensys.BlackBox.Core.Models;
// Initialization
var blackBox = BlackBoxManager.GetBlackBoxService();
blackBox.CreateDevice();
blackBox.InitMemoryLog();
// Configure axes
blackBox.SetBlackBoxAxes(new List<BlackBoxAxisInfo>
{
new BlackBoxAxisInfo { AxisIndex = 0, AxisDataType = AxisDataType.CommandPos, Name = "Axis0" },
new BlackBoxAxisInfo { AxisIndex = 1, AxisDataType = AxisDataType.FeedbackVelocity, Name = "Axis1" },
});
// Configure Digital I/O
blackBox.SetBlackBoxDigitalIO(new List<DigitalIOAddress>
{
new DigitalIOAddress { Byte = 0, Bit = 0, Name = "Start", Type = IoType.Input },
new DigitalIOAddress { Byte = 1, Bit = 0, Name = "AlarmReset", Type = IoType.Output }
});
// Start logging
blackBox.SetLoggingCycle(preCycleCount: 10000, postCycleCount: 500);
blackBox.StartBlackBox();
// Trigger occurs
blackBox.SaveBlackBoxData();
// Stop logging after completion
blackBox.StopBlackBox();
// Open MotionScope with saved data
blackBox.StartMotionScope(@"C:\BlackBoxLogs\20250717\BlackBoxData_Alarm.csv");
Unit Mode - Equipment with Many Units (1.1.0)
For equipment made of many identical units (dozens of units, each with a few axes and sensors) where alarms occur per unit, often several at once. Equipment with only a handful of axes keeps using the basic mode above (axes and I/O configured directly).
How It Works
One engine memory-log channel (axes + digital inputs of every unit)
| every cycle (GetMemoryLogData, up to 100 cycles per read)
v
Ring buffer in code (Pre + Post + 2,048 cycles, preallocated) <- collection keeps running during a dump
| SaveBlackBoxData(name, units) = trigger
v
Window [trigger - Pre, trigger + Post], selected units' columns only -> writer thread -> CSV + JSON (MotionScope)
- Only one channel is used. Memory-log channels are an engine-wide resource (16 in total) shared by every program, so one channel per unit would run out quickly.
- The axes and inputs of all units are collected together, and only the faulted unit + neighboring units are copied into a dump.
- The first trigger defines the window. Other triggers that arrive before the window is complete (simultaneous alarms on other units) add their names and units to the same dump and are listed in
_Triggers.txt. Repeated alarms do not keep pushing the window back. - A trigger that arrives after the window is complete starts a new dump. Collection never stops, so its pre-trigger data is intact (1.0.x stopped and restarted the memory log for each dump, so an alarm right after a dump had no pre-trigger data).
Usage Example
using Movensys.BlackBox.Core;
using Movensys.BlackBox.Core.Enums;
using Movensys.BlackBox.Core.Models;
var bb = BlackBoxManager.GetBlackBoxService(); // created on the first call (throws here if the WMX runtime is missing - catch it on the caller side)
if (!bb.CreateDevice()) return;
if (bb.InitMemoryLog() != 0) { bb.Close(); return; } // no idle channel = BlackBoxService.ErrorNoIdleChannel (-1)
bb.SetLogFilePath(@"D:\App\Log_BlackBox");
bb.SetLoggingCycle(preCycleCount: 3000, postCycleCount: 1000); // 1 ms cycle = 3 s before / 1 s after
var units = new List<BlackBoxUnit>();
foreach (var unit in machineUnits)
{
var u = new BlackBoxUnit { Name = unit.Name };
u.Axes.Add(new BlackBoxAxisInfo { AxisIndex = unit.Axis, AxisDataType = AxisDataType.CommandVelocity, Name = $"{unit.Name} Axis" });
u.Axes.Add(new BlackBoxAxisInfo { AxisIndex = unit.Axis, AxisDataType = AxisDataType.FeedbackVelocity, Name = $"{unit.Name} Axis" });
u.Axes.Add(new BlackBoxAxisInfo { AxisIndex = unit.Axis, AxisDataType = AxisDataType.FeedbackPos, Name = $"{unit.Name} Axis" });
u.DigitalIO.Add(new DigitalIOAddress { Name = $"{unit.Name} Sensor", Type = IoType.Input, Byte = unit.SensorByte, Bit = unit.SensorBit });
units.Add(u);
}
bb.SetBlackBoxUnits(units); // the same axis / data type / address is collected only once
bb.DumpSaved += (csv, names, gaps) => Log($"BlackBox {csv} [{string.Join(",", names)}] gaps {gaps}");
bb.StartBlackBox();
// On an alarm (the unit + its neighbors)
bb.SaveBlackBoxData("UNIT_03_SENSOR_TIMEOUT", new[] { "UNIT_03", "UNIT_02", "UNIT_04" });
// Always on program exit (returns the channel and closes the device).
// A forced kill does not return the channel (it is freed when the engine restarts).
bb.Close();
Output Files
Under {log path}\yyyy\MM\dd\HH\yyyyMMdd_HH_mm_ss_fff_BlackBoxData_{first trigger name}
| File | Contents |
|---|---|
.csv |
MotionScope format (AxisDataType,MotionScope / Config,1 / Cycle,{data type}-{axis},...,Input-{byte}.{bit}). Selected units' columns only |
.json |
MotionScope chart settings. Unit mode = one chart per axis data type (e.g. command velocity / feedback velocity / position) + an input chart. Neighboring units overlap on the same chart, so speed synchronization and sensor order can be compared. Marker line = trigger row |
_Triggers.txt |
Only when the window has two or more triggers or the engine log has gaps: row position and name of each trigger, number of missing cycles |
To open in MotionScope: bb.StartMotionScope(csvPath), or open the CSV in WMX WOS\MotionScope.exe (the JSON with the same name is used as the chart settings).
Status / Errors (1.1.0)
| Property / Event | Meaning |
|---|---|
LastError / LastErrorText |
Last error (memory-log read, channel, file write). InitMemoryLog: no idle channel → ErrorNoIdleChannel; an idle channel could not be opened → that WMX code (1.1.1) |
ReadErrorCount |
Number of memory-log read failures (1.0.x dropped them silently) |
GapCycles |
Accumulated engine memory-log gaps (skipped CycleCounter). The engine buffer holds 1,024 cycles, so a gap occurs when the collection thread cannot read for longer than that (about 1 s at a 1 ms cycle) |
SkippedTriggers |
Number of triggers dropped because collection was not running |
DumpSaved |
Raised after a dump file is written (CSV path, trigger names, gaps in that window) |
Limits (WMX Memory Log)
- Up to 128 axes, 128 bytes of digital input (1,024 bits) and 128 bytes of digital output.
- Unit-mode inputs are digital only (analog = basic mode).
- Memory = ring rows x (axis columns x 8 B + 128 B each for input and output). Example: (3,000 pre + 1,000 post + 2,048) rows x 210 axis columns = about 10 MB, + I/O 1.5 MB.
Log Storage Path
By default, log files are stored in the application's working directory. You can change the location with SetLogFilePath(). Log files are saved in a date/time-based folder structure and include both CSV data and JSON metadata.
Important Notes
- Requires a valid WMX3 license and driver installation.
- Make sure to call Close() after CreateDevice() to release resources properly.
Release History
Nov 17, 2026 - 1.1.1 ver<br> Axis columns read from the memory-log output slot of the axis selection order (
axisData[cycle][n], n = n-th selected axis). 1.1.0 and earlier read slot = axis number, which only matched when the selected axes start at 0 and are contiguous (e.g. axes 0 ~ 4); other selections (e.g. axes 90 · 91, or a selection starting at axis 32) were saved as 0. Axis selection is now sorted ascending.CreateDevicechecks whether the device is alive (1.1.0 checked the device name, so a second start afterCloseran without a device);Closealso closes a channel buffer that was opened but never started;InitMemoryLogreturns the status-read error when channel status cannot be read (e.g.CommNotStarted0x601 = called before WMX communication starts - start the black box after communication is running), and when it finds no usable channel,LastErrorTextlists every channel status (ch0:Running ch1:Idle open 0x... ...). Digital IO CSV columns are namedInput-{byte}.{bit}/Output-{byte}.{bit}- the MotionScope format; the earlierInput-{bit number}columns made MotionScope show 'Load(JSON CSV File)' listing every input series (checked by opening a dump in WOS\MotionScope.exe).InitMemoryLogreturns the firstOpenMemoryLogBuffererror when idle channels exist but none could be opened (1.1.0 overwrote it withErrorNoIdleChannel). Verified with random digital-input patterns (40 patterns over 3 bytes, non-contiguous bits: order · values · hold length ± 1 ms) and jogging axes 90 / 91 (command velocity · feedback position).
Nov 17, 2026 - 1.1.0 ver<br> Multi-unit equipment (many identical units · alarms in bursts): continuous collection (memory log is no longer stopped while a dump is written - a second alarm right after keeps its pre-trigger data), preallocated ring of the configured axis columns / IO bytes (no per-cycle 128-axis objects), first trigger defines the window and later triggers inside it are listed in
_Triggers.txt,SaveBlackBoxData(name),DumpSavedevent, read errors / cycle gaps exposed (LastError·ReadErrorCount·GapCycles), unique file names (ms),InitMemoryLogreturnsErrorNoIdleChannelwhen no idle channel,Closestops collection and closes the channel buffer,BlackBoxManagercreates the service lazily (no WMX CLR object in the static constructor).
Jul 16, 2026 - 1.0.78 ver<br> Fixed a crash when the configured log path is unavailable, added a fallback to the default directory, prevented re-triggering from postponing an in-progress dump, and removed an unused Peek() that threw on an empty buffer.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
-
.NETFramework 4.5
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.5.1
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.5.2
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.6
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.6.1
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.6.2
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.7
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.7.1
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.7.2
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.8
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
.NETFramework 4.8.1
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
net5.0
- Microsoft.Win32.Registry (>= 5.0.0)
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Movensys.LogHelper.Core (>= 1.4.5)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Movensys.BlackBox.Core:
| Package | Downloads |
|---|---|
|
Movensys.BlackBox.WinForms
Created by Movensys Application Team with BlackBox functionality |
GitHub repositories
This package is not used by any popular GitHub repositories.