I am running a state machine in a loop and want to log the errors that occur and diplay them on the fron panel. Since there are many caases and many possible errors i want to make sure all are displayed something like the following,
Gain coefficient error
Setpoint error
Response error
etc, but my problem is that the Errors array only displays one error and overrides it if another error occurs. I thought indexing would allow me to "stack" the errors so i see all the erros that occured during my test. The ""TRUE" case in the lower right case structure doesnt do anything with the CR. Any suggestions?...Would writing the errors to a file be easier?
已解决! 转到解答。
You'll want to use a shift register on your outer while loop and concatenate your error strings together. Your for loop has a constant of 1 wired to the iteration terminal, so it runs just once. It won't keep adding to your array. What you have is functionally equivalent to build array with one terminal.
Absolutely silly way to create an array of errors. If you want to do this, add a shift register that is initialized with an empty string array. When an error occurs, add to the array with the build array function wired to the shift register. This would have to be done inside each state.
@Dennis_Knutson wrote:
Absolutely silly way to create an array of errors. If you want to do this, add a shift register that is initialized with an empty string array. When an error occurs, add to the array with the build array function wired to the shift register. This would have to be done inside each state.
Is this what you meant?..Its still showing only one error.
No, no, no. You have to pass in the array from the shift register. One input of the Build Array is wired to that and the other input is wired to the error.
Have you taken the LabVIEW tutorial or looked at any of the examples? An example that shows a case statement with a shift register and the build array is called 'Separate Array Values'. It's Listed under Fundamentals>Arrays and Clusters.