ZeroBus.Core 1.1.0

dotnet add package ZeroBus.Core --version 1.1.0
                    
NuGet\Install-Package ZeroBus.Core -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZeroBus.Core" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroBus.Core" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ZeroBus.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZeroBus.Core --version 1.1.0
                    
#r "nuget: ZeroBus.Core, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZeroBus.Core@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZeroBus.Core&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ZeroBus.Core&version=1.1.0
                    
Install as a Cake Tool

ZeroBus

ZeroPlatform Tier License: MIT .NET Multi-Targeting Pure C#

ZeroBus is a deterministic industrial motion fieldbus engine for .NET with zero external dependencies. It provides:

  1. CAN 2.0A / 2.0B & SocketCAN Core: Zero-allocation raw CAN frame transport, hardware acceptance filters, and lock-free virtual bus routers.
  2. CANopen Application Layer (CiA 301): Network Management (NMT Master), Service Data Object (SDO Client with expedited & segmented transfers), and Process Data Objects (PDO).
  3. CiA 402 Servo Drive & Motion Control: Multi-axis servo drive state machine transitions (Shutdown, SwitchOn, EnableOperation) with Profile Position (PPM), Profile Velocity (PVM), and Cyclic Synchronous Position (CSP).
  4. EtherCAT Master Stack: Pure C# EtherCAT state machine (Init, Pre-Op, Safe-Op, Op), Datagram serialization (APRD, FPRD, BRD, LRW), CoE (CANopen over EtherCAT), and sub-millisecond cyclic PDO exchange.

๐Ÿ›๏ธ Architecture & Governance

ZeroBus complies strictly with SPEC-ARCH-001 as a Tier 2 (Transport & Storage) subsystem. It cleanly separates real-time deterministic servo motion fieldbuses (ZeroBus) from general PLC register polling (ZeroComm).

       Tier 0: ZeroPrimitives & ZeroConcurrency (Lock-Free Ring Buffers & Schedulers)
                         โ†“
       Tier 2: ZeroBus (CAN / CANopen CiA 402 & EtherCAT Master)
                         โ†“
       Tier 3: ZeroMotion (Kinematics & Trajectory Feedforward Coordinates)

๐Ÿ“ฆ Developer API Examples

1. Multi-Axis Servo Control over CANopen (CiA 402)

using ZeroBus.Can;
using ZeroBus.CanOpen;

// 1. Initialize Virtual or SocketCAN Transport
var bus = new VirtualCanBus();
using var transport = new VirtualCanTransport(bus);
await transport.ConnectAsync();

// 2. Attach CANopen NMT Master & SDO Client
var nmt = new NmtMaster(transport);
var sdo = new SdoClient(transport);

// 3. Connect CiA 402 Servo Drive (Node ID 1)
var drive = new CiA402Drive(nodeId: 1, transport, sdo);

// 4. Power up servo state machine
await nmt.StartNodeAsync(1);
await drive.StartupServoAsync();

// 5. Send Cyclic Synchronous Position (CSP) command
await drive.SendCspPdoAsync(controlword: 0x000F, targetPosition: 125000);

2. EtherCAT Master Scan & State Transition

using ZeroBus.EtherCat;

using var ecTransport = new VirtualEtherCatTransport();
await ecTransport.ConnectAsync();

var master = new EtherCatMaster(ecTransport);

// 1. Scan online slaves via Broadcast Read (BRD)
int slaveCount = await master.ScanSlavesAsync();
Console.WriteLine($"Discovered {slaveCount} EtherCAT slaves.");

// 2. Transition slaves from Init -> Pre-Op -> Safe-Op -> Operational
await master.TransitionStateAsync(EtherCatState.PreOp);
await master.TransitionStateAsync(EtherCatState.SafeOp);
await master.TransitionStateAsync(EtherCatState.Op);

// 3. High-frequency cyclic PDO process data exchange
byte[] txPdo = new byte[32]; // Target positions / controlwords
byte[] rxPdo = new byte[32]; // Actual positions / statuswords
ushort wkc = await master.ExchangeProcessDataAsync(txPdo, rxPdo);

3. Multi-Axis Motion Coordination & Following-Error Trip

using ZeroBus.CanOpen;

// Multi-axis coordinator ensures lockstep execution and mechanical safety
var sync = new SyncProducer(transport);
var coordinator = new MotionBusCoordinator(sync);

coordinator.AddAxis(driveAxis1, maxAllowedFollowingError: 500);
coordinator.AddAxis(driveAxis2, maxAllowedFollowingError: 500);

// Emergency trip callback (triggers sub-ms QuickStop on mechanical jamming)
coordinator.OnFollowingErrorTripped += (nodeId, error, max) =>
{
    Console.WriteLine($"[EMERGENCY] Node {nodeId} tripped following error: {error} counts!");
};

// Cyclic synchronous tick (called at 250Hz - 1kHz)
await coordinator.SyncTickAsync(new int[] { targetPos1, targetPos2 });

4. CANopen Heartbeat & Liveness Monitor

var monitor = new HeartbeatMonitor(transport);
monitor.RegisterNode(nodeId: 2);

monitor.OnNodeTimeout += nodeId =>
{
    Console.WriteLine($"[ALERT] Servo Drive Node {nodeId} connection lost!");
};

// Periodically evaluate slave liveness
monitor.CheckTimeouts(TimeSpan.FromMilliseconds(200));

5. EtherCAT CoE (CANopen over EtherCAT) Mailbox Transfer

using ZeroBus.EtherCat;

// Build SDO Download (Write Target Velocity 0x60FF)
byte[] sdoWriteFrame = EtherCatCoeMailbox.BuildSdoDownload(
    index: 0x60FF, subIndex: 0,
    value: BitConverter.GetBytes(50000),
    slaveAddress: 1001
);

// Build SDO Upload (Read Actual Position 0x6064)
byte[] sdoReadFrame = EtherCatCoeMailbox.BuildSdoUpload(index: 0x6064, subIndex: 0);

๐Ÿ“„ License

MIT License ยฉ 2026 Phong Vรต. Part of the ZeroPlatform project.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  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 Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 48 10/7/2026