Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is twincat 2 version technical possible? #1

Open
Dunkelicht opened this issue Nov 13, 2021 · 13 comments
Open

Is twincat 2 version technical possible? #1

Dunkelicht opened this issue Nov 13, 2021 · 13 comments
Assignees
Labels
question Further information is requested

Comments

@Dunkelicht
Copy link

Thanks for this s7 protocol, I use PROFINET to exchange data between S7 and twincat2.
S7 is maybe a better choice for non-realtime variables, is there any possibility to implement this into twincat 2 ?

Many thanks and stay safe!

@fbarresi fbarresi self-assigned this Nov 16, 2021
@fbarresi fbarresi added the question Further information is requested label Nov 16, 2021
@fbarresi
Copy link
Owner

Hi!
I fear this request might have the same end like this other issue 😿 .

This software is a dotnet core 3.1 service. It just need the runtime installed in order to run.
The problem: twincat2 plcs are, as far as I know, windows ce based and microsoft don't support it any more. That means there is no way to compile this software in order to run within a twincat2 plc.

I really regret to tell you, I actually don't see any future work in this direction.

But, which alternative do you have?

  • Upgrade you PLC? (Maybe is that not an option for you)
  • Run the software remotely (from another computer in the same network): This service only need a connection to s7 and twincat. It doesn't need to run on the plc.

The newest twincat driver also works under linux: if you would give a try I would be happy to support you updating this software. It would work on every os and architecture, from Raspberry Pi to VM.

Best regards,
FB

@Dunkelicht
Copy link
Author

Dunkelicht commented Nov 16, 2021

Wow, thanks a lot for this detailed reply.

Microsoft has gave up WinCE and no support for dot net core, it is OK for me as I use twincat 2 in Win10 LTSC IoT 32 bit version.

TwinCAT 2 is reliable on Win10 LTSC IoT version like CX51xx and future AMD version IPC, Beckhoff has told us as least twincat 2 will be offered as least before year 2030.

I am now at site now and no time for checking details of code, I think it is TwinCAT 2 data exchange between TFU002 is Ads or memory swap, then TFU002 will do the communication with S7, like other Beckhoff supplement. If my statement is right, working with twincat 2 is technology possible.

Even with your sharp7/ snap7 server, you could do a s7 server, so the S7-1500 will do the s7 client, this will help as S7-1500 could use optimized DB.

Moreover I am also trying to use TS6310 to do so or to do some customized telegram to sync data, but they are too complicated.

Sorry I did not check old issues, next time I will do some research before, I just too excited about s7 support.

Thanks a lot! Stay safe!

@Dunkelicht
Copy link
Author

http://snap7.sourceforge.net/snap7_server.html

This snap7 server, with this you could make a "fake" S7 315-2PN/DP and put variables into it. So

  • WinCC could connect to it without OPC. Other SCADA could also connect to TwinCAT 2/3 via S7 protocol (s7-300 version).
  • S7-1500 could exchange data all by S7-1500, no need to change optimized DBs settings in Siemens site, programing will be easier in Siemens part but harder in TwinCAT 2/3 part.

Of course this will make this into a S7 Server rather than S7 client. This will help someone who do not know much about ADS.

Just a thought, detailed work will be very difficult and this is information only and not a request for this moment.

@fbarresi
Copy link
Owner

Hi!
Ok, if your are running windows 10 (LTSC) there is surely no problem with dotnet core software! 👍
Twincat 2 fully supports variables attributes, so I think it will work.

You may want to give a try to my other project softplc. It is also based on sharp7/snap7 and let you start a virtual s7 as docker or just as a software with an API for manual create or set content dynamically.

@Dunkelicht
Copy link
Author

Dunkelicht commented Nov 17, 2021

Hi! Ok, if your are running windows 10 (LTSC) there is surely no problem with dotnet core software! +1 Twincat 2 fully supports variables attributes, so I think it will work.

You may want to give a try to my other project softplc. It is also based on sharp7/snap7 and let you start a virtual s7 as docker or just as a software with an API for manual create or set content dynamically.

Thanks again, but I failed to build with x32 bit version, I will try it later, install VS2019 into IPC is too heavy.
I will try softplc later, I use vmware to simulate twincat 2 and winac, it works only in simulation.

@fbarresi
Copy link
Owner

Sorry, I don't understand what do you need to build. The software is compiled for any-CPU.

@Dunkelicht
Copy link
Author

Sorry, I don't understand what do you need to build. The software is compiled for any-CPU.

It cannot run on x32 bit windows, I have tested it on x32 win7 and win10 iot x32. TFU002.Service is 64 bit exe. So I try to build a x32/86 version.

