Results 1 to 3 of 3

Thread: Real Time Data collection from Socket and Storing in Excel

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    2

    Real Time Data collection from Socket and Storing in Excel

    Dear All,
    I m new to this forum. Thanks for welcoming in advance
    I m new to VB 2008Express programming. I m into automation development of FMCG products using Micro-controllers. So,VB is pretty new to me. Well , all said..
    I get real time data Barcode 2D from TCP/IP connection. My task is to compare the result do some Computation with them and Store the incoming Barcode and results into a Excel sheet in a folder. I m successful with the basic working.
    Am currently working at slow speed of 1 barcode(22 char info) per second from the TCP/IP data (barcode scanner). Now, comes the real issue. I need to process atleast 5 barcodes per sec ( <200ms per process). I m partially successful with 3 Barcode per second(300 ms per process).
    so, thats like 300ms per processing. I need to achieve less than 200ms for entire processing. I have used threads and timers. but I m unable to achieve.
    Seems like storing in Excel takes more than 250ms.
    Since i come from micro controllers background 1msec is a lotta time to process for me. I m not sure how much time does it take and trust me i find it difficult to guage the time here.
    Please Help me with this. I m stranded with this issue and find no where to go.
    Please advice me on the approach that i should be taking. I m attaching the code.
    Thanks for viewing this.
    Kindly Help me.
    Attached Files Attached Files

  2. #2
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    Re: Real Time Data collection from Socket and Storing in Excel

    our problem stems from doing far too much in the subroutines

    you are taking a long time setting up an dbuild ing structures that do not need continual rebuilding

    I am only half way through and the amount of "STUFF" is enourmous

    can you look at cutting down the code for us to look at and clear out all of the dimensioning rubbish tha is cluttering up your world

    you can model something just like the microprocessors you have been using

    just push all of the more static stuff out of the way and get on with the processing

    you can upset "them all" here by pusshing the initial dimensioning up to the global level and refer to them from there

    here to help

  3. #3
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Real Time Data collection from Socket and Storing in Excel

    Wherever Disk I/O is involved you're gong to be looking at Milliseconds.

    You may like to consider the concept of a Queue. Run the time critical code (ie the TCP Reader) in it's own thread. All it does is to add whatever it reads into the queue. ie no validation or anything just a 'sausage machine'.

    The main processing can then, in its own good time, pull data off the queue and add it to the Excel Spreadsheet whilst the TCP side of things is running happily away. That may 'buy you some time'.

    Determining a suitable maximum Queue length (if required) may be an issue, especially if the code is to run on a different machine from the one it's being developed on. Another thing to consider is (I believe) that the compiled .exe will run faster than running the code from the IDE.

    I'm not skilled enough with VB2010 to be able to suggest the code required but I believe creating threads is a simple operation and using Deligates to communicate between threads is also fairly simple. Looking at your code it seems that you already know how to do those things.

    Being one of 'them all' here, I should point out, but you probably have enough knowledge to understand, that Dimensioning variables etc. are Compile-time Directives and are not executed, so will not affect the execution run-time of the code. (In fact not Dimensioning may lead to extended run-times)

    BTW Although the code is Network related, the 'problem' is (IMHO) more general so I'd post any further questions in the 'Visual Basic .NET' section of the Forum (that's where the .Net Gurus lurk ) unless the problem is specifically related to a Network Issue.
    Last edited by Doogle; Jan 8th, 2012 at 10:24 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width