‎03-26-2014 07:09 AM - edited ‎03-26-2014 07:12 AM
I also found one thing very interesting, I dont know wheter its a bug or feature
My app doest hang, what happens is my while loop stops and iteration value doesnt increments, if I keep weight then also it will not show in my PC. when I scan my serial number then my kept weight appears along with my serial number appears together and my iteration indicator will start increment.
On my first try it indiator increment stops at 95 and in my second try it stops at 712.
‎03-26-2014 07:12 AM
Is it becasue I am reading both the COM in same while loop thats why its happening and when hangs then it resumes only when I scan serial number (this serial number will not appear from com port instead using scanner as serial interface )
‎03-26-2014 08:27 AM
I would use two loops, one for each serial device so they can each read as fast as they need two. Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues. I'd use a notifier, or just use local variables. One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop. There you have the logic that determines when you nave "new" updated values that is time to log to the file.
‎03-26-2014 11:20 AM
@RavensFan wrote:
I would use two loops, one for each serial device so they can each read as fast as they need two. Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues. I'd use a notifier, or just use local variables. One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop. There you have the logic that determines when you nave "new" updated values that is time to log to the file.
Ahh, I was under the impression that he needed every single datapoint. If I thought about it, you would end up with huge amounts of data in no time.
‎03-26-2014 11:25 AM - edited ‎03-26-2014 11:27 AM
@RavensFan wrote:
I would use two loops, one for each serial device so they can each read as fast as they need two. Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues. I'd use a notifier, or just use local variables. One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop. There you have the logic that determines when you nave "new" updated values that is time to log to the file.
I need a teaching moment from you.
If you used notifiers or local variables, how could you guarantee data sync? Both are lossy and I'm not sure how you could guarantee how you could lose the same amount of data from each if they only look at the latest data?
I hope you understand what I'm trying to get at - it's not easy for me to explain.
Thanks!
‎03-26-2014 11:29 AM
@billko wrote:
@RavensFan wrote:
I would use two loops, one for each serial device so they can each read as fast as they need two. Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues. I'd use a notifier, or just use local variables. One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop. There you have the logic that determines when you nave "new" updated values that is time to log to the file.
I need a teaching moment from you.
If you used notifiers or local variables, how could you guarantee data sync? Both are lossy and I'm not sure how you could guarantee how you could lose the same amount of data from each if they only look at the latest data?
I hope you understand what I'm trying to get at - it's not easy for me to explain.
Thanks!
The idea is that when you recieve data from both you will have the latest data for each.
‎03-26-2014 11:33 AM
@crossrulz wrote:
@billko wrote:
@RavensFan wrote:
I would use two loops, one for each serial device so they can each read as fast as they need two. Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues. I'd use a notifier, or just use local variables. One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop. There you have the logic that determines when you nave "new" updated values that is time to log to the file.
I need a teaching moment from you.
If you used notifiers or local variables, how could you guarantee data sync? Both are lossy and I'm not sure how you could guarantee how you could lose the same amount of data from each if they only look at the latest data?
I hope you understand what I'm trying to get at - it's not easy for me to explain.
Thanks!
The idea is that when you recieve data from both you will have the latest data for each.
Hey, thanks for replying. I can now refine my question. What happens if the loops are running at different speeds, like let's say one is running twice as fast?
Thanks for taking the time out to help me understand. 🙂
‎03-26-2014 02:04 PM
Bill,
If the loops' speeds differ by that much (>= 2:1), then the question really becomes "What is the relationship of the data from the two sources?" I have the impression that the OP in this thread does not have that problem.
If the speeds differ significantly, I would do something a little more complicated, such as using a waveform datatype where the t0 value specifies the age of the data or include a timestamp in a cluster with the serial port data.
There can be no universal solution for truly asynchronous data sources because there are infinitely many possible combinations. You need to have some knowledge of the behavior of the sources and the requirements for the system.
Lynn
‎03-26-2014 02:16 PM
@johnsold wrote:
Bill,
If the loops' speeds differ by that much (>= 2:1), then the question really becomes "What is the relationship of the data from the two sources?" I have the impression that the OP in this thread does not have that problem.
If the speeds differ significantly, I would do something a little more complicated, such as using a waveform datatype where the t0 value specifies the age of the data or include a timestamp in a cluster with the serial port data.
There can be no universal solution for truly asynchronous data sources because there are infinitely many possible combinations. You need to have some knowledge of the behavior of the sources and the requirements for the system.
Lynn
Thanks - that expained everything. 🙂
‎03-26-2014 11:05 PM - edited ‎03-26-2014 11:22 PM
Thanks for the discussion friends but its too late but never too late.
This while loop iteration increment is not halting in development PC but happening in other PC where I am installing my application