@Dunkelicht
Copy link
Author

Snipaste_2021-11-18_14-37-52

@fbarresi
Copy link
Owner

You normally just need to change the runtime identifier during the build.
Did you installed the runtime on the target system? Otherwise you can compile the software as a self contained application.

@Dunkelicht
Copy link
Author

You normally just need to change the runtime identifier during the build. Did you installed the runtime on the target system? Otherwise you can compile the software as a self contained application.

Yes I installed both x32 and x64 sdk, I need find a way to build x32 bit.
Thanks for the info again.

@Dunkelicht
Copy link
Author

Thanks again for update, it is now running at x32 bit windows.

But it is not able to connect to TwinCAT 2.11.2305,

" Twincat 2 fully supports variables attributes, so I think it will work." could you please give some info about this?

Error log is below, connecting to Siemens is OK.

https://github.com/fbarresi/BeckhoffS7Client/blob/5efb2962c14f653eff26df55a9bad08d67f9a1af/TFU002/TFU002.Interfaces/Models/BeckhoffSettings.cs

public int Port { get; set; } = 851;

I changed port from 851 to 801. Please do not blame me as I am a new C# learner.

Please stay safe!

2021-12-16 14:59:53.322 +08:00 [DBG] Hosting starting
2021-12-16 14:59:53.521 +08:00 [DBG] Actual path: C:\Users\TFUServiceUser\AppData\Local\Temp.net\TFU002.Service\unka2gfn.abt
2021-12-16 14:59:53.564 +08:00 [INF] Looking for application settings into C:\TwinCAT\Functions\Unofficial\BeckhoffS7Client\TFU002.settings.json
2021-12-16 14:59:54.159 +08:00 [INF] Application settings successfully loaded!
2021-12-16 14:59:55.539 +08:00 [INF] Staring initialization for IBeckhoffService...
2021-12-16 14:59:55.544 +08:00 [INF] Connecting with Beckhoff at '192.168.10.105.1.1:801'...
2021-12-16 14:59:55.857 +08:00 [ERR] Error while initializing beckhoff
TwinCAT.AdsException: Cannot register Port '0'
at TwinCAT.Ads.Server.AmsServerNet.AmsConnect(UInt16 port, String portName)
at TwinCAT.Ads.Server.AmsServer.ConnectServer()
at TwinCAT.Ads.Server.AdsServer.ConnectServer()
at TwinCAT.Ads.AdsClient.Connect(AmsAddress address)
at TwinCAT.Ads.AdsClient.Connect(AmsNetId netId, Int32 port)
at TwinCAT.Ads.AdsClient.Connect(String netId, Int32 port)
at TFU002.Logic.Services.BeckhoffService.InitializeBeckhoff(BeckhoffSettings setting)
at TFU002.Logic.Services.BeckhoffService.Initialize()
2021-12-16 14:59:55.952 +08:00 [DBG] Connection state changed to 'None'
2021-12-16 14:59:55.975 +08:00 [DBG] Ads state changed to 'Init'
2021-12-16 14:59:55.976 +08:00 [DBG] Deleting symbols on beckhoff state change to Init
2021-12-16 14:59:55.980 +08:00 [INF] Initialization of IBeckhoffService completed with result: True
2021-12-16 14:59:55.980 +08:00 [INF] Staring initialization for IPlcProvider...
2021-12-16 14:59:56.212 +08:00 [DBG] PLC 's7-1500' state changed to 'Initial'
2021-12-16 14:59:56.214 +08:00 [INF] Initialization of IPlcProvider completed with result: True
2021-12-16 14:59:56.218 +08:00 [DBG] PLC 's7-1500' state changed to 'Connected'
2021-12-16 14:59:56.294 +08:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\TFUSER~1\AppData\Local\Temp.net\TFU002.Service\unka2gfn.abt
2021-12-16 14:59:56.297 +08:00 [DBG] Hosting started
2021-12-16 14:59:56.964 +08:00 [DBG] Connection state changed to 'Lost'
2021-12-16 14:59:56.967 +08:00 [DBG] Ads state changed to 'Invalid'
2021-12-16 14:59:56.967 +08:00 [DBG] Deleting symbols on beckhoff state change to Invalid

@fbarresi
Copy link
Owner

fbarresi commented Dec 16, 2021

Hi!
The log file is trying to tell you that your connection parameters are wrong.
You don't need to change anything in code, but in your local settings. Did you setup a route for getting connected with your plc?
I'm not confident with twincat 2, but I guess ads works in the same way.
Wich version of ads do you use?
Best regards,
FB

@Dunkelicht
Copy link
Author

I am using 2.11.2305, I am now at site, I need back to office to test TC2.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants