- Notifications
You must be signed in to change notification settings - Fork11
A Mewtocol protocol library to interface with Panasonic PLCs over TCP/Serial written in C#
License
OpenLogics/MewtocolNet
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
An easy to use Mewtocol protocol library to interface with Panasonic PLCs over TCP/Serial.
⚠️ This library is not an official panasonic product nor does panasonic provide financial support or limitations in any form.
⚠️ FP7 is currently not supported
For a full list checkthis table
This library was only tested with a few PLCs, other types that support the Panasonic Mewtocol protocol might work.Use at your own risk, others might follow with community feedback
- TCP/IP and Serial Port support
- Get type and hardware information of PLCs
- Get PLC program metadata such as program version and IDs
- Read and write registers in real time
- Basic data types / structures support
- Fast readback cycles due to a MemoryManager that optimizes TCP / Serial frames by combining areas
- Fully customizable heartbeats and polling levels (tell the interface when you need register updates)
- Easy to use builder patterns for interface and register generation
- Register type casting from property attributes
- Change RUN / PROG modes
- Delete Programs
- Write / read low level byte blocks to areas
- Scanning for network devices and change network settings (WDConfigurator features)
- Upload / Download programs to the PLC
- Reading / writing PLC system registers
- Advanced data structures like SDTs and SDT Arrays
- Custom open source program compiler for PLC cpus
This library was written innetstandard2.0 and should be compatible with a lot of .NET environments.
For a full list of supported .NET clrs seethis page
Use the dotnet CLI and run
dotnet add package Mewtocol.NET
Panasonic has published aprotocol definition on their site.Refer to this site if you want to see the general functionality or add / report missing features.
This library is at the time not feature complete, but all essential features are provided
To see a full list of examplesclick here.
Connecting to a PLC is as simple as
usingMewtocolNet;using(varplc=Mewtocol.Ethernet("192.168.178.55").Build()){awaitplc.ConnectAsync();if(!plc.IsConnected){Console.WriteLine("Failed to connect to the plc...");}else{Console.WriteLine(plc.PlcInfo);}}
- Create a new class that inherits from
RegisterCollection
usingMewtocolNet;usingMewtocolNet.RegisterAttributes;publicclassTestRegisters:RegisterCollection{//corresponds to a R100 boolean register in the PLC[Register("R100")]publicboolTestBool1{get;privateset;}//corresponds to a XD input of the PLC[Register("XD")]publicboolTestBoolInputXD{get;privateset;}//corresponds to a DDT7012 - DDT7013 as a 32bit time value that gets parsed as a timespan (TIME)//the smallest value to communicate to the PLC is 10ms[Register("DDT7012")]publicTimeSpanTestTime{get;privateset;}//corresponds to a DT1101 - DT1104 string register in the PLC with (STRING[4])[Register("DT1101","STRING[4]")]publicstringTestString1{get;privateset;}}
- Connect to the PLC and attach the register collection and logger
- attach an automatic poller by chaining
.WithPoller()after the register attachment
TestRegistersregisters=null;//setting up a new PLC serial interface and tell it to use the register collectionvarplc=Mewtocol.Serial("COM4",BaudRate._19200).WithPoller().WithRegisterCollections(c=>{registers=c.AddCollection<TestRegisters>();// or use// c.AddCollection(new TestRegisters());// if you want to pass data to a constructor}).Build();//connect to itawaitplc.ConnectAsync(async()=>{//restart the plc program during the connection processawaitplc.RestartProgramAsync();});//wait for the first data cycle of the poller module//otherwise the property value might still be unset or nullawaitApp.ViewModel.Plc.AwaitFirstDataCycleAsync();if(App.ViewModel.Plc.IsConnected){Console.WriteLine(registers.TestBool1);}
- Your properties are getting automatically updated after the initial connection
Note! this is not your only option to read registers, see here
In addition to the automatic property binding you can use these patterns:
awaitplc.Register.Struct<short>("DT100").WriteAsync(100);varvalue=awaitplc.Register.Struct<short>("DT100").ReadAsync();
IRegister<bool>outputContactReference;varplc=Mewtocol.Ethernet("127.0.0.1").WithRegisters(b=>{b.Bool("Y4").Build(outoutputContactReference);}).Build();awaitplc.ConnectAsync();awaitoutputContactReference.WriteAsync(true);
About
A Mewtocol protocol library to interface with Panasonic PLCs over TCP/Serial written in C#
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.