02-07-2023 09:44 AM
@GRCK5000 wrote:Below is an example.
Please don't distract by branching into irrelevant side discussion that have absolutely nothing to do with the current problem.
(Showing code images is not helpful, because we don't see what's in the other case. Indicator terminals don't belong inside innermost structures. Counting should be done in blue, not orange. Top-level loops need a reasonable wait. etc.)
02-07-2023 10:25 AM - edited 02-07-2023 10:26 AM
So the current problem is: "while loop runs too many times after update to windows 10". Let's focus on this and see how we can solve our friend's issue.
02-07-2023 10:39 AM
@GRCK5000 wrote:
So the current problem is: "while loop runs too many times after update to windows 10". Let's focus on this and see how we can solve our friend's issue.
I still think the real problem is that the program did not run correctly until the OS was updated to windows 10. 😄
(There are many questionable parts in the code and I am sure it would all fall into place once cleaned up 😮 )
02-07-2023 11:26 AM - edited 02-07-2023 11:27 AM
Haha Funny. I can try to do research on this problem.
02-07-2023 12:17 PM
@GRCK5000 wrote:
Mr. Altenbach explained how to use it.
Below is an example. The true side of the case structure will only execute once even though it's in the while loop. The thing attached to the case structure is what you call "first call?"
Thanks that makes sense but it seems to be the WHILE loop that is the problem. Even if I put a case structure inside the while loop it would probably still run three times.
02-07-2023 01:23 PM
The while loop will run forever until you end the program.
02-07-2023 04:08 PM
@altenbach wrote:
Clearly, the code as written runs forever and adds one entry to the file with every iteration of the outer loop, so if it only added on entry previously, it did not behave as programmed originally. Maybe it got permanently stuck somewhere. If everything runs without error and hiccups, you should get one log entry every ~18+ seconds forever!
If it did not do that before, maybe the old setup was faulty.
Do you still have the old hardware so you can do some tests?
Do all visa sessions really have the same parameters? It is extremely confusing to constantly create new sessions and break them down. Are all communications really with the same device, just changing the starting address and quantity? This just screams for a simple state machine with code that fits on a postcard.
Can you explain in detail how all hardware is connected? Did you change any other hardware such as serial interfaces? Can you explain what should happen in sequence during the run? Does the hardware react as expected? Is the extra logging the only thing you don't like?
The PC comunicates with a PLC and the main sensor via a USB to serial converter with modbus. This control VI sends commands to the plc to control the motor and collects the data. I am now guessing that the 40 readings of the mains sensor at 1 second intervals or similar variations stops the VI from cycling three times and thinking about it I shouldnt need to get single readings at short time scales. In any event I could probably edit an older program that I have found does seem to work until I find the fault. Too cold to go out there programming at the moment. Thanks for all your suggestions.