I do calculations manually at work for the data I get out of the
machine I work with. However, it gets pretty tedious and I feel it
would be a lot more efficient/productive if I somehow made a program to do the
calculations for me. I have visual basic 6.0 at work, and have maybe
used it once or twice, so I know a few basic things. But what I want
to do with it now is make a program that when I open the standalone
application, it will allow me (the user) to click a button that will
(1)display the sums of 0th file
(2)display the sums of the 15th file
(3)display the quotient of 0th file/15th file.
I have somehow summarized the steps I go through with each file, if
you have any further questions please don?t hesitate to contact me.
Part 1 is the basic
first part of the program I would like to somehow make, and it shows
the mathematical calculations I usually do by hand behind it.
Part 1
When the user clicks the "calculate parameters" button, behind the
scenes, the program will... go and find/open/analyze the following
folder/files...
We have a folder located in C:/ named ?pl? it holds many files. Each
of these files is data collected from the machine, and each file is
named 00001.master, 00002.master, 00003.master, etc? by the machine
for however many files of data is taken from the reading in 15
seconds. These files data types are ?transmission? (or so it is
labeled by the computer) and are labeled as mentioned above
?00001.master? etc, which are digital files representing a graph.
In each file, we have lots of numbers and the first 16 lines of text
in each file are just a summary the machine gives of what parameters
were on or off, (not necessary for this calculation), then begins the
2 columns of data we will be looking at. The first column is a bunch
of numbers that pretty much remain static, sometimes we have about 600
numbers in this column, sometimes we have about 900, but all we need
are a select few numbers between 380 and 780 (for this example let?s
just say we need 380, 400, 520, 630, and 780, although there are a
whole lot more and they don?t follow any sequence, but these numbers
do not change for each file and always appear in each file and we will
need them for each). You can kind of think of the first column as a
?placeholder? or a key/i.d. field.
In the folder, we pick out the 0th and the 15th files (they will not
always say 00000.master or 00015.master because sometimes the gets
more than 15 files ? since it collects data and creates files for 15
seconds). We will perform the following calculation on these two
files.
First we look at what we are given in the file. For example? this is
sort of how one transmission file would look like
00000.master (the 0th file)
Date 8-22-05
Machine 1
Serial number 123555
Graph 235235
Blah
Blah blah
And some more data for about 16 lines?
>>>>begin data<<<<
130 23
135 26.34
199 4
380 0
399 -2
400 -35
430.2 9
440 1.55
490.35 -3.3
500 234
519.4 425
520 6
550.4 -243
600 53
630 -9
648 10
780 22
For ease of reading this, let?s name the first column W, and the
second column %t.
We then go to another file called CF that has a bunch of numbers that
correspond to the numbers for W, i.e. if W = 380, then CF=0; W=400,
CF=.0005; etc?
We need to take the numbers we pulled out for file 0, the 380, 400,
etc, and multiply the respective %t with the CF, so %t*CF=x for 380,
then do this with 400, 520, 630, 780. once you have found all the
products for each one, you add the products up and this gives you the
sum for the file.
For example?
W %t CF products of %t*CF
380 0 0 0
400 -35 .0005 -.0175
520 6 7.04 42.24
630 -9 2.0889 -18.8001
780 22 0 0
Sum of all products for 0th file = 0+(-.0175)+42.24+(-18.8001)+0 = 23.4224
Repeat what we just did for this file 0 with the 15th file of this folder.
For the 15th file, we will probably have more or less data numbers in
the file, but we will always have the 380, 400, 520, 630, 780, which
we will take out and find the %t*CF. The %t is going to be different,
but the CF will be the same (0, .0005, 7.04, 2.0889, 0). So we will
again find the products of %t*CF, and find the sum of all products for
this 15th file.
Then we will find the quotient of the 0th file/15th file.
When we first hit the button the first time around in the beginning
when the program started , it should go through all these steps and
then display with labels?
(1) the sum of products for the 0th file is: 23.4224
(2) the sum of products for the 15th file is: 25 (or whatever it is, I
just randomly stuck in this number to use as an example, so assume
this is the number for this particular run)
(3) the quotient of the 0th file/15th file is: .93690 (rounded 5 decimal places)
if anyone could somehow come up with a VB 6.0 program to do this, this
would make my life a heck of a lot easier. At the moment I?m trying to
think of how to create this but i?m pretty stuck on just reading the
basic VB primer books, and my pages of calculations are piling up. i
would like to know the behind the scenes sourcecode to this too, so I
may be able to figure out how this was made and learn a thing or two,
and also so I can add all the numbers I actually go through for this
process, as well as change some numbers if needed. Thanks! Your help
is much appreciated! ~k. |
Request for Question Clarification by
theta-ga
on
22 Aug 2005 20:37 PDT
Hi kristalys-ga,
I have started work on the VB application you require. However, I
need the following clarifications before the application can be
completed:
- In the question you say that we need to process the 0th and the
15th file. However, you then go on to say that these files may not be
named 0000.master and 0015.master as expected. How then can the
application identify the required files, if not by name?
- Alternatively, would it be acceptable if the application asked
the user to manually select the 0th and the 15th file?
- Also, from your description of the CF file, I understand that
the folder that contains the .master files, will also contain a file
name 'CF'. Is that correct?
- Since you need to select certain values of W from the 0th file,
you will need a GUI to display and select the values of W from it. Is
this what you want? Do you want the application to limit the displayed
rows to those between 380 and 780, or do you want it to display all
rows?
The control flow for the application is now as follows:
- The application starts
- Prompts the users to select the 0th and the 15th file
- Displays the contents of the 0th file and asks the user to
select the rows he requires
- Performs the reqd calculations and displays the data.
Please tell me if the above flow is ok for you, or if you want any changes.
Also, it would be very helpful if you could provide a set of data
files that I can use to test the application. You can compress (rar or
zip) the folder containing a set of data files (the masters and the CF
file), and upload it to the RapidShare website
(http://www.rapidshare.de/). Then just post the download link they
provide here, and I will be able to download it.
One final item. The price of $80 for this question is significantly
less than the expected amount for questions that require the amount of
time and effort that this does. I would strongly urge you to look at
the Google Answers pricing guideline, and revice the price
appropriately.
- Google Answers Pricing Guidelines
(http://answers.google.com/answers/pricing.html)
Looking forward to working with you.
Regards,
Theta-ga
:)
|
Clarification of Question by
kristalys-ga
on
23 Aug 2005 07:49 PDT
hello theta - thanks for helping me out - i greatly appreciate it.
sorry about the confusion i'm really bad at trying to state this
problem in computer program terms...
here's some clarification... or some attempt at it - please don't
hesitate to let me know if you need any more clarification.
- In the question you say that we need to process the 0th and the
15th file. However, you then go on to say that these files may not be
named 0000.master and 0015.master as expected. How then can the
application identify the required files, if not by name?
>>> the machine collects data for 15 seconds, however sometimes the
machine will collect about 30 readings, sometimes 60, it's uncertain,
and once in a while it might skip a reading (making the data non
sequential), so i guess may be it might have to do a count to collect
the 0th and 15th file?
- Alternatively, would it be acceptable if the application asked
the user to manually select the 0th and the 15th file?
>>> hmm... i rather it not, this might pose a problem, since it may be
prone to human error - this is one of the reasons i'm trying to get a
program to do this, when done manually/by hand, after looking at the
screen/data a lot, you lose count :) (not good) especially after
working with a bunch of files all day.
- Also, from your description of the CF file, I understand that
the folder that contains the .master files, will also contain a file
name 'CF'. Is that correct?
>>>currently, since i'm doing it by hand, it's just a piece of paper
with the significant/required W's and the CF's that correspond with
it.
- Since you need to select certain values of W from the 0th file,
you will need a GUI to display and select the values of W from it. Is
this what you want? Do you want the application to limit the displayed
rows to those between 380 and 780, or do you want it to display all
rows?
>>> for the 0th and 15th file, yes, the program should select out the
specific numbers between 380 and 780 that are defined (i have a list
that i will scan in and include for you) the other numbers aren't
necessary to be displayed. i'm just interested in a program that will
run, and when you click "calculate" it'll display 3 calculated answers
that it has gotten for all the files in the folder.
Control flow...
- The application starts
>>program selects out the 0th and 15th files in the folder
>>a list of rows required will be established (the list), from
this the calculations will be done
- Performs the reqd calculations and displays the data.
Please tell me if the above flow is ok for you, or if you want any changes
|