Nici3000

Untitled

Feb 24th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. --https://www.ltc.lu/enseignants/mike.anen/pdf/dichte_9de.pdf
  2.  
  3. dichteLuft = 0.0012041 --g/cm³
  4. dichten={
  5. dichteAlu = 2.700,
  6. dichteStahl = 7.900,
  7. }
  8.  
  9. pi = math.pi
  10.  
  11. print("g to lift")
  12. io.write("> ")
  13. gToLift = tonumber(io.read())
  14. print("dicke der hülle in mm")
  15. io.write("> ")
  16. hullThickness = tonumber(io.read())
  17.  
  18. i = 0
  19. print("Welches hüllenmaterial soll verwendet werden?")
  20. for k,v in pairs(dichten) do
  21. i = i + 1
  22. print(i,k,v.."g/cm3")
  23. end
  24. io.write(">")
  25. number = tonumber(io.read())
  26. i = 0
  27. for k,v in pairs(dichten) do
  28. i = i + 1
  29. if i == number then
  30. dichteHull = v
  31. end
  32. end
  33.  
  34. print(dichteHull)
  35.  
  36. function doTheFancyShit(m,p1,p2,d) -- masse,dichteLuft,dichteHülle,dickeDerHülle
  37. -- get volume needet to replace enugh air to lift [m]
  38. Va = m/p1
  39. -- get radius of said volume
  40. r = math.pow(Va/(4/3)/pi,1/3)
  41.  
  42. -- get volume of hull
  43. Vh = (4/3*pi*math.pow(r+d,3)-4/3*pi*math.pow(r,3))
  44. -- get mass of hull
  45. Mh = Vh * p2
  46. return r,Mh
  47. end
  48.  
  49. Mh = 0 -- hull weight is init
  50. rl = 0 -- last radius
  51. repeat
  52. rl = r
  53. r,Mh = doTheFancyShit(gToLift+Mh,dichteLuft,dichteHull,hullThickness)
  54. print(r,Mh)
  55. until rl == r
  56.  
  57. print("Radius: "..math.floor(r).."mm")
Advertisement
Add Comment
Please, Sign In to add comment