05-14-2024 03:14 AM
@yamada do think i could work with semaphores to avoid race conditions?
i am not (yet) familiar with "state machine" architecture in this case but i read a bit about semaphores.
maybe you are so kind to give me some examples.
the other stuff i could manage and it seems to work properly. i still stuck in the race conditions. any help appericated
05-14-2024 04:04 AM
@Herrmann-s wrote:
@yamada do think i could work with semaphores to avoid race conditions?
i am not (yet) familiar with "state machine" architecture in this case but i read a bit about semaphores.
maybe you are so kind to give me some examples.
the other stuff i could manage and it seems to work properly. i still stuck in the race conditions. any help appericated
To guarantee that Loesen is updated before being read (which i assume is what you're trying to do), just use the wire. The wire is the variable, not the indicator. The indicator is just to inform the user of something (or send out data if a sub-vi).
So instead of those two Local variables, just wire the inital time-wire through to those cases. The indicator can stay, but it's not used for data that way and Flow Control forces the first Read time before the time calculations.
Semaphore will just make things harder for you. 🙂
Simple demonstration of Race Condition:
05-14-2024 04:27 AM
you mean i should just use the wires instead of using the local variables (see attached picture)????? if so ....i am the worlds dumbest galah!
05-14-2024 05:32 AM
Hi Herrmann,
From what I could understand, you should do something like this :
As "Loesen_1" seem to be a time reference, you have to store it in a feedback node (or a shift register).
05-14-2024 06:01 AM
@Herrmann-s wrote:
you mean i should just use the wires instead of using the local variables (see attached picture)????? if so ....i am the worlds dumbest galah!
Yes, just wire to target. 🙂 You have to handle the False case in the 1st Case, probably a Feedback node would suffice. That's just one Race condition, but it will reduce points of error.
05-14-2024 06:05 AM
@PinguX wrote:
Oh, i didn't think about that, but the first part is just an Elapsed time-block with Set Reference wired to Reset.
05-14-2024 06:17 AM
i'll give it a try thank you so much guys!
any further ideas etc are very welcome. i am trying my best to understand LV and i need to "sync" my brain a little bit.
thats why i am highly interested in your opinions and different approach. that helps me a lot!
05-14-2024 07:15 AM
hi pungux, one last question for today (even if i blame myself) 😉
i am a bit confused atm about "set reference?"
it is pretty hot in my office and maybe my brain is not working correctly anymore. what reference should i put there?
05-14-2024 07:29 AM - edited 05-14-2024 07:43 AM
The "Set Reference?" boolean is the one at the top-left of your previous screenshot :
That structure in the corner can be replaced by Select and Feedback nodes.
Another quick advice : avoid "Insert into array" in a loop with Shift Register, the auto-indexing option is by far better (for memory and time execution).
EDIT : Case structure accept multiple type (boolean, numeric, string) for case selector.
So instead of placing condition before the structure, you can make it the other way :
(cf. "201020_Def2Ring.vi")
05-15-2024 01:33 AM
and again thank you very much! thats really wonderful support! i am implementing it and give it a try!