Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Background Data Tables In C#

Background Data Tables In C#

Scheduled Pinned Locked Moved C#
questioncsharptutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13293914
    wrote on last edited by
    #1

    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

    L M realJSOPR 3 Replies Last reply
    0
    • U User 13293914

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • U User 13293914

        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

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • U User 13293914

          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

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #4

          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

          M 1 Reply Last reply
          0
          • realJSOPR realJSOP

            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

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            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

            realJSOPR 1 Reply Last reply
            0
            • M Mycroft Holmes

              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

              realJSOPR Offline
              realJSOPR Offline
              realJSOP
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups