@Marcschäfer59964 wrote:
Hello dear Labview colleagues,
A friend came to me who has some problems with his Labview code.
Hello Marc,
show all those feedback from the community and demand some days (weeks) from your boss to refactor this code together with your friend. Read carefully GerdWs suggestions to improve your skills. You will see, it will be fun.
Now some suggestions from me:
- Combine all controls of "Messplatz" into one typedefed cluster
- Combine all indicators of "Messplatz" into one typedefed cluster (except the chart, since the display rate will be higher)
- use these to read user input / display machine states
- switch between the displayed Messplätze with a fake- tab control (showing only the tabs) or a radio button control
- use a shift register to hold an array of 6 (or maybe 1000 later) clusters of your UI input and output
- get user input via "value changed" event in an event structure (just one for the entire cluster, makes it simple) and update your array of clusters according to the selected Messplatz- number (GerdW mentioned this principle already)
- in the Timeout event of the event structure communicate with the machines in a for-loop, handling each machine with the data in your clusters
- use sub-VIs (not under VIs)
- think it over to execute several VIs with every iteration (e.g. SPS-Datenübermittlung-Batteriedaten...vi)
- at the tab-pane "overview" create use a 2D-Array (3 by 2) of cluster-indicators to display your data
All this could lead to a Block Diagram with the size of a stamp (as Altenbach would say)
Greets, Dave