![]() |
VOOZH | about |
dotnet add package NodalisEngine --version 1.0.12
NuGet\Install-Package NodalisEngine -Version 1.0.12
<PackageReference Include="NodalisEngine" Version="1.0.12" />
<PackageVersion Include="NodalisEngine" Version="1.0.12" />Directory.Packages.props
<PackageReference Include="NodalisEngine" />Project file
paket add NodalisEngine --version 1.0.12
#r "nuget: NodalisEngine, 1.0.12"
#:package NodalisEngine@1.0.12
#addin nuget:?package=NodalisEngine&version=1.0.12Install as a Cake Addin
#tool nuget:?package=NodalisEngine&version=1.0.12Install as a Cake Tool
NodalisEngine is a .NET Core 8.0 framework that executes JavaScript PLC programs produced by the Nodalis compiler. It embeds the Jint JavaScript engine, exposes IEC-61131-3 style function blocks, and provides fieldbus adapters (Modbus TCP and OPC UA) so your generated logic can talk to real hardware.
nodalis-compiler.net8.0 or higher application.Use your preferred NuGet workflow:
# dotnet CLI
dotnet add package NodalisEngine
# or inside Package Manager Console
Install-Package NodalisEngine
NodalisEngine currently targets net8.0.
Create a host application that derives from NodalisEngine and wires the abstract IO operations to your hardware or simulator:
using Nodalis;
public class PlantEngine : NodalisEngine
{
private readonly Dictionary<string, bool> _bits = new();
private readonly Dictionary<string, ushort> _words = new();
public override bool ReadBit(string address) => _bits.TryGetValue(address, out var value) && value;
public override void WriteBit(string address, bool value) => _bits[address] = value;
public override byte ReadByte(string address) => (byte)ReadWord(address);
public override void WriteByte(string address, byte value) => WriteWord(address, value);
public override ushort ReadWord(string address) => _words.TryGetValue(address, out var value) ? value : (ushort)0;
public override void WriteWord(string address, ushort value) => _words[address] = value;
public override uint ReadDWord(string address) => ReadWord(address);
public override void WriteDWord(string address, uint value) => WriteWord(address, (ushort)value);
}
Then load and execute the PLC program that the Nodalis compiler produced:
var engine = new PlantEngine();
var javascript = File.ReadAllText("build/plc.js");
engine.Load(javascript);
engine.Setup();
while (true)
{
engine.Execute(); // Runs the user logic
engine.SuperviseIO(); // Polls any mapped IO clients
await Task.Delay(10); // Adjust scan time as needed
}
Function blocks can be instantiated directly from the generated JavaScript, but you can also create them from .NET by calling CreateFunctionBlock("TON"), set inputs, and invoke Call().
When you call mapIO(json) from the generated JavaScript (the compiler does this automatically), NodalisEngine instantiates the appropriate IOClient for each mapping. Two clients ship out of the box:
%I, %Q, %IW, %QW, etc.You can extend the transport layer by overriding CreateClient(IOMap map) and returning your own IOClient implementation whenever a custom protocol identifier is encountered.
For vertical integration, you can expose the running PLC variables via the included OPCServer helper:
var opc = new OPCServer(engine);
opc.MapVariable("TankLevel", "%IW0");
opc.MapVariable("StartCommand", "%QX0.0");
await opc.StartAsync();
This spins up an OPC UA endpoint at opc.tcp://localhost:4840/UA/Nodalis using OPCFoundation.NetStandard.Opc.Ua. Each mapped variable mirrors values from your engine’s address space.
NodalisEngine is distributed under the Apache 2.0 license. See the headers inside the source files for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.