05-08-2024 02:06 AM
hello, i am a beginner and i have the offer to optimize a little code snip. not sure if thats possible with distance but i'll give it a try.on thepicture you can see that there is a constant 10 and in this area i think all the magic is done (not sure).
my problem is that this vi prgram produces some hickups and i think it is related to the mentioned area.
maybe someone could "see" the problem.
my idea was to replace seomhow the hole part related to this constant with a some sort of timer so that everything which uses this code snip are useing this exacty timing. sorry for my terrible english and also for my silly question. maybe it is not possible to answer this question without any further information. i am a bit desperate and frustrated atm sorry
05-08-2024 02:20 AM
Hi Herrmann,
@Herrmann-s wrote:
i am a beginner
As can be seen in the image you have attached!
@Herrmann-s wrote:
on thepicture you can see that there is a constant 10 and in this area i think all the magic is done (not sure).
my problem is that this vi prgram produces some hickups and i think it is related to the mentioned area.
maybe someone could "see" the problem.
There are a lot of problems visible in your image:
And no, this image does not help to solve your problem with your code!
05-08-2024 03:40 AM
thanks Gerd. your hints are good first start for me to work through the code. they are disastrous but very welcome. i am willing to learn an giving my best!
05-08-2024 04:17 AM
What type of hicups? Plase attach the .vi in an older LV version (file -> save for previous, 2017 or 2019 should work fine)
05-08-2024 04:44 AM - edited 05-08-2024 04:45 AM
you dont want to see this 😄
(it is not a work of mine. i am the one who should clean it).
i am not sure how i should describe hiccups. it is some sort of a time sync problem of some loops. some are running faster than others and as i wrote in my first post - my guess is - that the magic is in the constants (10) being used which should act as a quick and dirty workaround. my idea is to replace these constants to use some sort of a timer to avoid the "overtaking" of some of the loops. if one is slower the faster one should wait etc. but i could be wrong 🙂
any suggestion welcome and i am learing by doing becuase i am totally lost because nobody in my vicinity could help.
i zipped it there are some subvis
05-08-2024 05:07 AM - edited 05-08-2024 05:08 AM
Hi Herrmann,
@Herrmann-s wrote:
you dont want to see this
You are right!
See this:
Both codes do the same, but yours is pure Rube-Goldberg!
Please cleanup your VIs, create more (reasonable) subVIs and attach again…
05-08-2024 07:20 AM
If you want several loops at the same speed they should be the same loop so all go by the slowest.
There's lots of improvements you can do (and that i recommend) to make it easier to read and manage. One simple thing is this:
Many things can and should be placed in loops instead of done multiple times.
05-08-2024 07:28 AM
Some of your error could be du Race Conditions, your code can't guarantee in which order things execute. If you start with some clean up your problems might disappear or atleast it should be consistant enough to actually fix. I suggest a State machine design.
05-13-2024 12:03 AM
Sry for my late reply we had a public holiday.
many thanks guys for your wonderful help.
that improves my learning curve extremly. sometimesi could find a starting point and thats very frustrating.
i am working on to understand your code snips and thats really a fantastic starting point to me.
05-13-2024 04:57 AM
I stuck a little with these race conditions. I read a bit about it but i am not sure if i understand it correctly. I am fiddeling a little bit around atm with my wrong "construction" how to port it into correct code.