Difference between revisions of "Manuals/calci/Examples1"
Line 62: | Line 62: | ||
{ | { | ||
− | / | + | function Example1(hg,hw,cpg,cpw,mg,mw) |
− | U = 1/((1/hg)+(1/hw)+(x/k)) | + | { |
− | U = 1</>((1</>hg)+(1</>hw)) | + | |
+ | //Overall Heat transfer coefficient | ||
+ | //U = 1/((1/hg)+(1/hw)+(x/k)) | ||
+ | var x = 0 //wall very thin | ||
+ | //U = 1</>((1</>hg)+(1</>hw)) | ||
− | + | var D = 75mm | |
− | var D = 75mm | + | var tg1 = 350degC<>degK |
− | var tg1 = 350degC<>degK | + | var tg2 = 100degC<>degK |
− | var tg2 = 100degC<>degK | + | var tw1 = 10degC<>degK |
− | var tw1 = 10degC<>degK | ||
− | var U = 1</>((1</>hg)<+>(1</>hw)) | + | var U = 1</>((1</>hg)<+>(1</>hw)) |
− | var delt = tg1<->tg2 | + | var delt = tg1<->tg2 |
− | var φ = mg<*>cpg<*>delt | + | var φ = mg<*>cpg<*>delt |
− | var tw2 = tw1<+>(φ</>(mw<*>cpw)) | + | var tw2 = tw1<+>(φ</>(mw<*>cpw)) |
− | //Parallel flow | + | //Parallel flow |
− | var delti = tg1<->tw1 | + | var delti = tg1<->tw1 |
− | var delt0 = tg2<->tw2 | + | var delt0 = tg2<->tw2 |
− | var A1 = φ<*>(log(delt0</>delti))</>(U<*>(delt0<->delti)) | + | var A1 = φ<*>(log(delt0</>delti))</>(U<*>(delt0<->delti)) |
− | var LParallel = A1</>(π<*>D) | + | var LParallel = A1</>(π<*>D) |
− | //answer:1.48m | + | //answer:1.48m |
− | //Contra Flow | + | //Contra Flow |
− | delti = tg1<->tw2 | + | delti = tg1<->tw2 |
− | delt0 = tg2<->tw1 | + | delt0 = tg2<->tw1 |
− | var A2 = φ<*>(log(delt0</>delti))</>(U<*>(delt0<->delti)) | + | var A2 = φ<*>(log(delt0</>delti))</>(U<*>(delt0<->delti)) |
− | var LContra = A2</>(π<*>D) | + | var LContra = A2</>(π<*>D) |
− | //answer:1.44m | + | //answer:1.44m |
− | + | ||
− | return [LParallel,LContra] | + | return [LParallel,LContra] |
− | |||
} | } | ||
Line 114: | Line 116: | ||
function Example1(hg,hw) | function Example1(hg,hw) | ||
{ | { | ||
− | + | //Overall Heat transfer coefficient | |
− | / | + | //U = 1/((1/hg)+(1/hw)+(x/k)) |
− | U = 1/((1/hg)+(1/hw)+(x/k)) | + | var x = 0 //wall very thin |
− | U = 1</>((1</>hg)+(1</>hw)) | + | //U = 1</>((1</>hg)+(1</>hw)) |
− | + | var U = 1</>((1</>hg)<+>(1</>hw)) | |
− | var U = 1</>((1</>hg)<+>(1</>hw)) | + | |
− | + | return [U] | |
− | return [U] | ||
} | } | ||
Line 135: | Line 136: | ||
{ | { | ||
− | var tg1 = 350degC<>degK | + | var tg1 = 350degC<>degK |
− | var tg2 = 100degC<>degK | + | var tg2 = 100degC<>degK |
− | var delt = tg1<->tg2 | + | var delt = tg1<->tg2 |
− | var φ = mg<*>cpg<*>delt | + | var φ = mg<*>cpg<*>delt |
− | var tw2 = tw1<+>(φ</>(mw<*>cpw)) | + | var tw2 = tw1<+>(φ</>(mw<*>cpw)) |
− | //Parallel flow | + | //Parallel flow |
− | var delti = tg1<->tw1 | + | var delti = tg1<->tw1 |
− | var delt0 = tg2<->tw2 | + | var delt0 = tg2<->tw2 |
− | var A1 = φ<*>(log(delt0</>delti))</>(Example1(hg,hw)<*>(delt0<->delti)) | + | var A1 = φ<*>(log(delt0</>delti))</>(Example1(hg,hw)<*>(delt0<->delti)) |
− | var LParallel = A1</>(π<*>D) | + | var LParallel = A1</>(π<*>D) |
− | //answer:1.48m | + | //answer:1.48m |
− | //Contra Flow | + | //Contra Flow |
− | delti = tg1<->tw2 | + | delti = tg1<->tw2 |
− | delt0 = tg2<->tw1 | + | delt0 = tg2<->tw1 |
− | var A2 = φ<*>(log(delt0</>delti))</>(Example1(hg,hw)<*>(delt0<->delti)) | + | var A2 = φ<*>(log(delt0</>delti))</>(Example1(hg,hw)<*>(delt0<->delti)) |
− | var LContra = A2</>(π<*>D) | + | var LContra = A2</>(π<*>D) |
− | //answer:1.44m | + | //answer:1.44m |
− | + | ||
+ | |||
+ | return [LParallel,LContra] | ||
− | |||
} | } | ||
Line 185: | Line 187: | ||
<source lang="cpp"> | <source lang="cpp"> | ||
function civil1(p,D,t){ | function civil1(p,D,t){ | ||
− | |||
− | |||
− | |||
− | / | + | var E = 30e+6(lb/sqin)//for steel |
− | + | var v = 0.25 | |
− | |||
− | |||
− | |||
− | |||
− | + | /*hoop stress | |
− | + | s = pD/2t | |
− | + | longitudinal stress | |
+ | s'= pD/4t | ||
+ | increase in cyl diameter | ||
+ | delD = D(s-vs')/E */ | ||
− | + | var s = p<*>D</>(2<*>t) | |
+ | var sdash = p<*>D</>(4<*>t) | ||
+ | var delD = D<*>(s<->v<*>sdash)</>E | ||
+ | return [s,sdash,delD<>inch] | ||
} | } | ||
Line 262: | Line 263: | ||
function civil2(dc,ds,dcs,L){ | function civil2(dc,ds,dcs,L){ | ||
− | var Es = 30e+6(lbf/in2) | + | var Es = 30e+6(lbf/in2) |
− | var Ec = 1.03e+11(Pa) | + | var Ec = 1.03e+11(Pa) |
− | var cs = 6.5e-6(diffF-1) | + | var cs = 6.5e-6(diffF-1) |
− | var cc = 9e-6(diffF-1) | + | var cc = 9e-6(diffF-1) |
− | var delT = 44.4(diffC) | + | var delT = 44.4(diffC) |
− | //cross-sectional area | + | //cross-sectional area |
− | var A = π<*>(dc)^2</>4 | + | var A = π<*>(dc)^2</>4 |
− | var As = π<*>(ds)^2</>4 | + | var As = π<*>(ds)^2</>4 |
− | var Ac = A<->As | + | var Ac = A<->As |
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | //coeff of expansion | ||
+ | //c = ((As<*>Es<*>cs)<+>(Ac<*>Ec<*>cc))</>(As<*>Es<+>Ac<*>Ec) | ||
+ | var a = (As<*>Es<*>cs) | ||
+ | var b = (Ac<*>Ec<*>cc)<>(lbf.diffF-1) | ||
+ | var d = (As<*>Es<+>Ac<*>Ec) | ||
+ | var c = (a<+>b)</>d | ||
− | |||
− | |||
− | //expansion | + | //thermal expansion |
− | var | + | var delL = c<*>L<*>delT |
− | |||
− | |||
− | |||
− | // | + | //expansion w.o restraint |
− | var | + | var delLc = cc<*>L<*>delT |
− | var | + | var delLcs = delLc<->delL |
+ | var delLs= cs<*>L<*>delT | ||
+ | var delLsc = delL<->delLs | ||
+ | //restraining force | ||
+ | var P1 = Ac<*>Ec<*>delLcs</>L | ||
+ | var P2 = As<*>Es<*>delLsc</>L | ||
− | |||
+ | return[P1,P2] | ||
} | } | ||
Line 316: | Line 316: | ||
function civil2(dc,ds,dcs){ | function civil2(dc,ds,dcs){ | ||
− | var Es = 30e+6(lbf/in2) | + | var Es = 30e+6(lbf/in2) |
− | var Ec = 1.03e+11(Pa) | + | var Ec = 1.03e+11(Pa) |
− | var cs = 6.5e-6(diffF-1) | + | var cs = 6.5e-6(diffF-1) |
− | var cc = 9e-6(diffF-1) | + | var cc = 9e-6(diffF-1) |
− | //cross-sectional area | + | //cross-sectional area |
− | var A = π<*>(dc)^2</>4 | + | var A = π<*>(dc)^2</>4 |
− | var As = π<*>(ds)^2</>4 | + | var As = π<*>(ds)^2</>4 |
− | var Ac = A<->As | + | var Ac = A<->As |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | //coeff of expansion | ||
+ | //c = ((As<*>Es<*>cs)<+>(Ac<*>Ec<*>cc))</>(As<*>Es<+>Ac<*>Ec) | ||
+ | var a = (As<*>Es<*>cs) | ||
+ | var b = (Ac<*>Ec<*>cc)<>(lbf.diffF-1) | ||
+ | var d = (As<*>Es<+>Ac<*>Ec) | ||
+ | var c = (a<+>b)</>d | ||
+ | |||
+ | return[As,Ac,c] | ||
} | } | ||
Line 347: | Line 346: | ||
function civil3(L,delT){ | function civil3(L,delT){ | ||
− | var Es = 30e+6(lbf/in2) | + | var Es = 30e+6(lbf/in2) |
− | var Ec = 1.03e+11(Pa) | + | var Ec = 1.03e+11(Pa) |
− | var cs = 6.5e-6(diffF-1) | + | var cs = 6.5e-6(diffF-1) |
− | var cc = 9e-6(diffF-1) | + | var cc = 9e-6(diffF-1) |
− | |||
− | |||
− | |||
− | //expansion | + | //thermal expansion |
− | var | + | var delL = civil2(dc,ds,dcs)[2]<*>L<*>delT |
− | |||
− | |||
− | |||
− | // | + | //expansion w.o restraint |
− | var | + | var delLc = cc<*>L<*>delT |
− | var | + | var delLcs = delLc<->delL |
+ | var delLs= cs<*>L<*>delT | ||
+ | var delLsc = delL<->delLs | ||
− | + | //restraining force | |
+ | var P1 = civil2(dc,ds,dcs)[1]<*>Ec<*>delLcs</>L | ||
+ | var P2 = civil2(dc,ds,dcs)[0]<*>Es<*>delLsc</>L | ||
+ | return [P1,P2] | ||
} | } | ||
− | |||
L = 1(ft) | L = 1(ft) | ||
delT = 44.4(diffC) | delT = 44.4(diffC) | ||
− | |||
civil3(L,delT)</source> | civil3(L,delT)</source> | ||
Line 388: | Line 384: | ||
function civil4(){ | function civil4(){ | ||
− | var b = 3.625(inch) | + | var b = 3.625(inch) |
− | var φ = 30(deg) | + | var φ = 30(deg) |
− | var P = 1200(lbf/sqin) | + | var P = 1200(lbf/sqin) |
− | var Q = 2689.1e+3(Pa) | + | var Q = 2689.1e+3(Pa) |
− | var F = 24464(N) | + | var F = 24464(N) |
− | var A = 13.1(sqin | + | var A = 13.1(sqin) |
− | |||
− | |||
− | |||
− | |||
− | |||
− | // | + | //lengths |
− | var | + | var AB = b</>DSIN(φ) |
− | + | var AC = (b<*>DSIN(φ/2))</>DSIN(φ) | |
+ | var BC = (b<*>DCOS(φ/2))</>DSIN(φ) | ||
− | // | + | //stresses f1 and f2 |
− | var | + | var f1 = (F<*>DSIN(φ))</>(A<*>DTAN(φ/2)) |
− | var | + | var f2 = (F<*>DSIN(φ)<*>DTAN(φ/2))</>(A) |
− | |||
− | + | //allowable stresses | |
+ | var N1 = P<*>Q</>((P<*>(DSIN(φ/2))^2)<+>Q<*>(DCOS(φ/2))^2) | ||
+ | var N2 = P<*>Q</>((P<*>(DCOS(φ/2))^2)<+>Q<*>(DSIN(φ/2))^2) | ||
+ | |||
+ | return[AC;BC;f1<>(lbf/sqin);f2<>(lbf/sqin);N1<>Pa;N2<>Pa] | ||
} | } | ||
Line 429: | Line 424: | ||
<source lang="cpp"> | <source lang="cpp"> | ||
function economics(){ | function economics(){ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | var EC = 240000 | |
− | var | + | var n = 5 |
− | var | + | var GI = 83000 |
+ | var r = 0.52 | ||
+ | var i = 0.03 | ||
− | // | + | //taxable income |
− | var | + | var DC = EC</>n |
+ | var TI = GI<->DC | ||
− | // | + | //annual tax payment |
− | var | + | var TP = r<*>TI |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | //net income | |
+ | var NI = GI<->TP | ||
+ | //S = R(USCA) | ||
+ | //SPCA = (1<+>i)^n | ||
+ | var s = NI<*>(5.309) | ||
+ | var sp = s</>EC | ||
+ | var i = [(sp^0.2)<->1]<*>100 | ||
+ | return i | ||
} | } | ||
Line 467: | Line 462: | ||
function fluidmechanics(){ | function fluidmechanics(){ | ||
− | var d1 = 12(inch) | + | var d1 = 12(inch) |
− | var d2 = 203.2(mm) | + | var d2 = 203.2(mm) |
− | var p1 = 124.11e+3(Pa) | + | var p1 = 124.11e+3(Pa) |
− | var z1 = 140(ft) | + | var z1 = 140(ft) |
− | var z2 = 32.31(m) | + | var z2 = 32.31(m) |
− | var q1 = 283.1(L/s) | + | var q1 = 283.1(L/s) |
− | var q2 = 10(ft3/s) | + | var q2 = 10(ft3/s) |
− | var hf = 9(ft) | + | var hf = 9(ft) |
− | var w = (62.4/(144*12))<>(lbf/inch3) | + | var w = (62.4/(144*12))<>(lbf/inch3) |
− | var g = 32.2(ft/s2) | + | var g = 32.2(ft/s2) |
− | + | ||
− | var a1 = π<*>(d1)^2</>4 | + | var a1 = π<*>(d1)^2</>4 |
− | var a2 = π<*>(d2)^2</>4 | + | var a2 = π<*>(d2)^2</>4 |
− | var v1 = q1</>a1 | + | var v1 = q1</>a1 |
− | var v2 = q2</>a2 | + | var v2 = q2</>a2 |
− | var p2 = (((v1^2<->v2^2)</>(2<*>g)<+>z1<->z2<->hf)<*>w)<+>p1 | + | var p2 = (((v1^2<->v2^2)</>(2<*>g)<+>z1<->z2<->hf)<*>w)<+>p1 |
− | + | ||
− | + | return p2<>(lbf/in2) | |
− | return p2<>(lbf/in2) | ||
− | |||
− | |||
} | } | ||
fluidmechanics()</source> | fluidmechanics()</source> |
Revision as of 04:36, 30 January 2018
DESCRIPTION
- Basic Engineering examples in z3.
- Reflecting different domains like Engineering, Statistics, Medicine, etc.
- Set of cases that are progressively complex on units are used to show the user how it goes from simple to complex cases.
- Testing how we can make better solutions to the standard problems compared to other software, due to the presence of units.
Examples
ExampleS1: Chemical Engineering
An exhaust pipe is 75mm diameter and it is cooled by surrounding it with a water jacket. The exhaust gas enters at 350C and the water enters at 10C. The surface heat transfer coefficients for the gas and water are 300 and 1500 W/m2K respectively. The wall is thin so the temperature drop due to conduction is negligible. The gasses have a mean specific heat capacity Cp of 1130 J/kgK and they must be cooled to 100C. The specific heat capacity of the water is 4190 J/kgK. The flow rate of the gas and water is 200 and 1400 kg/h respectively. Calculate the required length of pipe for parellel flow and contra flow.
* The following example demonstrates how a problem is solved when units are used. * The units may be SI, Imperial or a mix of both. * Code shows how to assign a unit or convert a unit. * 3 types of calculations are shown: Normal, using Function, using Function1 in Function2.
z3 code: Normal Calculation without using Function
/*Overall Heat transfer coefficient
U = 1/((1/hg)+(1/hw)+(x/k))
U = 1</>((1</>hg)+(1</>hw))*/
x = 0 //wall very thin
hg = 300(W/m2.degK)
hw = 1500(W/m2.degK)
cpg = 1130(J/kg.degK)
cpw = 4190(J/kg.degK)
mg = 200(kg/hr)
mw = 1400(kg/hr)
D = 75mm
tg1 = 350degC<>degK
tg2 = 100degC<>degK
tw1 = 10degC<>degK
U = 1</>((1</>hg)<+>(1</>hw))
delt = tg1<->tg2
φ = mg<*>cpg<*>delt
tw2 = tw1<+>(φ</>(mw<*>cpw))
//Parallel flow
delti = tg1<->tw1
delt0 = tg2<->tw2
A = φ<*>(log(delt0</>delti))</>(U<*>(delt0<->delti))
L = A</>(π<*>D)
//answer:1.48m
//Contra Flow
delti = tg1<->tw2
delt0 = tg2<->tw1
A = φ<*>(log(delt0</>delti))</>(U<*>(delt0<->delti))
L = A</>(π<*>D)
//answer:1.44m
z3 code: Using Function
function Example1(hg,hw,cpg,cpw,mg,mw)
{
function Example1(hg,hw,cpg,cpw,mg,mw)
{
//Overall Heat transfer coefficient
//U = 1/((1/hg)+(1/hw)+(x/k))
var x = 0 //wall very thin
//U = 1</>((1</>hg)+(1</>hw))
var D = 75mm
var tg1 = 350degC<>degK
var tg2 = 100degC<>degK
var tw1 = 10degC<>degK
var U = 1</>((1</>hg)<+>(1</>hw))
var delt = tg1<->tg2
var φ = mg<*>cpg<*>delt
var tw2 = tw1<+>(φ</>(mw<*>cpw))
//Parallel flow
var delti = tg1<->tw1
var delt0 = tg2<->tw2
var A1 = φ<*>(log(delt0</>delti))</>(U<*>(delt0<->delti))
var LParallel = A1</>(π<*>D)
//answer:1.48m
//Contra Flow
delti = tg1<->tw2
delt0 = tg2<->tw1
var A2 = φ<*>(log(delt0</>delti))</>(U<*>(delt0<->delti))
var LContra = A2</>(π<*>D)
//answer:1.44m
return [LParallel,LContra]
}
hg = 300(W/m2.degK)
hw = 1500(W/m2.degK)
cpg = 1130(J/kg.degK)
cpw = 4190(J/kg.degK)
mg = 200(kg/hr)
mw = 1400(kg/hr)
Example1(hg,hw,cpg,cpw,mg,mw)
z3 code: USING EXAMPLE1 function SOLUTION IN EXAMPLE2 function
function Example1(hg,hw)
{
//Overall Heat transfer coefficient
//U = 1/((1/hg)+(1/hw)+(x/k))
var x = 0 //wall very thin
//U = 1</>((1</>hg)+(1</>hw))
var U = 1</>((1</>hg)<+>(1</>hw))
return [U]
}
hg = 300(W/m2.degK)
hw = 1500(W/m2.degK)
Example1(hg,hw)
function Example2(tw1,mg,mw,cpg,cpw)
{
var tg1 = 350degC<>degK
var tg2 = 100degC<>degK
var delt = tg1<->tg2
var φ = mg<*>cpg<*>delt
var tw2 = tw1<+>(φ</>(mw<*>cpw))
//Parallel flow
var delti = tg1<->tw1
var delt0 = tg2<->tw2
var A1 = φ<*>(log(delt0</>delti))</>(Example1(hg,hw)<*>(delt0<->delti))
var LParallel = A1</>(π<*>D)
//answer:1.48m
//Contra Flow
delti = tg1<->tw2
delt0 = tg2<->tw1
var A2 = φ<*>(log(delt0</>delti))</>(Example1(hg,hw)<*>(delt0<->delti))
var LContra = A2</>(π<*>D)
//answer:1.44m
return [LParallel,LContra]
}
cpg = 1130(J/kg.degK)
cpw = 4190(J/kg.degK)
mg = 200(kg/hr)
mw = 1400(kg/hr)
tw1 = 10degC<>degK
Example2(tw1,mg,mw,cpg,cpw)
ExampleS2: Civil Engineering
A steel pipe 5 ft (1.5 m) in diameter and 3/5 in. (9.53 mm) thick sustains a fluid pressure of
180 lb/sq.in. (1241.1 kPa). Determine the hoop stress, the longitudinal stress, and the increase
in diameter of this pipe. Use 0.25 for Poisson’s ratio.
z3 code: Using Function
function civil1(p,D,t){
var E = 30e+6(lb/sqin)//for steel
var v = 0.25
/*hoop stress
s = pD/2t
longitudinal stress
s'= pD/4t
increase in cyl diameter
delD = D(s-vs')/E */
var s = p<*>D</>(2<*>t)
var sdash = p<*>D</>(4<*>t)
var delD = D<*>(s<->v<*>sdash)</>E
return [s,sdash,delD<>inch]
}
p = 180(lb/sqin)
D = 5(ft)
t = (3/8)<>(inch)
civil1(p,D,t)
ExampleS3: Civil Engineering
A 1/2-in. (12.7-mm) diameter Copperweld bar consists of a steel core 3/8 in. (9.53 mm) indiameter and a copper skin 1/16 in. (1.6 mm) thick. What is the elongation of a 1-ft (0.3-m) length of this bar, and what is the internal force between the steel and copper arising from a temperature rise of 80°F (44.4°C)? Use the following values for thermal expansion coefficients: cs = 6.5*106 and cc = 9.0*106 , where the subscripts s and c refer to steel and copper, respectively. Also, Ec = 15*106 lb/sq.in. (1.03*108 kPa).
z3 code: Normal Calculation without using Function
dc = 12.7(mm)
ds = (3/8)<>(inch)
dcs = (1/16)<>(inch)
Es = 30e+6(lbf/in2)
Ec = 1.03e+11(Pa)
cs = 6.5e-6(diffF-1)
cc = 9e-6(diffF-1)
L = 1(ft)
delT = 44.4(diffC)
//cross-sectional area
A = π<*>(dc)^2</>4
As = π<*>(ds)^2</>4
Ac = A<->As
//coeff of expansion
//c = ((As<*>Es<*>cs)<+>(Ac<*>Ec<*>cc))</>(As<*>Es<+>Ac<*>Ec)
a = (As<*>Es<*>cs)
b = (Ac<*>Ec<*>cc)<>(lbf.diffF-1)
d = (As<*>Es<+>Ac<*>Ec)
c = (a<+>b)</>d
//thermal expansion
delL = c<*>L<*>delT
//expansion w.o restraint
delLc = cc<*>L<*>delT
delLcs = delLc<->delL
delLs= cs<*>L<*>delT
delLsc = delL<->delLs
//restraining force
P1 = Ac<*>Ec<*>delLcs</>L
P2 = As<*>Es<*>delLsc</>L
z3 code: Using Function
function civil2(dc,ds,dcs,L){
var Es = 30e+6(lbf/in2)
var Ec = 1.03e+11(Pa)
var cs = 6.5e-6(diffF-1)
var cc = 9e-6(diffF-1)
var delT = 44.4(diffC)
//cross-sectional area
var A = π<*>(dc)^2</>4
var As = π<*>(ds)^2</>4
var Ac = A<->As
//coeff of expansion
//c = ((As<*>Es<*>cs)<+>(Ac<*>Ec<*>cc))</>(As<*>Es<+>Ac<*>Ec)
var a = (As<*>Es<*>cs)
var b = (Ac<*>Ec<*>cc)<>(lbf.diffF-1)
var d = (As<*>Es<+>Ac<*>Ec)
var c = (a<+>b)</>d
//thermal expansion
var delL = c<*>L<*>delT
//expansion w.o restraint
var delLc = cc<*>L<*>delT
var delLcs = delLc<->delL
var delLs= cs<*>L<*>delT
var delLsc = delL<->delLs
//restraining force
var P1 = Ac<*>Ec<*>delLcs</>L
var P2 = As<*>Es<*>delLsc</>L
return[P1,P2]
}
dc = 12.7(mm)
ds = (3/8)<>(inch)
dcs = (1/16)<>(inch)
L = 1(ft)
civil2(dc,ds,dcs,L)
z3 code: USING EXAMPLE1 function SOLUTION IN EXAMPLE2 function
function civil2(dc,ds,dcs){
var Es = 30e+6(lbf/in2)
var Ec = 1.03e+11(Pa)
var cs = 6.5e-6(diffF-1)
var cc = 9e-6(diffF-1)
//cross-sectional area
var A = π<*>(dc)^2</>4
var As = π<*>(ds)^2</>4
var Ac = A<->As
//coeff of expansion
//c = ((As<*>Es<*>cs)<+>(Ac<*>Ec<*>cc))</>(As<*>Es<+>Ac<*>Ec)
var a = (As<*>Es<*>cs)
var b = (Ac<*>Ec<*>cc)<>(lbf.diffF-1)
var d = (As<*>Es<+>Ac<*>Ec)
var c = (a<+>b)</>d
return[As,Ac,c]
}
dc = 12.7(mm)
ds = (3/8)<>(inch)
dcs = (1/16)<>(inch)
civil2(dc,ds,dcs)
function civil3(L,delT){
var Es = 30e+6(lbf/in2)
var Ec = 1.03e+11(Pa)
var cs = 6.5e-6(diffF-1)
var cc = 9e-6(diffF-1)
//thermal expansion
var delL = civil2(dc,ds,dcs)[2]<*>L<*>delT
//expansion w.o restraint
var delLc = cc<*>L<*>delT
var delLcs = delLc<->delL
var delLs= cs<*>L<*>delT
var delLsc = delL<->delLs
//restraining force
var P1 = civil2(dc,ds,dcs)[1]<*>Ec<*>delLcs</>L
var P2 = civil2(dc,ds,dcs)[0]<*>Es<*>delLsc</>L
return [P1,P2]
}
L = 1(ft)
delT = 44.4(diffC)
civil3(L,delT)
ExampleS4: Civil Engineering
M1 is a 4x4, F = 5500 lb (24,464 N), and Phi = 30°. The allowable compressive
stresses are P = 1200 lb/sq.in. (8274 kPa) and Q = 390 lb/sq.in. (2689.1 kPa). The
projection of M1 into M2 is restricted to a vertical distance of 2.5 in. (63.5 mm).
z3 code: Using Function
function civil4(){
var b = 3.625(inch)
var φ = 30(deg)
var P = 1200(lbf/sqin)
var Q = 2689.1e+3(Pa)
var F = 24464(N)
var A = 13.1(sqin)
//lengths
var AB = b</>DSIN(φ)
var AC = (b<*>DSIN(φ/2))</>DSIN(φ)
var BC = (b<*>DCOS(φ/2))</>DSIN(φ)
//stresses f1 and f2
var f1 = (F<*>DSIN(φ))</>(A<*>DTAN(φ/2))
var f2 = (F<*>DSIN(φ)<*>DTAN(φ/2))</>(A)
//allowable stresses
var N1 = P<*>Q</>((P<*>(DSIN(φ/2))^2)<+>Q<*>(DCOS(φ/2))^2)
var N2 = P<*>Q</>((P<*>(DCOS(φ/2))^2)<+>Q<*>(DSIN(φ/2))^2)
return[AC;BC;f1<>(lbf/sqin);f2<>(lbf/sqin);N1<>Pa;N2<>Pa]
}
civil4()
ExampleS5: Engineering Economics
The QRS Corp. purchased capital equipment for use in a 5-year venture. The equipment
cost $240,000 and had zero salvage value. If the income tax rate was 52 percent and the
annual income from the investment was $83,000 before taxes and depreciation, what was
the average rate of earnings if the profits after taxes were invested in tax-free bonds yielding 3 percent? Compare the results obtained when depreciation is computed by the straight-line method.
z3 code: Using Function
function economics(){
var EC = 240000
var n = 5
var GI = 83000
var r = 0.52
var i = 0.03
//taxable income
var DC = EC</>n
var TI = GI<->DC
//annual tax payment
var TP = r<*>TI
//net income
var NI = GI<->TP
//S = R(USCA)
//SPCA = (1<+>i)^n
var s = NI<*>(5.309)
var sp = s</>EC
var i = [(sp^0.2)<->1]<*>100
return i
}
economics()
ExampleS6: Fluid Mechanics
A steel pipe is discharging 10 ft3/s (283.1 L/s) of water. At section 1, the pipe diameter is 12 in. (304.8 mm), the pressure is 18 lb/sq.in. (124.11 kPa), and the elevation is 140 ft(42.67 m). At section 2, farther downstream, the pipe diameter is 8 in. (203.2 mm), and the elevation is 106 ft (32.31 m). If there is a head loss of 9 ft (2.74 m) between these sections due to pipe friction, what is the pressure at section 2?
z3 code: Using Function
function fluidmechanics(){
var d1 = 12(inch)
var d2 = 203.2(mm)
var p1 = 124.11e+3(Pa)
var z1 = 140(ft)
var z2 = 32.31(m)
var q1 = 283.1(L/s)
var q2 = 10(ft3/s)
var hf = 9(ft)
var w = (62.4/(144*12))<>(lbf/inch3)
var g = 32.2(ft/s2)
var a1 = π<*>(d1)^2</>4
var a2 = π<*>(d2)^2</>4
var v1 = q1</>a1
var v2 = q2</>a2
var p2 = (((v1^2<->v2^2)</>(2<*>g)<+>z1<->z2<->hf)<*>w)<+>p1
return p2<>(lbf/in2)
}
fluidmechanics()