Background Data Tables In C#
-
Hi, I am reading pulses of nearly 40 sensors in my program. I want to calculate 40parameters based on real-time pulses and also nearly 1000 real-time parameters with calculation formula contained some constant and values calculated based on sensors pulses as the formula variables. 1- The first question is: Is it a good way to use from background running data tables in some datasets to perform all of these tasks at least every one second? what is the best way to perform the described affair? 2- I also want to make a link between data tables columns that when data in other tables inserted, they collect in a table based on one of the columns. For Example, I have the same column in all tables like an auto number, I want to collect data in a collector table automatically with joining (make relation among) tables. Thank you in advance for your answers
-
Hi, I am reading pulses of nearly 40 sensors in my program. I want to calculate 40parameters based on real-time pulses and also nearly 1000 real-time parameters with calculation formula contained some constant and values calculated based on sensors pulses as the formula variables. 1- The first question is: Is it a good way to use from background running data tables in some datasets to perform all of these tasks at least every one second? what is the best way to perform the described affair? 2- I also want to make a link between data tables columns that when data in other tables inserted, they collect in a table based on one of the columns. For Example, I have the same column in all tables like an auto number, I want to collect data in a collector table automatically with joining (make relation among) tables. Thank you in advance for your answers
Use a "one second timer". The timer event calls a method that samples each sensor and does any "aggregating". If it matters, you need to disable / enable the timer on each tick and compensate if necessary (in case of possible reentrancy).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
Hi, I am reading pulses of nearly 40 sensors in my program. I want to calculate 40parameters based on real-time pulses and also nearly 1000 real-time parameters with calculation formula contained some constant and values calculated based on sensors pulses as the formula variables. 1- The first question is: Is it a good way to use from background running data tables in some datasets to perform all of these tasks at least every one second? what is the best way to perform the described affair? 2- I also want to make a link between data tables columns that when data in other tables inserted, they collect in a table based on one of the columns. For Example, I have the same column in all tables like an auto number, I want to collect data in a collector table automatically with joining (make relation among) tables. Thank you in advance for your answers
I would definitely disable the timer upon entry to the method! Assuming you are not storing the sensor details every second. Once you have done the processing store the results in the database, associated tables with foreign key relationships are a basic operation. Store the primary record Get the ID from the just inserted record insert the related records with the primary key. wrap the entire operation in a transaction and/or use a stored procedure
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
-
Hi, I am reading pulses of nearly 40 sensors in my program. I want to calculate 40parameters based on real-time pulses and also nearly 1000 real-time parameters with calculation formula contained some constant and values calculated based on sensors pulses as the formula variables. 1- The first question is: Is it a good way to use from background running data tables in some datasets to perform all of these tasks at least every one second? what is the best way to perform the described affair? 2- I also want to make a link between data tables columns that when data in other tables inserted, they collect in a table based on one of the columns. For Example, I have the same column in all tables like an auto number, I want to collect data in a collector table automatically with joining (make relation among) tables. Thank you in advance for your answers
I wouldn't use a
System.Timer
because the timer events are the lowest priority events in Windows, so a busy system will ignore/skip events in favor of more important work. I think a thread for each sensor to accept/store new data in the database would be a better solution. As far as visualizing the data, I would either make the user request new data (with a button click), or set up another thread that reads the new data at a regular interval. The length of the interval would be entirely dependent on the level of performance of your hardware and network (if your database is on a separate machine).".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013 -
I wouldn't use a
System.Timer
because the timer events are the lowest priority events in Windows, so a busy system will ignore/skip events in favor of more important work. I think a thread for each sensor to accept/store new data in the database would be a better solution. As far as visualizing the data, I would either make the user request new data (with a button click), or set up another thread that reads the new data at a regular interval. The length of the interval would be entirely dependent on the level of performance of your hardware and network (if your database is on a separate machine).".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013I would have thought that 40+ threads on a single machine would have been an issue.
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
-
I would have thought that 40+ threads on a single machine would have been an issue.
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
really depends on the machine i think. On a reasonably powerful machine with a quad core cpu (or better) and at least 16gb of ram, it should be okay. You can always set the CPU affinity for each thread if you need to.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013