Giter Club home page Giter Club logo

softbeckhoff's Introduction

SoftBeckhoff

.NET Core Docker Image CI

This project was inspired by SoftPlc and aims to reach the same goal: a virtual PLC (a Beckhoff in this case) for testing usage.

Beckhoff PLCs communicates with the ADS Protocol. Since there are no opensouce ADS Servers I wrote a simple one with reverse engineering.

Please note that this software is still under development.

Features

  • ✔️ Multiplatform + Docker Support (Windows, Linux, Mac OS)
  • ✔️ Configurable with an Rest API (Swagger)
  • ✔️ Works and act like a real Beckhoff!
  • ✔️ All native types are supported
  • ✔️ Route management on-board and over Rest API

Still under (heavy) development...

  • 🌈 Support for custom compex types and arrays

How to use it?

A good tool for testing and writing symbols is TwincatAdsTool. This software was even tested with it.

run with docker

docker pull fbarresi/softbeckhoff:latest
docker run -p 8080:80 -p 48898:48898 --name softBeckhoff fbarresi/softbeckhoff:latest

Run it locally

todo basically with source code and dotnet run

Would you like to contribute?

Yes, please!

  • give a ⭐
  • make a fork
  • use and spread the software!

Other interesting related projects

Credits

Special thanks to JetBrains for supporting this open source project.

did you understand that you didn't understand?

Don't hesitate to write me or open an issue into this project!

softbeckhoff's People

Contributors

dependabot[bot] avatar fbarresi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

softbeckhoff's Issues

GET undefined symbol results in 500 Server error

In the default server, calling GET: /symbols/test3 results in 500 Server error. I would have expected a 404.

System.ArgumentException: Symbol not found! at SoftBeckhoff.Services.BeckhoffServer.ReadSymbol(String name) in /app/Services/BeckhoffServer.cs:line 67 at SoftBeckhoff.Services.BeckhoffService.GetSymbol(String name) in /app/Services/BeckhoffService.cs:line 46 at lambda_method(Closure , Object , Object[] ) at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

Please add guidance on how to connect from TwinCAT XAE

I have started the docker container, and can connect to the swagger API using a web browser, but I don't know how to add a route to the softBeckhoff PLC.

Please add some guidance on what value to put into the routing, and/or if routes need to be set up on the softBeckhoff via the API.

how to test

How to test, how to use twincat client to read test data

Can't read/write virtual plc when running it from Docker

Hello, I am trying your virtual-plc and I have an issue.
When I start the program on my machine everything works fine and I can read and write values in ADS.
But when I am starting it in Docker, I can't read and write values in my plc. I have an exception : TwinCAT.Ads.AdsErrorException : 'Target port could not be found. (AdsErrorCode: 6, 0x6)'

image

Here is the log of my container :

dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Application Directories
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
=======================
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
ApplicationPath: /app/SoftBeckhoff.dll
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
BaseDirectory: /app/
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
CurrentDirectory: /app
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Configuration
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
=============
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
ASPNETCORE_ENVIRONMENT: Production
Provider: ChainedConfigurationProvider
Provider: JsonConfigurationProvider
Provider: JsonConfigurationProvider
Provider: EnvironmentVariablesConfigurationProvider
Provider: CommandLineConfigurationProvider
Provider: JsonConfigurationProvider
Local System: SoftBeckhoff, 192.168.1.20.1.1, 172.17.0.5

Configured routes:
RemoteSystem1, 10.30.2.124.1.1, RemoteSystem1

dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Starting remote listeners ...
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Starting listening on 172.17.0.5:48898
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Waiting for Request to AmsTcpIpRouter (192.168.1.20.1.1)
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
[AmsTcpIpRouter] Start Listener
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Opening Loopback listener '127.0.0.1:48898'
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
[AmsTcpIpRouter] Start Listener
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /app
info: SoftBeckhoff.Services.BeckhoffService[0]
Initializing Beckhoff server...
info: SoftBeckhoff.Services.BeckhoffService[0]
Beckhoff server created
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Opening Loopback listener '127.0.0.1:48898'
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
[AmsTcpIpRouter] Start Listener
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
[AmsTcpIpRouter] TCP Connect Endpoint: 127.0.0.1:37776
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Port '852' occupied!
info: TwinCAT.Ads.AdsRouterService.RouterService[0]
AdsServer with AmsPort '192.168.1.20.1.1:65535' registered!
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Starting Receive AdsServer '192.168.1.20.1.1:65535 (Endpoint: 127.0.0.1:37776)' registered!
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
--> Sending Frame: TcpFrame Flags: PortConnect, DataSize: 8 (TcpFrameSize: 14)
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
--> Send TcpFrame: TcpFrame Flags: PortConnect, DataSize: 8 (TcpFrameSize: 14)
info: TwinCAT.Ads.AdsRouterService.RouterService[0]
AdsServer '192.168.1.20.1.1:852' connected! (2 loopback connections active)
info: SoftBeckhoff.Services.BeckhoffService[0]
Beckhoff server connected = True with result = 852
info: Microsoft.Hosting.Lifetime[0]
Application is shutting down...
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
A task was canceled.
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
[AmsTcpIpRouter] TCP Disconnect Endpoint: 127.0.0.1:37776
dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]
Loopback listener '127.0.0.1:48898' closed!

Do you know what could cause that ?

Connect to docker via pyads

hey @fbarresi thanks for this amazing docker.

i want to connect to this docker via pyads.

the pyads' documentation provides a simple code example:

import pyads

 # Connection(ams_net_id: str | None = None, ams_net_port: int | None = None, ip_address: str | None = None)
plc = pyads.Connection('127.0.0.1.1.1', 851)
plc.open()
i = plc.read_by_name("GVL.int_val")
print(i)
plc.close()

what do i have to do to access the test1 variable from the docker? right now i'm always getting a connection timeout:

pyads.pyads_ex.ADSError: ADSError: timeout elapsed (1861).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.