

Testing and Benchmarking Discuss, design, and debate ways to evaluate the performace of he goods out there. 
Thread Tools 
03202006, 09:58 AM  #1 
Responsible for 2%
of all the posts here. Join Date: May 2002
Location: Texas, U.S.A.
Posts: 8,302

Units Converter & Equation Solver
Units Converter & Equation Solver
(covers unit conversion and fluid properties) http://www.enewsdepot.com/magazine/index.php?read=167 Located here: http://www.lytron.com/support/tech_ref.htm and downloadable here: http://www.lytron.com/support/units_index.htm (registration may be requested). (requires Flash). 
03202006, 02:33 PM  #2 
Cooling Savant
Join Date: Aug 2005
Location: uk
Posts: 400

Re: Units Converter & Equation Solver
I would also recommend (hint Les) that people try to get a hold of a copy of MathCAD as it the best at this kind of things (scientific formula manipulation). It does cost alot of money though.
See http://www.mathsoft.com/solutions/ca...te/mathcad.asp This guy exaplains heat transfer really well using it (can still see pages without the software): http://web.usna.navy.mil/~adams/index2.htm 
03202006, 07:01 PM  #3 
Pro/Staff
Join Date: Oct 2001
Location: Klamath Falls, OR
Posts: 1,439

Re: Units Converter & Equation Solver
You can see the pages with links to the MathCad files, you mean. Right? All I can really see is the table of contents (which is nice, btw).

03202006, 07:57 PM  #4 
Cooling Savant
Join Date: Jan 2003
Location: Sydney, Oz
Posts: 336

Re: Units Converter & Equation Solver
I've written a java app that takes a table of points and finds the equation of the best fit line. No clever maths, just pure grunt work (takes minutes to run, pure CPU bound so unless dual core nothing reponds etc).
Will convert to applet and host online if people interested. Developed due to my need to have equations for pump, block etc curves for PQ. Only handles straight lines and positive powers. Does not handle CW charts with their 1/x shape.
__________________
Long Haired Git "Securing an environment of Windows platforms from abuse  external or internal  is akin to trying to install sprinklers in a fireworks factory where smoking on the job is permitted." (Prof. Gene Spafford) My Rig, in all its glory, can be seen best here AMD XP1600 @ 1530 Mhz  Soyo Dragon +  256 Mb PC2700 DDRAM  2 x 40 Gb 7200rpm in Raid0  Maze 2, eheim 1250, dual heater cores!  Full specifications (PCDB) 
03212006, 01:19 AM  #5 
Pro/Staff
Join Date: Oct 2001
Location: Klamath Falls, OR
Posts: 1,439

Re: Units Converter & Equation Solver
Is that a simple npoly fit or something more exotic?

03212006, 10:32 AM  #6 
Cooling Savant
Join Date: Aug 2005
Location: uk
Posts: 400

Re: Units Converter & Equation Solver
My bad, I don’t actually have a computer without MathCAD on it so I didn’t realise it used its files instead of an editable Web page.
This is a viewer for the files. http://www.ecs.soton.ac.uk/~msn/book/mcexp802.exe It’s a very popular program so it should be easy to get access to. The guy writing the heat transfer stuff has mucked up in places and covered text with formulas. Yes it is just links to the chapters. 
03212006, 10:33 AM  #7  
Cooling Savant
Join Date: Aug 2005
Location: uk
Posts: 400

Re: Units Converter & Equation Solver
Quote:
How on earth does it take that long? I'm assuming it trys everything then calculates the best result. 

03212006, 04:01 PM  #8  
Responsible for 2%
of all the posts here. Join Date: May 2002
Location: Texas, U.S.A.
Posts: 8,302

Re: Units Converter & Equation Solver
Quote:
I was just looking at a similar program yesterday: http://silkscientific.com/ (pricey though) 

03212006, 04:02 PM  #9 
Responsible for 2%
of all the posts here. Join Date: May 2002
Location: Texas, U.S.A.
Posts: 8,302

Re: Units Converter & Equation Solver
All, since this is intended to be a sticky, be aware that I might clean it up, and consolidate the info within the first post.
Thank you! 
03212006, 06:13 PM  #10 
Cooling Savant
Join Date: Jan 2003
Location: Sydney, Oz
Posts: 336

