Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » 4DIAC Debugging running application(Asking if it is possible to attach 4diac to a running forte instance for debugging.)
4DIAC Debugging running application [message #1849654] Thu, 27 January 2022 22:53 Go to next message
Mitchell Flaherty is currently offline Mitchell FlahertyFriend
Messages: 8
Registered: December 2021
Junior Member
Hello,

I had a question about debugging using 4diac. I know that for testing it is possible to deploy the application to an instance of the runtime and see the flow of events and inspect variables.

My question is whether it is possible to attach 4diac to an already running process and see the function block diagram, data flow and so on, and whether this can be done without interrupting the process. So the program can still run and control equipment while being debugged.

Re: 4DIAC Debugging running application [message #1849656 is a reply to message #1849654] Fri, 28 January 2022 07:49 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Hi,

yes this is possible. If you have the application currently running in your 4diac IDE you can just simple activate monitoring and watch the values. We have a first version of an upload from the devices, but this is a bit bumpy therefore would not yet recommend it.
Re: 4DIAC Debugging running application [message #1849670 is a reply to message #1849656] Fri, 28 January 2022 17:56 Go to previous messageGo to next message
Mitchell Flaherty is currently offline Mitchell FlahertyFriend
Messages: 8
Registered: December 2021
Junior Member
Thank you!

How about if the application was started separately from the IDE?

The scenario I'm envisioning is the runtime starting from a boot-file, controlling equipment and then later attaching the IDE to the running process to debug issues that may arise.
Re: 4DIAC Debugging running application [message #1849672 is a reply to message #1849656] Fri, 28 January 2022 19:37 Go to previous messageGo to next message
Mitchell Flaherty is currently offline Mitchell FlahertyFriend
Messages: 8
Registered: December 2021
Junior Member
One more question: When running my program, I can upload my program to the runtime, and it will work, but if I upload the program a second time, or try to upload a modified version of the program, it will crash the runtime. I can restart the runtime, and get the program running, I was just wondering if there was any way to avoid this. I am spawning a thread in one of my function blocks to listen for connections as a Modbus slave, so could that be the issue?
Re: 4DIAC Debugging running application [message #1849673 is a reply to message #1849672] Fri, 28 January 2022 19:56 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Quote:

How about if the application was started separately from the IDE?
The scenario I'm envisioning is the runtime starting from a boot-file, controlling equipment and then later attaching the IDE to the running process to debug issues that may arise.


Yes this will work with out problems. 4diac IDE will try to connect to you device and when you activate monitoring for one of your application fbs it tries to read the values of that FB. If it doesn't find your FB or a pin the watch will be marked with N/A (not available). But it will not affect the runnning application.

Quote:

One more question: When running my program, I can upload my program to the runtime, and it will work, but if I upload the program a second time, or try to upload a modified version of the program, it will crash the runtime. I can restart the runtime, and get the program running, I was just wondering if there was any way to avoid this. I am spawning a thread in one of my function blocks to listen for connections as a Modbus slave, so could that be the issue?

When you re-deploy on a running 4diac FORTE 4diac IDE will first check the available resources and if there is a resource with the same name as you ant to download 4diac IDE will ask you if it should delete the resource before deploying the new one. If you get an exception during deletion then one of your FBs is not behaving nice. The FBs delivered with 4diac FORTE should behave nice. If that is not the case we would definitely like to know. Which 4diac FORTE version are you using? I know that there have been some fixes to the Modbus module. But I never used the modbus module nor do I know the code of it so I'm not sure.
Re: 4DIAC Debugging running application [message #1849675 is a reply to message #1849673] Fri, 28 January 2022 23:28 Go to previous messageGo to next message
Mitchell Flaherty is currently offline Mitchell FlahertyFriend
Messages: 8
Registered: December 2021
Junior Member
Yes that must be it. We needed the runtime to serve as a PLC slave, so I created a function block that, on being initialized, spawns a thread that listens for modbus connections and responds to them. That thread keeps the associated arrays updated, allowing the rest of the application to read them.

I believe it is version 2.0. 0 4diac was updated to 2.0.1, but I don't believe I've updated the forte runtime yet.
Re: 4DIAC Debugging running application [message #1849677 is a reply to message #1849673] Fri, 28 January 2022 23:38 Go to previous messageGo to next message
Mitchell Flaherty is currently offline Mitchell FlahertyFriend
Messages: 8
Registered: December 2021
Junior Member
I had one more question and wasn't sure if it belonged in a separate topic: Are there consultants available who can be paid to help out with 4diac forte projects? Any contacts would be appreciated.
Re: 4DIAC Debugging running application [message #1849711 is a reply to message #1849677] Sun, 30 January 2022 20:19 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Depending on the topic there are people that can help. For example my team and I are happy to support you. You can find us here: https://www.jku.at/en/lit-cyber-physical-systems-lab/
Re: 4DIAC Debugging running application [message #1849725 is a reply to message #1849677] Mon, 31 January 2022 10:01 Go to previous messageGo to next message
Jörg Walter is currently offline Jörg WalterFriend
Messages: 1
Registered: January 2022
Junior Member
Our team would be happy to assist as well (likewise depending on the exact details):

www.offis.de/en/applications/manufacturing/distributed-computing-and-communication.html
Re: 4DIAC Debugging running application [message #1849768 is a reply to message #1849654] Tue, 01 February 2022 23:12 Go to previous messageGo to next message
Mitchell Flaherty is currently offline Mitchell FlahertyFriend
Messages: 8
Registered: December 2021
Junior Member
Quote:
Our team would be happy to assist as well (likewise depending on the exact details):


Quote:
Depending on the topic there are people that can help. For example my team and I are happy to support you. You can find us here: https://www.jku.at/en/lit-cyber-physical-systems-lab/


Thank you!

Quote:
When you re-deploy on a running 4diac FORTE 4diac IDE will first check the available resources and if there is a resource with the same name as you ant to download 4diac IDE will ask you if it should delete the resource before deploying the new one. If you get an exception during deletion then one of your FBs is not behaving nice. The FBs delivered with 4diac FORTE should behave nice. If that is not the case we would definitely like to know. Which 4diac FORTE version are you using? I know that there have been some fixes to the Modbus module. But I never used the modbus module nor do I know the code of it so I'm not sure.


We needed the runtime to serve as a modbus slave rather than a master. I created a service function block that, when the init event is received, allocates memory for the contacts, coils, registers and inputs, then spawns a thread which listens for connections and handles them. This works fine for the program while it is running, but whenever I try to replace the running program, the runtime will crash. I can re-start it and the program will run normally. This didn't happen when I was writing small programs to learn how things worked, so I strongly suspect the modbus block is the issue.

Is there a preferred way of handling threads spawned by function blocks?

I'm wondering if there is some equivalent of atexit I can use to register functions to be called when the program is stopped by the IDE. I could, in that case, create a simple function that tells the thread to exit before the program is re-uploaded.

[Updated on: Tue, 01 February 2022 23:14]

Report message to a moderator

Re: 4DIAC Debugging running application [message #1849771 is a reply to message #1849768] Wed, 02 February 2022 07:43 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

The typicall way to do that in IEC 61499 would be to send an INIT- event. However I'm currently not sure if you get a INIT events delivered when the resource is wiped from the device during redeployment. However we have two more options. first of all bevore FBs are deleted they get a kill command and their execution state is changed from running to stopped.

But even better and the right way to do this in C++ is to clean up in the destructor of your FB. Their you should do similar checks as if you would have received an INIT- event. You can have a look at the communication FBs how they are doing it.

Finally while I'm writing this I'm also thinking if you really need to stop the thread or just update the modbus data. But I leave that up to you.
Previous Topic:Dynamic type loader fails to deploy new FB Type
Next Topic:Constants or enumerated types for Data Input parameters.
Goto Forum:
  


Current Time: Sat Apr 27 18:00:58 GMT 2024

Powered by FUDForum. Page generated in 0.04486 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top