A comprehensive, easy-to-use C# .NET library for CiA DS 306 - Electronic Data Sheet (EDS), Device Configuration File (DCF) and Nodelist Project (CPJ) for CANopen devices.
β¨ Simple API - Intuitive, fluent API style for quick integration
π Read EDS - Complete parsing of Electronic Data Sheets
π Read & Write DCF - Process and create Device Configuration Files
π Read & Write CPJ - Parse and create Nodelist Project files (CiA 306-3 network topologies)
π EDS to DCF Conversion - Easy conversion with configuration parameters
π― Type-Safe - Fully typed models for all CANopen objects
π¦ Modular - Support for modular devices (bus couplers + modules)
β CiA DS 306 v1.4 Compliant - Implemented according to official specification
using EdsDcfNet;
// Read EDS file
var eds = CanOpenFile.ReadEds("device.eds");
// Display device information
Console.WriteLine($"Device: {eds.DeviceInfo.ProductName}");
Console.WriteLine($"Vendor: {eds.DeviceInfo.VendorName}");
Console.WriteLine($"Product Number: 0x{eds.DeviceInfo.ProductNumber:X}");using EdsDcfNet;
// Read DCF file
var dcf = CanOpenFile.ReadDcf("configured_device.dcf");
Console.WriteLine($"Node ID: {dcf.DeviceCommissioning.NodeId}");
Console.WriteLine($"Baudrate: {dcf.DeviceCommissioning.Baudrate} kbit/s");using EdsDcfNet;
// Read EDS
var eds = CanOpenFile.ReadEds("device.eds");
// Convert to DCF with node ID and baudrate
var dcf = CanOpenFile.EdsToDcf(eds, nodeId: 2, baudrate: 500, nodeName: "MyDevice");
// Save DCF
CanOpenFile.WriteDcf(dcf, "device_node2.dcf");using EdsDcfNet;
using EdsDcfNet.Models;
// Read a CPJ file describing the network topology
var cpj = CanOpenFile.ReadCpj("nodelist.cpj");
foreach (var network in cpj.Networks)
{
Console.WriteLine($"Network: {network.NetName}");
foreach (var node in network.Nodes.Values)
{
Console.WriteLine($" Node {node.NodeId}: {node.Name} ({node.DcfFileName})");
}
}
// Create a new CPJ
var project = new NodelistProject();
project.Networks.Add(new NetworkTopology
{
NetName = "Production Line 1",
Nodes =
{
[2] = new NetworkNode { NodeId = 2, Present = true, Name = "PLC", DcfFileName = "plc.dcf" },
[3] = new NetworkNode { NodeId = 3, Present = true, Name = "IO Module", DcfFileName = "io.dcf" }
}
});
CanOpenFile.WriteCpj(project, "network.cpj");using EdsDcfNet.Extensions;
var dcf = CanOpenFile.ReadDcf("device.dcf");
// Get object
var deviceType = dcf.ObjectDictionary.GetObject(0x1000);
// Set value
dcf.ObjectDictionary.SetParameterValue(0x1000, "0x00000191");
// Browse PDO objects
var tpdos = dcf.ObjectDictionary.GetPdoCommunicationParameters(transmit: true);// Read EDS
ElectronicDataSheet ReadEds(string filePath)
ElectronicDataSheet ReadEdsFromString(string content)
// Read DCF
DeviceConfigurationFile ReadDcf(string filePath)
DeviceConfigurationFile ReadDcfFromString(string content)
// Write DCF
void WriteDcf(DeviceConfigurationFile dcf, string filePath)
string WriteDcfToString(DeviceConfigurationFile dcf)
// Read CPJ (CiA 306-3 Nodelist Project)
NodelistProject ReadCpj(string filePath)
NodelistProject ReadCpjFromString(string content)
// Write CPJ
void WriteCpj(NodelistProject cpj, string filePath)
string WriteCpjToString(NodelistProject cpj)
// Convert EDS to DCF
DeviceConfigurationFile EdsToDcf(ElectronicDataSheet eds, byte nodeId,
ushort baudrate = 250, string? nodeName = null)- β Complete EDS parsing
- β Complete DCF parsing and writing
- β CPJ nodelist project parsing and writing (CiA 306-3 network topologies)
- β All Object Types (NULL, DOMAIN, DEFTYPE, DEFSTRUCT, VAR, ARRAY, RECORD)
- β Sub-objects and sub-indexes
- β Compact Storage (CompactSubObj, CompactPDO)
- β Object Links
- β Modular device concept
- β Hexadecimal, decimal, and octal numbers
- β $NODEID formula evaluation (e.g., $NODEID+0x200)
- β CANopen Safety (EN 50325-5) - SRDOMapping, InvertedSRAD
- β Comments and additional sections
Complete examples can be found in the examples/EdsDcfNet.Examples project.
eds-dcf-net/
βββ src/
β βββ EdsDcfNet/ # Main library
β βββ Models/ # Data models
β βββ Parsers/ # EDS/DCF/CPJ parsers
β βββ Writers/ # DCF/CPJ writers
β βββ Utilities/ # Helper classes
β βββ Exceptions/ # Custom exceptions
β βββ Extensions/ # Extension methods
βββ examples/
β βββ EdsDcfNet.Examples/ # Example application
βββ docs/
βββ architecture/ # ARC42 software architecture
βββ cia/ # CiA DS 306 specification
For consuming the NuGet package:
- Any .NET implementation compatible with .NET Standard 2.0 (e.g., .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5+, Unity, Xamarin)
For building this repository (library, tests, examples):
- .NET SDK 10.0 or higher
- C# 13.0 (as provided by the .NET 10 SDK)
MIT License - see LICENSE file
Based on CiA DS 306 Version 1.4.0 (December 15, 2021) "Electronic data sheet specification for CANopen"
For questions or issues:
- GitHub Issues: https://github.com/dborgards/eds-dcf-net/issues
EdsDcfNet - Professional CANopen EDS/DCF processing in C# .NET