Re: Units Converter & Equation Solver
Forums just ate my reply. %$#%#.
Anyhow, my method is brutal and not smart. Didn't consult any books or sites for "right way" or "smart way", just hacked up how I would do it when I was on the train to work as a way to make getting my approximator formulae. I take the points, and substitute them into: a.x.x.x + b.x.x + c.x + d = y There's a checkbox to say that the point 0,0 (if supplied) is a "hard" point and that solves d = 0 immediately. All other points are assumed approximate (and 0,0 if checkbox not on) as I typically read my points off PQ graphs rather than real data. So, I have a heap of formulae like: {value}.a + {value}.b + {value}.c + {value} = 0 I then factor each where I can (ie, if each value is divisible by two etc) and only keep unique formulae. Next, I substitute every formulae into every other formulae, factor and again only keep unique formulae created. I then repeat this again and again. Thus, my 6 or so points end up being, well, tens of thousands of formulae. Next, I look for the formulae where a and b are near zero. These are then used to come up with a value for c by averaging all the c values. I then substitute the c value back into all the equations and go looking for where a is near zero and solve for b, and then repeat for a. By "zero", I mean 0.000000001. I found this gives the same accuracy I need as using more decimal places but its much faster and using less decimals is no faster. On my computer on the day I mucked about. So, supply it like 10 points and want cubic then I cap it at 100,000 formulae which it will get to. Let me know if I am being dumb and there's a smarter way and if I get bored on the train, I may programme it up. I've got some webspace now, but the issue is turning it into an applet (as in I have to find some train time). Emailing you the code and classes BigBen2K, please don't distribute further, please don't post the source code, feel free to Appletise and host if you know java. Any other changes, please send them back so I can take advantage etc.
__________________
Long Haired Git "Securing an environment of Windows platforms from abuse  external or internal  is akin to trying to install sprinklers in a fireworks factory where smoking on the job is permitted." (Prof. Gene Spafford) My Rig, in all its glory, can be seen best here AMD XP1600 @ 1530 Mhz  Soyo Dragon +  256 Mb PC2700 DDRAM  2 x 40 Gb 7200rpm in Raid0  Maze 2, eheim 1250, dual heater cores!  Full specifications (PCDB) 
03212006, 06:27 PM  #11 
Pro/Staff
Join Date: Oct 2001
Location: Klamath Falls, OR
Posts: 1,439

Re: Units Converter & Equation Solver
Canonical approach to the problem you describe is Least Squares.

03212006, 07:30 PM  #12 
Cooling Savant
Join Date: Aug 2005
Location: uk
Posts: 400

Re: Units Converter & Equation Solver
Hmmm thats one way of doing it.
A bit of mucking around and you should be able to find far better methods, method of least squares as one example. Last edited by bobo5195; 03212006 at 07:39 PM. 
03222006, 08:44 PM  #13 
Cooling Savant
Join Date: Jan 2003
Location: Sydney, Oz
Posts: 336

Re: Units Converter & Equation Solver
My method works, so looking for something more accurate or faster.
The least squares thing is how you measure how good the curve was. not how to create it. I ignore least square and use absvalues as it is more important for me to match the curve near zero than at the extreme positive end (10LPM and more) as we're never there. The main page uses roots, but I don't get the benefit of multiple crosses of X and Y axis, just 0,0. Lagrange Interpolation Polynomials look like fun: http://www.wmueller.com/precalculus/.../lagrange.html I could then use least squares to automate the simplication of the polynomial and wiggle it around to find the best fit.
__________________
Long Haired Git "Securing an environment of Windows platforms from abuse  external or internal  is akin to trying to install sprinklers in a fireworks factory where smoking on the job is permitted." (Prof. Gene Spafford) My Rig, in all its glory, can be seen best here AMD XP1600 @ 1530 Mhz  Soyo Dragon +  256 Mb PC2700 DDRAM  2 x 40 Gb 7200rpm in Raid0  Maze 2, eheim 1250, dual heater cores!  Full specifications (PCDB) 
03222006, 08:56 PM  #14  
Responsible for 2%
of all the posts here. Join Date: May 2002
Location: Texas, U.S.A.
Posts: 8,302

Re: Units Converter & Equation Solver
Quote:
PM'ing you another addy. 

03242006, 12:13 AM  #15 
Cooling Savant
Join Date: Jan 2003
Location: Sydney, Oz
Posts: 336

