This Library will help to interact with a Beckhoff PLC that is running as a Process Control System (PCS) with TwinCat 3.1 over a ADS router. There are some default exchange logic and structures for reuse. This Library is split into two parts, one for the .NET side an the other for the PCS side, also known as PLC, it help you on some point. Example on handling PCS commands, recording measurement data, and handling alarms.
.NET Library
- For documentation MBC.PCS.NET
- This library is based on the TC1000 | TwinCAT ADS.NET V6 .net Library from Beckhoff.
- changelog .net libraries
TwinCAT Library
- Installed ADS Router - TC1000 | TC3 ADS on the .Net side. This is required to connect to the TwinCat PLC over ADS.
- Configured ADS Router between the .Net application Host and the PLC. This is required to connect to the TwinCat PLC over ADS. Use Secure ADS!
- TwinCAT Version >= 4024.10
I recommend to use the library as submodule in your project. This is the easiest way to use the library. Publishing the library as a nuget package is a lot of work and we have stopped it.
Add the submodule to your project with the following command: git submodule add https://github.com/mbc-engineering/net-pcs.git src/submodules/
or add it manually to your
.gitmodules
file:[submodule "net-pcs"] path = src/submodules/net-pcs url = https://github.com/mbc-engineering/net-pcs.git branch = master
- .Net Framework >= 4.7.1, .net 8.0
- Visual Studio 2022
- TwinCat 3.1 4024 or newer
Clone repository and build
dotnet build .\NET\Mbc.Pcs.Net.sln
TwinCat\Mbc.Tc3.Pcs.sln
with TwinCat 3.1
For Deployment of the .Net nuget packages there is a Cake Build script.
> cd NET
# Unit Tests
..\NET> .\build.ps1 -t Test
# Publish nuget
..\NET> .\build.ps1 --target=NugetPublish --apikey=[xxxxxxxx]
First:
- Copy the new
Interop.TCEVENTLOGGERLib.dll
andInterop.TcEventLogProxyLib.dll
to theLibs
folder. - Update the
Build\Mbc.Pcs.Net.TwinCat.EventLog.nuspec
file with the correct version.
Second: Run the cake build Script > .\build.ps1 --target=NugetPush --nuspec="Build\Mbc.Pcs.Net.TwinCat.EventLog.nuspec" --apikey=[xxxxxxxx]
. This build the nuspec configuration to a package and push it to the mbcpublic
feed defined NET\NuGet.Config
.
First: In the File Mbc_Tc3_Pcs
project increment the Project Version number.
Second: In the subnote of Mbc_Tc3_Pcs
right click on the node Mbc_Tc3_Pcs Project
and select Save as library and install. Save the generated library unter TwinCat\Mbc.Tc3.Pcs\Library
with the following name Mbc_Tc3_Pcs_vx.x.x.x.library
(replace x with the Project Version number).
Third: Commit the created library to git and create a git tag with the name Mbc_Tc3_Pcs/vx.x.x.x
.
Feel free to contribute! After review it will merged into de main branch.
Please write your changes to the TwinCAT Library MBC.Tc3.PCS into the changelog.
This library was created by a company formerly known as mbc engineering, from Switzerland. This company used this library for their projects. After the split, we decided to release this library as open source.
Licensed under the Apache License, Version 2.0