0 Members and 1 Guest are viewing this topic.
While in Units.lua (Git version) I have: [code]Units["Pa"] = {}Units["Pa"]["MPa"] = {Mt.M , 0}Units["Pa"]["GPa"] = {Mt.G , 0}Units["Pa"]["hPa"] = {Mt.h , 0}Units["Pa"]["bar"] = {1/100000, 0}Units["Pa"]["atm"] = {1.01325 , 0}
PahPaatmGPabarMPa
1+σ_cp/f_cd for 0 < σ_cp <= 0.25 f_cd1.25 for 0.25 f_cd < σ_cp <= 0.5 f_cd2.5(1-σ_cp/f_cd) for 0.5 f_cd < σ_cp <= 1.0 f_cd
addCat(2, "Applied Hydraulics", "Darcy-Weisbach, Colebrook-White etc.") addCatVar(2, "hf", "Head loss due to friction", "m") addCatVar(2, "f", "Darcy friction factor", "unitless") addCatVar(2, "Re", "Reynolds number", "unitless") addCatVar(2, c_nu, "Kinematic viscosity", "m2/s") addCatVar(2, "Ks", "Roughness Factor", "m") addCatVar(2, "L", "Length of the pipe", "m") addCatVar(2, "D", "Hydraulic diameter", "m") addCatVar(2, "V", "Mean velocity", "m/s") addCatVar(2, "Q", "Volumetric flow rate", "m3/s")addSubCat(2, 1, "Missing D #1", "") --Darcy-Weisbach aF(2, 1, "hf=f*(L/D)*(V^2/(2g))", U("hf","f","L","D","V","g")) --Colebrook-White aF(2, 1, "1/sqrt(f)+2log(Ks/D+9.35/(Re*sqrt(f)))=1.14", U("f","Ks","D","Re")) --Reynolds number aF(2, 1, "Re=V*D/"..c_nu, U("Re","V","D",c_nu)) aF(2, 1, "Q=V*"..c_pi.."*D^2/4", U("Q","V","D")) addSubCat(2, 2, "Missing D #2", "") --Darcy-Weisbach with flow rate aF(2, 2, "hf=f*(L/D^5)*(8*Q^2/("..c_pi.."^2*g))", U("hf","f","L","D","Q","g")) --Reynolds number aF(2, 2, "Re*sqrt(f)=sqrt(2*g*hf/L)*D^(1.5)/"..c_nu, U("Re","f","g","hf","L","D",c_nu)) --Colebrook-White aF(2, 2, "1/sqrt(f)+2log(Ks/D+9.35/(Re*sqrt(f)))=1.14", U("f","Ks","D","Re")) addSubCat(2, 3, "Missing D #3", "") --Darcy-Weisbach with flow rate aF(2, 3, "D=(8*f*L*Q^2/("..c_pi.."^2*g*hf))^(0.2)", U("hf","f","L","D","Q","g")) --Colebrook-White with Raynolds number aF(2, 3, "1/sqrt(f)+2log(Ks/D+9.35/(sqrt(2*g*hf/L)*D^(1.5)/"..c_nu.."))=1.14", U("f","Ks","D","g","hf","L",c_nu))addSubCat(2, 4, "Missing D #4", "") --Colebrook-White, with the above aF(2, 4, "1/sqrt(f)+2log(Ks/((8*f*L*Q^2/("..c_pi.."^2*g*hf))^(0.2))+9.35/(sqrt(2*g*hf/L)*((8*f*L*Q^2/("..c_pi.."^2*g*hf))^(0.2))^(1.5)/"..c_nu.."))=1.14", U("f","Ks","g","hf","L","Q",c_nu))
Using the latest git-version and a Nspire CX CAS v3.1 calculator, I have a serious problem.I have a set of 4 principal equations in applied hydraulics.The only way I get an answer is when I implement all four into one. (look Missing D #4)If I implement them into two-tree equations and providing I give f (provided by Missing D #4), I get the desired D. (look Missing D #2 & #3)If I have all four, and I provide the D, I'll get the f, but if I provide the f only, I don't get D. (look Missing D #1)It seems to be a solver issue. Does FormulaPro uses the built-in CAS solvers and if not, is there a way to select the desired solver?
git clone git://github.com/adriweb/EEPro-for-Nspire.git
function math.solve(formula, tosolve) --local eq="max(exp" .. string.uchar(9654) .. "list(solve(" .. formula .. ", " .. tosolve ..")," .. tosolve .."))" local eq = "nsolve(" .. formula .. ", " .. tosolve .. ")" local res = tostring(math.eval(eq)):gsub(utf8(8722), "-") --print("-", eq, math.eval(eq), tostring(math.eval(eq)), tostring(math.eval(eq)):gsub(utf8(8722), "-")) return tonumber(res)end
function math.solve(formula, tosolve) local eq="max(exp" .. string.uchar(9654) .. "list(solve(" .. formula .. ", " .. tosolve ..")," .. tosolve .."))" --local eq = "nsolve(" .. formula .. ", " .. tosolve .. ")" local res = tostring(math.eval(eq)):gsub(utf8(8722), "-") --print("-", eq, math.eval(eq), tostring(math.eval(eq)), tostring(math.eval(eq)):gsub(utf8(8722), "-")) return tonumber(res)end
if not checkIfFormulaExists(Formulas, fr.formula) then table.insert(Formulas, fr) end if not checkIfFormulaExists(Categories[cid].sub[sid].formulas, fr.formula) then table.insert(Categories[cid].sub[sid].formulas, fr) end]
table.insert(Formulas, fr) table.insert(Categories[cid].sub[sid].formulas, fr)]