Re: Units Converter & Equation Solver
Wow, Lagrange is both awesome and scary.
Bugger me dead if it calculates a line straight through every point I supply, and does it in milliseconds. I'll host a lagrange version of my equation finder soon. Its also unusable. See, if we look at the PQ graph of the MCR220QP (its over at swiftech, but we all know the y = a.x.x.x + b.x.x + c.x shape where it passes through 0,0) then the formulae I get with my tool is: y = 0.011115909951571587 . x^3 + 0.006326165221453601 . x^2 which I round to y = 0.111 . x^3 + 0.0063 . x^2 This scores a "sum of the squares" difference of 0.0562 with the largest error at a known point being 0.03 mH20. When I plug the same values into lagrange then it spits out: 1.9158683767169433E6 . x^7 + 9.144334308297495E5 . x^6 + 0.0017305525312195573 . x^5 + 0.016418986110316565 . x^4 + 0.08073720151954691 . x ^ 3 + 0.19907864466310282 . x^ 2 + 0.14167268064530752 . x It has a sumofsquares score of zero because it hits every one of the points on my graph dead on. BUT Outside the points on my graph, and between the points on my graph near zero, it all goes horribly wrong. The above formulae gets a head of 0.03 mH20 at 0.5 LPM. Worse still, after reaching a peak around 13 LPM, the graph goes nutsoid and plummets to a head of 6 mH20 at 17 LPM. Lastly, because the forumlaue is so complex, it cannot be "tweaked" at all. The combination of +ve and ve coefficients and superlarge powers means tweaking it makes very large uncontrollable differences. So I can't simplify it to make it quicker to calculate, I can only cut and paste. I suppose I could force my approximator to only use values between the two extremese of known points, and I could supply a lot of points in order to prevent issues like the 0.5 LPM abberation above. However, more points result in higher powers and massively long formulae and very long execution times for my approximator. So, suprisingly, equation finder stands up to lagrange and wins.....
__________________
Long Haired Git "Securing an environment of Windows platforms from abuse  external or internal  is akin to trying to install sprinklers in a fireworks factory where smoking on the job is permitted." (Prof. Gene Spafford) My Rig, in all its glory, can be seen best here AMD XP1600 @ 1530 Mhz  Soyo Dragon +  256 Mb PC2700 DDRAM  2 x 40 Gb 7200rpm in Raid0  Maze 2, eheim 1250, dual heater cores!  Full specifications (PCDB) 
03242006, 12:36 AM  #16 
Cooling Savant
Join Date: Aug 2005
Location: uk
Posts: 400

Re: Units Converter & Equation Solver
For this exact reason that more accurate curve fitting is not better.
The x^7 correlation is wrong flow does not vary like that. Swiftechs results have errors and variances fitting in all the things they got wrong is not making things better. Flow correlations are not a many term polynomial! More likely to be a power law result but even then beware and be prepared to use voodoo magic. Most stuff should correspond to a x^2 correlation only. So dp = a * flow^2. Have a google for “hazen williams” and the “moody diagram” and its corelations to see slightly different equations to fit to. 
03242006, 04:17 PM  #17 
Responsible for 2%
of all the posts here. Join Date: May 2002
Location: Texas, U.S.A.
Posts: 8,302

Re: Units Converter & Equation Solver
Got it.
Pardon my ignorance (I have no experience with Java), but how do I set this up for hosting? 
03252006, 04:51 PM  #18 
Cooling Savant
Join Date: Jan 2003
Location: Sydney, Oz
Posts: 336

Re: Units Converter & Equation Solver
BigBen2k, I thought you wanted it for you.
I will need to write a front end to make it work as an Applet as I didn't bother. Works as an app from the command line only right now.
__________________
Long Haired Git "Securing an environment of Windows platforms from abuse  external or internal  is akin to trying to install sprinklers in a fireworks factory where smoking on the job is permitted." (Prof. Gene Spafford) My Rig, in all its glory, can be seen best here AMD XP1600 @ 1530 Mhz  Soyo Dragon +  256 Mb PC2700 DDRAM  2 x 40 Gb 7200rpm in Raid0  Maze 2, eheim 1250, dual heater cores!  Full specifications (PCDB) 
03272006, 03:57 PM  #19 
Responsible for 2%
of all the posts here. Join Date: May 2002
Location: Texas, U.S.A.
Posts: 8,302

Re: Units Converter & Equation Solver
Oh, then I can probably figure it out. I'm setting up my PC right now.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)  
Thread Tools  

