Hello all
I've been browsing Google and forums for a while but haven't found a solution to my problem so far.
To give a bit of context, I have a series of machines and I need a program to make decisions depending on the states of all those machines. To do so, I listed all my machines in a array ListMachines and I implemented a function that crawls the list while extracting the individual state of all the machines.
In practice, I'm trying to use an array of function blocks as a function input but it seems that my function is not seeing the input. Without any success, I've also tried using pointers. Since there is no compilation errors, I don't really know what to do.
The problem seems that the function is never using my argument Machines.ListMachines as an input and never get running. I can for instance see that some local variables are never initiated.
What would be the best solution to send an array of function blocks as a function input ? Do I need to use global variables as a workaround?
If this happens to be possible and the right way, I will try to be more specific to see what went wrong in my situation.
I've been browsing Google and forums for a while but haven't found a solution to my problem so far.
To give a bit of context, I have a series of machines and I need a program to make decisions depending on the states of all those machines. To do so, I listed all my machines in a array ListMachines and I implemented a function that crawls the list while extracting the individual state of all the machines.
In practice, I'm trying to use an array of function blocks as a function input but it seems that my function is not seeing the input. Without any success, I've also tried using pointers. Since there is no compilation errors, I don't really know what to do.
- In Machines [PRG]:
- My array is defined in the program as follows:
VAR_OUTPUT
ListMachines : ARRAY[1..3] OF Machine;
END_VAR
Where a Machine is a custom function block I created. - I then populate ListMachines with 3 machines (with default values) in the program code. This works well as I can see in my IDE while being Online.
- A function is supposed to use Machines.ListMachines as an input and process it to say if all machines from ListMachines are in the same state.
The problem seems that the function is never using my argument Machines.ListMachines as an input and never get running. I can for instance see that some local variables are never initiated.
What would be the best solution to send an array of function blocks as a function input ? Do I need to use global variables as a workaround?
If this happens to be possible and the right way, I will try to be more specific to see what went wrong in my situation.
Last edited: