View Full Version : Math problem I'm too stupid to solve
Winter
1st October 2009, 17:42
Mind block or something, help me out here.
range one = 0 to 65,536
range two = -150 to +150
value in range one (35325) = what value in range two?
Steps needed to work this out? they told me I needed pay attention in maths if I wanted to work in computers... I didn't believe them :S
jrandom
1st October 2009, 17:45
That question doesn't make any sense.
Winter
1st October 2009, 17:47
That question doesn't make any sense.
Oh?
I have a value in one range, i need it converted to its equivalent in the other range..
jrandom
1st October 2009, 17:51
First range would make more sense if it was 0 to 65535 (FFFF hex), ie, 65536 distinct values. I'd assume that that's just an error in the form of the question.
Assuming you have no other information than that brain-dead question form, presumably written by someone who was too stupid to get a real job and has therefore ended up teaching, I'd expect that you're supposed to be using an unsigned 16-bit number to represent a range of -150 to 150 decimal.
Which means that you divide 301 decimal (the number of values in your represented range) by 65536 decimal (the number of values in your 16-bit integer) and then multiply the result by 35325 and add the result to your minimum value.
In other words, 12.24.
But, really, I wouldn't have a clue what I'm on about here. Pay no attention to anything I write.
(Edited 302 to 301. See, I told you I had no clue. And edited the result to be added to -150, etc. This whole thread is stupid.)
slofox
1st October 2009, 17:56
12.
35325 is 53.9%of the way up the range.
12 is 53.9% of the way through the second range.
I hope
Edit: I rounded to two decimal places, so JR above may be more accurate...
jrandom
1st October 2009, 17:59
12.
I'd be inclined to keep some more precision in the answer. If the question's assuming that 16 bits are being used to represent the range, one can safely assume that one might as well use the precision available.
For extra points, if I were the lecturer, I'd expect my students to point out how many significant decimal digits 16 binary digits worth of precision over that range gives.
But lecturers are, on the whole, lazy and stupid.
:sunny:
Edit: I see we're duplicating each other's thought processes in between posts...
Firefight
1st October 2009, 18:02
Oh?
I have a value in one range, i need it converted to its equivalent in the other range..
forget that, just write an essay on what you did in the weekend
it will be more intersting, and you might get sum marks for trying
F/F
jrandom
1st October 2009, 18:04
write an essay on what you did in the weekend
Is that what they made you do at firefighting school?
:dodge:
Fatt Max
1st October 2009, 18:04
the answer is 3 to the power of Tuesday
Winter
1st October 2009, 18:06
Perhaps I should clarify - I'm not a student, this is not an assignment or anything.. I'm just writing some software for a little home project that I've built.
yes I believe the answer to be 11.707 (mV if your interested), I think slowfox is the winner.. Percentages.. why does the human brain often block out the simplest answer?
Firefight
1st October 2009, 18:10
Is that what they made you do at firefighting school?
:dodge:
yeah, pretty much Dan , could not get my head round pyroformic, endothermic, exothermic reaction, Hydraulics and measuration ,chemistry ,physics, , mecahics and all that shit.
have to say that all that shit we were taught 20+ years ago , never used it once operationally...
F/F
slofox
1st October 2009, 18:17
Perhaps I should clarify - I'm not a student, this is not an assignment or anything.. I'm just writing some software for a little home project that I've built.
yes I believe the answer to be 11.707 (mV if your interested), I think slowfox is the winner.. Percentages.. why does the human brain often block out the simplest answer?
When I ran it to full decimal places (as far as the calc would allow), I got 11.705017089...
mowgli
1st October 2009, 18:19
Oh?
I have a value in one range, i need it converted to its equivalent in the other range..
The question is still retarded. You better make sure you capture any assumptions you make in answering the question. Like are these integer ranges or real? And what is the relationship between the ranges? Is it linear, logarithmic or something else? There are many ways that values in one range could be mapped to values in the other? It'd be inefficient but you could even do it randomly with a lookup table.
Who's asking the question?
Edit: Oh I see now. Back in my box :dodge:
James Deuce
1st October 2009, 18:20
http://www.kiwibiker.co.nz/forums/picture.php?albumid=2602&pictureid=31994
Coldrider
1st October 2009, 18:25
Are you scaling digital to analogue output?
Winter
1st October 2009, 18:26
Oh God, now that it works, the system tells me i weigh 72.706645304036kg
I've put on weight!
Winter
1st October 2009, 18:31
The question is still retarded. You better make sure you capture any assumptions you make in answering the question. Like are these integer ranges or real? And what is the relationship between the ranges? Is it linear, logarithmic or something else? There are many ways that values in one range could be mapped to values in the other? It'd be inefficient but you could even do it randomly with a lookup table.
Who's asking the question?
Edit: Oh I see now. Back in my box :dodge:
I'm the retarded question writer.
Measuring the milli volt output of a loadcell. machine reads inputs in range of +/-150mV, outputs it over ethernet as a big endian 2 word somethingarather. (in the range of 0-65535).
Once i scale in a linear fashion from 0-65535, I have the mV reading, which I can then divide by 2mV per V of excitation voltage(15v) at 100kg.
Err..
I think.
slofox
1st October 2009, 18:36
Remember Joachim's razor boys...
riffer
1st October 2009, 18:42
Remember Joachim's razor boys...
especially given the famed laziness of lecturers. KISS FTW.
jrandom
1st October 2009, 19:11
yes I believe the answer to be 11.707
It would be 11.705 if your range had 300 integer values in it, but it doesn't. It has 301. -150 to 150 includes zero.
So you need to divide 301 by 65536, not 300, and the answer is 12.24.
Unsurprisingly, 'off by one' errors happen a lot in computer programs.
Did you actually read my initial post?
mynameis
1st October 2009, 19:14
First range would make more sense if it was 0 to 65535 (FFFF hex), ie, 65536 distinct values. I'd assume that that's just an error in the form of the question.
Assuming you have no other information than that brain-dead question form, presumably written by someone who was too stupid to get a real job and has therefore ended up teaching, I'd expect that you're supposed to be using an unsigned 16-bit number to represent a range of -150 to 150 decimal.
Which means that you divide 301 decimal (the number of values in your represented range) by 65536 decimal (the number of values in your 16-bit integer) and then multiply the result by 35325 and add the result to your minimum value.
In other words, 12.24.
But, really, I wouldn't have a clue what I'm on about here. Pay no attention to anything I write.
(Edited 302 to 301. See, I told you I had no clue. And edited the result to be added to -150, etc. This whole thread is stupid.)
:laugh: :killingme :rofl:
:spanking:
forget that, just write an essay on what you did in the weekend
it will be more intersting, and you might get sum marks for trying
F/F
Me and my Daddy went fishing.
Winter
1st October 2009, 19:18
It would be 11.705 if your range had 300 integer values in it, but it doesn't. It has 301. -150 to 150 includes zero.
So you need to divide 301 by 65536, not 300, and the answer is 12.24.
Unsurprisingly, 'off by one' errors happen a lot in computer programs.
I said i believed it to be 11.707 as thats what the manufacturers software measured it as - I'd be surprised if they got the maths wrong somehow, its an industrial automation product, used to run factory's and so on.
Did you actually read my initial post?
No, Why? Did it say something useful?
p/t. yes i read it. It said : "That question doesn't make any sense."
jrandom
1st October 2009, 19:21
I said i believed it to be 11.707 as thats what the manufacturers software measured it as
Don't ever assume that the manufacturer's software was written by someone smarter than you. In my experience, it usually isn't.
If the specs really are as you describe, then the manufacturer's software has that exact off-by-one error in its logic and is giving incorrect output.
Always check actual physical measurements with separate calibrated equipment.
p/t. yes i read it. It said : "That question doesn't make any sense."
Come to think of it, I should've just left my contribution to the thread at that.
Winter
1st October 2009, 19:28
Don't ever assume that the manufacturer's software was written by someone smarter than you. In my experience, it usually isn't.
If the specs really are as you describe, then the manufacturer's software has that exact off-by-one error in its logic and is giving incorrect output.
Always check actual physical measurements with separate calibrated equipment.
Looks like your right there - my software is giving slightly higher results than theirs.
Thanks for your input.
peasea
1st October 2009, 19:32
Mind block or something, help me out here.
range one = 0 to 65,536
range two = -150 to +150
value in range one (35325) = what value in range two?
Steps needed to work this out? they told me I needed pay attention in maths if I wanted to work in computers... I didn't believe them :S
What you need is a Range Rover.
Mully
1st October 2009, 19:35
Where's Hitcher?
It's "maths" not "math". We are not in 'merica.
As for the question, I'm a simple freight forwarder, so I dunno.
mynameis
1st October 2009, 19:38
After 10 pages could someone please be courteous enough to summarise the problem and answer to it :D
Coldrider
1st October 2009, 19:56
How linear is the output of the strain gauge of the weigh cell.
Also depends on the accuracy of the analogue input card, and whether the A to D converter has span and zero correction or a fixed constant as a correction.
jrandom
1st October 2009, 20:03
could someone please be courteous enough to summarise the problem
So far we seem to have established that most electronic and software engineers are stupid, and basic arithmetic is the only 'math' you need to know to write computer programs.
jrandom
1st October 2009, 20:04
As for the question, I'm a simple freight forwarder, so I dunno.
Try being a bum on a bicycle. This shit does my head in.
MuzzyBee
1st October 2009, 20:06
Try being a bum on a bicycle. This shit does my head in.
That's an interesting biological problem.
We beeped at some clown on a pushbike the other evening..... :girlfight:
jrandom
1st October 2009, 20:07
That's an interesting biological problem.
Biological?
We beeped at some clown on a pushbike the other evening...
I bet he gave you the learn through the next intersection, though.
MuzzyBee
1st October 2009, 20:10
Biological?
A bum on a bicycle does your head in. Some (not me, of course) may suggest the similarity between your head and your bum..... (but not me of course) :girlfight:
I bet he gave you the learn through the next intersection, though.
Yes, while failing to indicate and completing an inconsiderate lane change or three.....
jrandom
1st October 2009, 20:14
Some may suggest the similarity between your head and your bum...
I have been told that they're both gorgeous, but I just figured the flatterers were after my money.
(but not me of course)
You presumably have no need of my money.
while failing to indicate and completing an inconsiderate lane change or three.....
He probably had a reputation to live up to.
Winter
1st October 2009, 20:59
How linear is the output of the strain gauge of the weigh cell.
Also depends on the accuracy of the analogue input card, and whether the A to D converter has span and zero correction or a fixed constant as a correction.
Dont know how linear the output is, this is the loadcell :
http://shop.totalcomp.com/catalog/documents/spec_sheets/single_point/scaime_ag_5-100kg.pdf
A-D has span and zero calibration options - I don't have the equipment to set them tho so they remain as factory set. Unit is a Advantech Adam 6017 :
http://www.advantech.com/products/ADAM-6017/mod_1-2MLBFW.aspx
Your thoughts would be appreciated :)
NighthawkNZ
1st October 2009, 21:02
Range to target is...
Coldrider
1st October 2009, 21:07
Dont know how linear the output is, this is the loadcell :
http://shop.totalcomp.com/catalog/documents/spec_sheets/single_point/scaime_ag_5-100kg.pdf
A-D has span and zero calibration options - I don't have the equipment to set them tho so they remain as factory set. Unit is a Advantech Adam 6017 :
http://www.advantech.com/products/ADAM-6017/mod_1-2MLBFW.aspx
Your thoughts would be appreciated :)Do it 1st thing in the morning Cheers
Coldrider
1st October 2009, 21:22
Without looking at the data, you need to get a voltage generator within the range, and input this to get the algorithm correct with respect of the input across the full range. If the input is not strictly linear that is not much you can do, but zero and full range to be correct.
From there you need the real world and place a known low weight, and zero span that to correct displayed weight, then place a high end known weight, use span to correct that weight display. Back to low weight re-zero to that known, then high end weight using span adjust.
Continue in that order till both known weights are displayed correctly by the algorithm. Realistically the low end weight needs to 10% and high end 80%.
Basically this linearises the input between weights.
I do a lot of PLC programming for speed weights, acceleration, pressure, PID loops etc.
Coldrider
1st October 2009, 21:33
Sorry, when you start calibrating the real weights, you disconnect the voltage (or analogue generator, and hook in the weigh scale input) you prob guessed.
IANZ labs is the calibration standard mostly certified)
FlangMasterJ
1st October 2009, 21:54
I can count to potato!
McJim
1st October 2009, 22:10
After 10 pages could someone please be courteous enough to summarise the problem and answer to it :D
Dude has a value within a range. Wants to express the equivalent value within a different range.
Dead easy.
Example for those not farting around with hexadecimal shit and stuff. A year has 365 days, 52 weeks and 13 lunar months.
Lets pick day 200 out of 356
It is also week 28.49 out of 52
And it is also month 7.12 out of 13
Piece of piss
Coldrider
1st October 2009, 22:15
Before i get kicked off my PC, load cell will strain gauge will be in millivolts, usually hooked up to an amplifier card, that usually outputs 0 to 20 milliamps or 0 to 10 volts. That is what normally is the input to A to D input, are you using the milliamps direct input.
Winter
1st October 2009, 22:22
Before i get kicked off my PC, load cell will strain gauge will be in millivolts, usually hooked up to an amplifier card, that usually outputs 0 to 20 milliamps or 0 to 10 volts. That is what normally is the input to A to D input, are you using the milliamps direct input.
Correct, there is no load cell amplifier, summing box, or anything of the sort.
Loadcell outputs range of 0-30mV, AD inputs take +/-150mV - not the pefect match but good enuf :)
Coldrider
1st October 2009, 22:31
Correct, there is no load cell amplifier, summing box, or anything of the sort.
Loadcell outputs range of 0-30mV, AD inputs take +/-150mV - not the pefect match but good enuf :)Provided you can input directly the load cell input it is ok. If the algorithm you have written calculates the O KG and 100 KG correctly as inputs, all is good at that point. Zero & span calibration removes any load cell irregularties.
Winter
1st October 2009, 22:51
Provided you can input directly the load cell input it is ok. If the algorithm you have written calculates the O KG and 100 KG correctly as inputs, all is good at that point. Zero & span calibration removes any load cell irregularties.
Yes i think the biggest source of error in this system will be the excitation voltage supplied to the loadcells. It can take 10-15v excitation. outputs 2mV/Vex so I fed it 15v. Power comes from a cheap 24v din rail psu via a DC-DC converter outputting 15.09ish volts.
I need a way of scaling the 15v power supply to a linear 0-10v signal i can read with the AD, and dynamically calculate the algorithm based on the correct excitation voltage as read every sample time.
Isn't anyone going to ask me what its for? :)
paddy
1st October 2009, 23:01
Dude has a value within a range. Wants to express the equivalent value within a different range.
Dead easy.
Example for those not farting around with hexadecimal shit and stuff. A year has 365 days, 52 weeks and 13 lunar months.
Lets pick day 200 out of 356
It is also week 28.49 out of 52
And it is also month 7.12 out of 13
Piece of piss
You are right, the math/maths itself is actually really simple. Where it gets slightly complicated though is that one of the ranges is -150 to +150. It's easy to think that is a range of 300, when in fact it is a range of 301. This yields the "off by one" error that has been well covered above. That's where knowing how stuff it represent by the machine can be useful.
paddy
1st October 2009, 23:02
Isn't anyone going to ask me what its for? :)
No. Everyone got confused when you starting alluding to mV, loadcells, and the like. :-)
Go on, what's it for.
Winter
1st October 2009, 23:04
No. Everyone got confused when you starting alluding to mV, loadcells, and the like. :-)
Go on, what's it for.
teehee.
I have LPG hot water, from two 45kg lpg bottles.
I've built a system that continuously weighs each bottle, works out when its empty, and rings the gas company for a new one when its run out :)
No more cold showers from forgetting to order more LPG for me!
Patent pending!
Zerker
2nd October 2009, 01:14
very nice work.
if you are ordering the new bottle before one is completely empty (rather than empty) your slightly off numbers are still more than close enough to make this work.
though if I come along and put a weight on your bottle your getting a cold shower, that counts for any other foreign material getting onto the scales.
jono035
2nd October 2009, 05:44
Normally you'd have an instrumentation amplifier on the strain gauge, especially seeing as they are a differential output that can be really sensitive to input impedances... The ADAM modules look ok, I've never used them though (Always used Moxa modules instead).
If the output from the ADC is a 16bit value from -32767 to +32768 (assuming twos complement and that you're ignoring negatives) then that will map directly to the -150 to +150mv. This means the output of the ADC will be 218.45 * input value in mv. If your input is 2mv/V at 15V then that will be 30mV in per 100kg, so 300uV per kg, or 65.53 per kg.
Take input as integer, multiply it by 15.26 and that'll give you it in grams...
Winter
2nd October 2009, 05:45
very nice work.
if you are ordering the new bottle before one is completely empty (rather than empty) your slightly off numbers are still more than close enough to make this work.
though if I come along and put a weight on your bottle your getting a cold shower, that counts for any other foreign material getting onto the scales.
Sort of - as the gas regulator system allows one bottle to be empty, I can wait for the first bottle to stop decreasing, IE hit its empty weight.
if it doesn't decrease over say, three days, but the other one does, then its safe to assume its empty & order a new one.
Winter
2nd October 2009, 05:48
Normally you'd have an instrumentation amplifier on the strain gauge, especially seeing as they are a differential output that can be really sensitive to input impedances... The ADAM modules look ok, I've never used them though (Always used Moxa modules instead).
If the output from the ADC is a 16bit value from -32767 to +32768 (assuming twos complement and that you're ignoring negatives) then that will map directly to the -150 to +150mv. This means the output of the ADC will be 218.45 * input value in mv. If your input is 2mv/V at 15V then that will be 30mV in per 100kg, so 300uV per kg, or 65.53 per kg.
Take input as integer, multiply it by 15.26 and that'll give you it in grams...
output from ADC = 16bit Unsigned Int.
an amplifier would be nice, but they sound expensive, like everything else.
jono035
2nd October 2009, 06:08
output from ADC = 16bit Unsigned Int.
an amplifier would be nice, but they sound expensive, like everything else.
Well if it is a 16 bit unsigned int that maps directly to the range then that is a little odd... Either way, in that case just shift the zero point to 32768... so take your integer, subtract 32768, multiply by 15.26 to get grams.
NighthawkNZ
2nd October 2009, 06:13
Forty two....
jono035
2nd October 2009, 06:16
Sort of - as the gas regulator system allows one bottle to be empty, I can wait for the first bottle to stop decreasing, IE hit its empty weight.
if it doesn't decrease over say, three days, but the other one does, then its safe to assume its empty & order a new one.
yeah, be careful about that... Is it flagging a warning or actually sending an e-mail to make the order? You might find that if something goes wrong (load cell stops giving output, wire corrodes off, power supply dies etc.) then a rate of change detection will trigger...
Absolute value would be the way that I would do it with it e-mailing you in such a way as to be a reminder rather than an automated system... You can do some basic low pass filtering on the results easily enough too (measure values once per second, sum them every minute and divide by 60 to give you 1 update per minute that attenuates any changes that occur faster than over a 30s or so timeframe).
If your thing can e-mail you or raise a warning or whatever if the output drops below a certain amount too (no input at all) then that could be useful. May require some filtering as well to not trigger on a bottle change (unless you have a bottle cradle heavy enough to be measured).
If the system is switching between bottles when the pressure drops then that would be why it waits until one is pretty much empty... The pressure should be constant with temperature until the bottle is empty (ignoring the outgoing rate of the gas etc.).
jono035
2nd October 2009, 06:54
You are right, the math/maths itself is actually really simple. Where it gets slightly complicated though is that one of the ranges is -150 to +150. It's easy to think that is a range of 300, when in fact it is a range of 301. This yields the "off by one" error that has been well covered above. That's where knowing how stuff it represent by the machine can be useful.
Yeah, for most programming stuff you're dead on, but things get a little bit muddier when you're dealing with the conversion of real world analogue values to digital values. A value of zero will correspond to -150mV, a value of 65535 will correspond to 150mV, therefore it is 65536/300 for the scaling factor. When dealing with integers 150 can mean anywhere between 150.49 and 149.5 but when you're dealing with ADC inputs then you're actually talking about # of divisions between reference voltages.
The Stranger
2nd October 2009, 07:12
Dude has a value within a range. Wants to express the equivalent value within a different range.
Dead easy.
Example for those not farting around with hexadecimal shit and stuff. A year has 365 days, 52 weeks and 13 lunar months.
Lets pick day 200 out of 356
It is also week 28.49 out of 52
And it is also month 7.12 out of 13
Piece of piss
In keeping with the general theme of this thread, what happened to the other 13 days?
And just for the hell of it let's run with calandar months.
paddy
2nd October 2009, 07:22
Yeah, for most programming stuff you're dead on, but things get a little bit muddier when you're dealing with the conversion of real world analogue values to digital values. A value of zero will correspond to -150mV, a value of 65535 will correspond to 150mV, therefore it is 65536/300 for the scaling factor. When dealing with integers 150 can mean anywhere between 150.49 and 149.5 but when you're dealing with ADC inputs then you're actually talking about # of divisions between reference voltages.
Okay now you got me a bit confused, and without seeming adversarial I have a few thoughts/questions. In terms of the "# of divisions" surely that is just about how many SFs you run the conversion to. In terms of you stating the scale as 300, what does a 0mV output from the loadcell represent (and before anyone jumps in with the obvious joke - it's turned off - it's a serious question).
paddy
2nd October 2009, 07:24
Forty two....
It took a while. But somebody got there. :-) LoL.
jono035
2nd October 2009, 08:03
Okay now you got me a bit confused, and without seeming adversarial I have a few thoughts/questions. In terms of the "# of divisions" surely that is just about how many SFs you run the conversion to. In terms of you stating the scale as 300, what does a 0mV output from the loadcell represent (and before anyone jumps in with the obvious joke - it's turned off - it's a serious question).
Sure thing, ask away!
I'm not really sure what you mean by "how many SF's you run the conversion to". In terms of the ADC itself, the number of divisions comment was meant to say that a 16 bit input ADC will spit out a number between 0 and 65535 which corresponds to what the input voltage is relative to the reference voltage.
If the input range is 0-1V then 0V in will be 0. 1V in will be 65535. Everything else will be scaled accordingly (0.5V being 32768 for instance). To get a number in your program that refers to the actual voltage being measured then you would divide the ADC output by 65535 in this case to get the measurement. 0-1V doesn't mean there are 1001 counts or anything like that, it isn't integer mathematics.
Don't worry about getting anything exactly right, there is no way that those modules will be good for all 16 bits of precision. Noise will eat away a pretty massive chunk of that precision, especially when your reference levels are 150mV. To change the ADC output value by 1, the input would have to be accurate to 4.6uV.
Not entirely sure if that answers your question?
Bass
2nd October 2009, 08:34
You are all wrong I tell you!
The answer is: -
Midnight in a glass bottomed boat times three foot six minus a bottle of orange.
and if you want to be utterly precise about it, the constant of integration is a banana about that colour.
Now, what was the question again?
The Stranger
2nd October 2009, 08:43
Now, what was the question again?
The question is why are you pissed at 9:34 in the morning?
jono035
2nd October 2009, 08:46
The question is why are you pissed at 9:34 in the morning?
He's in Papakura. That seems to be a common theme among people I know who live out there :p
Bass
2nd October 2009, 08:49
The question is why are you pissed at 9:34 in the morning?
Come on! You know that booze doesn't get the colours this bright or the patterns so well defined
He's in Papakura. That seems to be a common theme among people I know who live out there :p
See above
Sorry about that. Sixties sense of humour I guess.
Coldrider
2nd October 2009, 08:51
If the cell ps was turned off, the A to D converter being -150mv to 150mv could read full scale deflection negative.
The scaling algorithm could be coded as to inhibit conversions out of the range of 0 to 30 mv, and even if input voltage is less than say 0.2mv, read 0 to inhibit floating values.
jono035
2nd October 2009, 09:08
If the cell ps was turned off, the A to D converter being -150mv to 150mv could read full scale deflection negative.
The scaling algorithm could be coded as to inhibit conversions out of the range of 0 to 30 mv, and even if input voltage is less than say 0.2mv, read 0 to inhibit floating values.
Yeah, often with SCADA systems for each value they will have a numerical value and a 'health' status, so that if it goes out of range or there is a comms issue you can tell the difference between an actual zero and a zero due to a failure somewhere along the lines.
Doing that such that the value is ignored if it is outside a specific range and an error flag is raised would be a good idea.
Edit: Depending on what the differential amp stage was, my guess is it would read 0mV input with no power. A strain gauge with no supply is basically a resistance between the differential terminals.
Coldrider
2nd October 2009, 09:25
Yeah, often with SCADA systems for each value they will have a numerical value and a 'health' status, so that if it goes out of range or there is a comms issue you can tell the difference between an actual zero and a zero due to a failure somewhere along the lines.
Doing that such that the value is ignored if it is outside a specific range and an error flag is raised would be a good idea.
Edit: Depending on what the differential amp stage was, my guess is it would read 0mV input with no power. A strain gauge with no supply is basically a resistance between the differential terminals.
Yes, been caught out on an Allan Bradley 5/15, maths overflow error shut down the processor, reset and all OK, they tick away for years then out of the blue they bite....
jono035
2nd October 2009, 09:31
Yes, been caught out on an Allan Bradley 5/15, maths overflow error shut down the processor, reset and all OK, they tick away for years then out of the blue they bite....
Yikes... That'd be pretty rough, you'd hope they'd just watchdog and reset in that case?
The only PLCs I've really gotten familiar with are the Siemens S7 series. Too big to be of any use to me though, too expensive really. I'd rather just get a board made and use a microcontroller... <_<
avgas
2nd October 2009, 09:43
Where's Hitcher?
It's "maths" not "math". We are not in 'merica.
As for the question, I'm a simple freight forwarder, so I dunno.
Actually to correct you a bit there. It is math.
Maths is actually different. let me explain.
What is the answer? - Math
Show your 1-10 times tables - Maths
One is a question/subject, the other is a task (or series of)
e.g. I enjoy to run, but i dislike running. I am not good at Math, which is why no one gives me maths to do.
If you want to get pedantic there is computations, computation and Math.
avgas
2nd October 2009, 09:51
Yeah, often with SCADA systems for each value they will have a numerical value and a 'health' status, so that if it goes out of range or there is a comms issue you can tell the difference between an actual zero and a zero due to a failure somewhere along the lines.
Not if the RTC stops at the same time......
....funny the Citect manual doesn't state "How to put fire out", Guess i better call them up :eek5:
I also love the aspect that you can raise a flag, the SCADA system crashes, the RTU pages you to tell you the system has crashed yet is all irrelevant because windows update needs to restart the PC.
If only SCADA was designed by a bunch of people who had a procedure rather than a bunch of super intelligent loopy's who wanted to become famous. They can't even talk the same protocol :crybaby:
jono035
2nd October 2009, 11:18
Not if the RTC stops at the same time.....
So use a simpler clock (doesn't have to be real time, plain RC oscillator for gods sakes) to run your watchdog. With a properly designed watchdog system then this isn't even a problem I've ever bothered with?
Edit: I'm also not sure what you're on about in terms of the 'SCADA system crashing' due to something about windows update but any of the systems we use have failover controllers to avoid this kind of problem. I do agree with you that most SCADA stuff seems to be woefully lacking in the design department though.
peasea
2nd October 2009, 11:59
He's in Papakura. That seems to be a common theme among people I know who live out there :p
I think living in Papakura would be a good excuse for being pissed 24/7.
Winter
2nd October 2009, 12:01
yeah, be careful about that... Is it flagging a warning or actually sending an e-mail to make the order? You might find that if something goes wrong (load cell stops giving output, wire corrodes off, power supply dies etc.) then a rate of change detection will trigger...
Absolute value would be the way that I would do it with it e-mailing you in such a way as to be a reminder rather than an automated system... You can do some basic low pass filtering on the results easily enough too (measure values once per second, sum them every minute and divide by 60 to give you 1 update per minute that attenuates any changes that occur faster than over a 30s or so timeframe).
If your thing can e-mail you or raise a warning or whatever if the output drops below a certain amount too (no input at all) then that could be useful. May require some filtering as well to not trigger on a bottle change (unless you have a bottle cradle heavy enough to be measured).
If the system is switching between bottles when the pressure drops then that would be why it waits until one is pretty much empty... The pressure should be constant with temperature until the bottle is empty (ignoring the outgoing rate of the gas etc.).
I want it fully automated. I'm lazy enough to code something to do it for me. When it reaches the Empty weight (EW) of 35.4kg it will raise a flag. If that flag is still there after 2 days, then its not going to get any smaller. if the weight is within +/- 3kg of what it was when it first hit EW 2 days ago, and as long as it hasn't ordered a bottle in the last 4 days, it will go ahead and order a new one.
The platform on top of the loadcells the bottles sit on are folded from 3mm stainless steel and weigh 5.86923018234529kg. The software knows something is wrong if it falls below that value.
Okay now you got me a bit confused, and without seeming adversarial I have a few thoughts/questions. In terms of the "# of divisions" surely that is just about how many SFs you run the conversion to. In terms of you stating the scale as 300, what does a 0mV output from the loadcell represent (and before anyone jumps in with the obvious joke - it's turned off - it's a serious question).
0mV means 0kg.
Sure thing, ask away!
I'm not really sure what you mean by "how many SF's you run the conversion to". In terms of the ADC itself, the number of divisions comment was meant to say that a 16 bit input ADC will spit out a number between 0 and 65535 which corresponds to what the input voltage is relative to the reference voltage.
If the input range is 0-1V then 0V in will be 0. 1V in will be 65535. Everything else will be scaled accordingly (0.5V being 32768 for instance). To get a number in your program that refers to the actual voltage being measured then you would divide the ADC output by 65535 in this case to get the measurement. 0-1V doesn't mean there are 1001 counts or anything like that, it isn't integer mathematics.
Don't worry about getting anything exactly right, there is no way that those modules will be good for all 16 bits of precision. Noise will eat away a pretty massive chunk of that precision, especially when your reference levels are 150mV. To change the ADC output value by 1, the input would have to be accurate to 4.6uV.
Not entirely sure if that answers your question?
The loadcell is accurate to about 12grams, compensates for temperature within -10/+40°C.
The AD is accurate to +/- 0.1% @ +/-150mV, zero drifts +/-6μV/°C
jono035
2nd October 2009, 12:55
I want it fully automated. I'm lazy enough to code something to do it for me. When it reaches the Empty weight (EW) of 35.4kg it will raise a flag. If that flag is still there after 2 days, then its not going to get any smaller. if the weight is within +/- 3kg of what it was when it first hit EW 2 days ago, and as long as it hasn't ordered a bottle in the last 4 days, it will go ahead and order a new one.
The platform on top of the loadcells the bottles sit on are folded from 3mm stainless steel and weigh 5.86923018234529kg. The software knows something is wrong if it falls below that value.
0mV means 0kg.
The loadcell is accurate to about 12grams, compensates for temperature within -10/+40°C.
The AD is accurate to +/- 0.1% @ +/-150mV, zero drifts +/-6μV/°C
0.1% is 10 bit precision more or less, which is pretty much exactly what I would have suspected. What you described at the start sounds good.
Your platform weight has a pretty serious excess of precision though given the accuracy numbers you've already stated!
If you're getting numbers out and they seem all good then sweet.
Winter
2nd October 2009, 13:27
0.1% is 10 bit precision more or less, which is pretty much exactly what I would have suspected. What you described at the start sounds good.
Your platform weight has a pretty serious excess of precision though given the accuracy numbers you've already stated!
If you're getting numbers out and they seem all good then sweet.
they 'seem' all sweet. But I'd love to get my hand on a 50kg set weight to check it all.
Can you get 'accurate weights' from somewhere?
Coldrider
2nd October 2009, 13:32
they 'seem' all sweet. But I'd love to get my hand on a 50kg set weight to check it all.
Can you get 'accurate weights' from somewhere?Litres of water are a good measure if you can accurarately measure it into buckets, don't forget to weigh the buckets of course, accurate enough for what you want.
Winter
2nd October 2009, 13:35
Litres of water are a good measure if you can accurarately measure it into buckets, don't forget to weigh the buckets of course, accurate enough for what you want.
ah yeap my 500ml pyrex should measure it out accuratley enough.
What about tools to set the zero and span settings?
jono035
2nd October 2009, 13:53
ah yeap my 500ml pyrex should measure it out accuratley enough.
What about tools to set the zero and span settings?
You don't actually need to do any of this. Just scale it in the software.
Stick a full tank on it and whatever that number comes out as = full...
Stick an empty tank on it and whatever that number comes out as = empty...
Anything else beyond that is only needed if you want to know the 'actual' weight...
Winter
2nd October 2009, 13:59
You don't actually need to do any of this. Just scale it in the software.
Stick a full tank on it and whatever that number comes out as = full...
Stick an empty tank on it and whatever that number comes out as = empty...
Anything else beyond that is only needed if you want to know the 'actual' weight...
I need to know the actual weight. The System knows we buy lpg at $2.22/kg. The flow meter on the shower knows when i start my showers, reads the bottle weights, and displays any changes in bottle weights in a $ value on the screen in the shower - you can see the cost of your shower as you shower - as a great incentive for me to stop those hour long showers.
jono035
2nd October 2009, 14:11
I need to know the actual weight. The System knows we buy lpg at $2.22/kg. The flow meter on the shower knows when i start my showers, reads the bottle weights, and displays any changes in bottle weights in a $ value on the screen in the shower - you can see the cost of your shower as you shower - as a great incentive for me to stop those hour long showers.
How much LPG do you think you would use per shower? It might be getting down into the noise floor there....
Edit: Also, if you know how much LPG you've just purchased then you should have your calibration weight right there? If you've purchased 50kg of LPG then whatever the number changes by from full to empty is 50kg.
Winter
2nd October 2009, 14:12
0.41kg this morning. works out about 80cents.
Winter
2nd October 2009, 14:18
I't will be good to be able to measure how much they give me. When I order 45kg do they really give me 40? who would know? ha! Now i can check it :P
jono035
2nd October 2009, 14:30
0.41kg this morning. works out about 80cents.
.41kg on a total measured weight of 80kg (full LPG cylinder + platform) or so?
Assuming you want at least 10% of that as resolution (so measuring in 40g increments) then at 30mV = 100kg then you're trying to measure a change of 0.4% max range, or 120uV which at 10% steps is 12uV step size...
On the 300mV range ADC the LSB is 4.6uV so you're using about 14 bits worth of the ADC... That's going to be difficult seeing as they normally have +/- 1-4 LSB of repeatibility/non-linearity/noise... That coupled with the fact that you are WAY down on the input voltage, you might find that your results aren't particularly nice.
Are you 100% on using the ADAM module? Something with an adjustable reference would be better so you can make better use of the full range of the ADC... An instrumentation amp would be good alternative which would allow you to feed 0-1V or 0-5V into one of the ADAM modules, meaning the only difficulty was getting a good amp on it.
I can't say for certain what your outcome will be but you're seriously pushing all the tech you're using... anything beyond a 12 bits of accuracy can pose problems, and measuring below mV is difficult at best.
Edit: Yeah, I get what you mean about the delivery vs billing. One of the projects we did was for a similar situation, using a tank level monitor to make sure that the amount of diesel delivered was the same as being billed... We said stick a decent flow-rate meter in but they wanted to use the existing (and cheap) level gauges... The ultimate outcome was that the noise floor was way above whatever billing/delivery inaccuracy they were trying to detect...
Winter
2nd October 2009, 14:34
.41kg on a total measured weight of 80kg (full LPG cylinder + platform) or so?
Assuming you want at least 10% of that as resolution (so measuring in 40g increments) then at 30mV = 100kg then you're trying to measure a change of 0.4% max range, or 120uV which at 10% steps is 12uV step size...
On the 300mV range ADC the LSB is 4.6uV so you're using about 14 bits worth of the ADC... That's going to be difficult seeing as they normally have +/- 1-4 LSB of repeatibility/non-linearity/noise... That coupled with the fact that you are WAY down on the input voltage, you might find that your results aren't particularly nice.
Are you 100% on using the ADAM module? Something with an adjustable reference would be better so you can make better use of the full range of the ADC... An instrumentation amp would be good alternative which would allow you to feed 0-1V or 0-5V into one of the ADAM modules, meaning the only difficulty was getting a good amp on it.
I can't say for certain what your outcome will be but you're seriously pushing all the tech you're using... anything beyond a 12 bits of accuracy can pose problems, and measuring below mV is difficult at best.
Only 100% on it in as much as its installed, and working.
I was looking at other units, but the price of a 2 channel ethernet loadcell controller is horrendous.
Makes me wonder what the setup at the local gas station is? They must be pretty accurate on their weigh systems to charge for it.. Maybe ill go visit in the middle of the night ;)
jono035
2nd October 2009, 14:39
Only 100% on it in as much as its installed, and working.
I was looking at other units, but the price of a 2 channel ethernet loadcell controller is horrendous.
Makes me wonder what the setup at the local gas station is? They must be pretty accurate on their weigh systems to charge for it.. Maybe ill go visit in the middle of the night ;)
Yeah, those systems are normally pretty hard-core, but then they have to be to get calibration certs attached... Then again, they have the added advantage of being able to use an appropriate instrumentation amplifier and appropriate ADC reference!
If it is installed and working then I guess just use it and see what happens, just don't trust the data you're getting too much. I wouldn't be surprised to see the data going all over the show... Building up a simple op-amp circuit could help out quite a lot, you have a lot more accuracy to be gained by using more range of the ADC than you are likely to lose in the amp.
jono035
2nd October 2009, 14:40
For future reference the general rules when measuring real world values are 1) use as much of the range of your ADC as possible and 2) use the highest signal levels possible. There is a reason most of the analogue SCADA stuff is done 0-10V :)
Differential signals are good, shielding on your cables is good, sticking any equipment in grounded metal enclosures is good, using short analogue cables and converting to digital asap is good.
Winter
2nd October 2009, 14:48
I'd like to learn more about constructing an amplifier, I don't know much about that sorta electronics. have soldering iron, will solder! (if I have enough instruction on what im building!)
jono035
2nd October 2009, 15:15
I'd like to learn more about constructing an amplifier, I don't know much about that sorta electronics. have soldering iron, will solder! (if I have enough instruction on what im building!)
Well a little dual op-amp on veroboard should be plenty good enough for this application providing it has a nice clean power supply I would think... If you configured the ADAM module to have +/- 5V input and gave the amplifier a gain of 150x then you would be at 4.5V input at 100kg...
That takes your output from being 2.7 counts per 40g change to 12.1 counts per 40g change which should clean up the results from the ADC a little bit.
Given that you've got a buffer there now you can also add a bit of filtering which will clean things up a bit too.
Edit: I can't figure out how to do it nicely so that you could use the full input range of the ADAM module though... My analogue design skills are pretty crap. Should be possible, will ask one of the PhDs that are hovering around the lab, surely they're good for something :p
Coldrider
2nd October 2009, 18:29
We don't have any chemists or physicists on KB, I'd have bet this afternoon that a whole bunch would be debating over the specific gravity of water and the temperature it should be weighed at, and it's mass above and below 4 deg.
jono035
2nd October 2009, 19:04
We don't have any chemists or physicists on KB, I'd have bet this afternoon that a whole bunch would be debating over the specific gravity of water and the temperature it should be weighed at, and it's mass above and below 4 deg.
lol yeah. The whole density vs temp thing is cool with water, it's density is highest at around 3 degrees so the bottoms of lakes can stay at 3 degrees if they're deep between surface temps of frozen up to quite a lot higher than 3!
Indiana_Jones
2nd October 2009, 19:06
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/mEIpNU_WpQE&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mEIpNU_WpQE&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
-Indy
jono035
2nd October 2009, 19:57
-Indy
Quit loitering, you're making the place look untidy!
avgas
17th December 2009, 11:28
2) use the highest signal levels possible. There is a reason most of the analogue SCADA stuff is done 0-10V
Ha i wish.
4-20mA seems to be common, as does 0-10v then there is PT100 and a few hundred others.
Then you have to chop and change them through the 100's of stupid protocols.
Make the IT world seem like a piece of piss :whistle: after the BS in SCADA.
DMCD
17th December 2009, 11:35
Mind block or something, help me out here.
range one = 0 to 65,536
range two = -150 to +150
value in range one (35325) = what value in range two?
Steps needed to work this out? they told me I needed pay attention in maths if I wanted to work in computers... I didn't believe them :S
I'm useless at maths and I run your internets :2thumbsup
Take that any way you wish :lol:
Foxzee
17th December 2009, 11:58
I'm useless at maths and I run your internets :2thumbsup
Take that any way you wish :lol:
HAHA...I've taken it the wrong way....LOL:Oops:
jono035
17th December 2009, 12:45
Ha i wish.
4-20mA seems to be common, as does 0-10v then there is PT100 and a few hundred others.
Then you have to chop and change them through the 100's of stupid protocols.
Make the IT world seem like a piece of piss :whistle: after the BS in SCADA.
4-20mA is really good for longer runs because it is a low impedance signal therefore is relatively immune to most noise sources. Being able to take power from the comms loop is also pretty useful, makes it much easier to have isolated comms or self-powered sensors. It also inherently provides fault detection (current less than 4mA = fault).
The downside is that everything is much more expensive with it and you really have to run everything as balanced loops rather than a bunch of single ended signals and a ground (for slow stuff). You also have to be quite careful when it comes to cable resistance or it can be easy to run into signal clipping issues.
Skyryder
17th December 2009, 19:01
First range would make more sense if it was 0 to 65535 (FFFF hex), ie, 65536 distinct values. I'd assume that that's just an error in the form of the question.
Assuming you have no other information than that brain-dead question form, presumably written by someone who was too stupid to get a real job and has therefore ended up teaching, I'd expect that you're supposed to be using an unsigned 16-bit number to represent a range of -150 to 150 decimal.
Which means that you divide 301 decimal (the number of values in your represented range) by 65536 decimal (the number of values in your 16-bit integer) and then multiply the result by 35325 and add the result to your minimum value.
In other words, 12.24.
But, really, I wouldn't have a clue what I'm on about here. Pay no attention to anything I write.
(Edited 302 to 301. See, I told you I had no clue. And edited the result to be added to -150, etc. This whole thread is stupid.)
Well it looks good.:2thumbsup
Skyryder
jono035
17th December 2009, 19:28
Well it looks good.:2thumbsup
Skyryder
Yeah, looks good but unfortunately is wrong :D
You have to divide by 300, it isn't integer mathematics...
LBD
17th December 2009, 22:47
Mind block or something, help me out here.
range one = 0 to 65,536
range two = -150 to +150
value in range one (35325) = what value in range two?
Steps needed to work this out? they told me I needed pay attention in maths if I wanted to work in computers... I didn't believe them :S
35325/65536=0.5390167
150 - (-150) or 150 + 150 = 300
0.5390167 x 300 = 161.70501
161.70501 - 150 = 11.70501
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.