|
Re: 4DIAC Debugging running application [message #1849656 is a reply to message #1849654] |
Fri, 28 January 2022 07:49 |
|
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 #1849673 is a reply to message #1849672] |
Fri, 28 January 2022 19:56 |
|
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 #1849768 is a reply to message #1849654] |
Tue, 01 February 2022 23:12 |
Mitchell Flaherty 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 |
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.04020 seconds