dryfriction.yml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. !!omap
  2. - name: unknown
  3. - parts:
  4. - name: head
  5. shapes:
  6. libraries: ['from math import tan, radians, sin, cos', from pysketcher import
  7. *]
  8. - name: constants
  9. shapes:
  10. fontsize: 18 # size of the characters
  11. g: 9.81 # constant gravity
  12. theta: 30.0 # inclined plane angle
  13. L: 10.0 # sketch sizing parameter
  14. a: 1.0 #
  15. xmin: 0.0 # sketech min Abscissa
  16. ymin: -3.0 # sketech min Ordinate
  17. rl: 2.0 # rectangle width
  18. rL: 1.0 # rectangle length
  19. - name: frame
  20. shapes:
  21. setframe: # sketch setup
  22. action: drawing_tool.set_coordinate_system(xmin=xmin-L/5, xmax=xmin+1.5*L,ymin=ymin,
  23. ymax=ymin+1.5*L,instruction_file='tmp_mpl_friction.py')
  24. setblackline: # default frame values and actions
  25. action: drawing_tool.set_linecolor('black')
  26. B: point(a+L,0) # wall right end
  27. A: point(a,tan(radians(theta))*L) # wall left end
  28. normal_vec: point(sin(radians(theta)),cos(radians(theta))) # Vector normal to wall
  29. tangent_vec: point(cos(radians(theta)),-sin(radians(theta))) # Vector tangent to wall
  30. help_line: Line(A,B) # wall line
  31. x: a + 3*L/10. # contact point Abscissa
  32. y: help_line(x=x) # contact point Ordinate
  33. contact: point(x, y) # contact point: middle of the rectangle bottom edge
  34. c: contact + rL/2*normal_vec
  35. - name: body
  36. shapes:
  37. rectangle:
  38. formula: Rectangle(contact, rl, rL)
  39. style:
  40. linecolor: blue
  41. filled_curves:
  42. color: blue
  43. transform: ['rotate(-theta, contact)', translate(-rl/2*tangent_vec)]
  44. N:
  45. formula: Force(contact - rl*normal_vec, contact, r'$N$', text_pos='start')
  46. style:
  47. linecolor: black
  48. wheel:
  49. formula: "Composition({'outer': rectangle})"
  50. style:
  51. shadow: 1
  52. mc:
  53. formula: Text(r'$c$', c)
  54. body:
  55. formula: "Composition({'wheel': wheel, 'N': N, 'mc': mc})"
  56. style:
  57. linecolor: black
  58. - name: plan
  59. shapes:
  60. mB:
  61. formula: Text(r'$B$',B)
  62. mA:
  63. formula: Text(r'$A$', A)
  64. wall:
  65. formula: Wall(x=[A[0], B[0]], y=[A[1], B[1]], thickness=-0.25,transparent=False)
  66. style:
  67. linecolor: black
  68. x_const:
  69. formula: Line(contact, contact + point(0,4))
  70. style:
  71. linestyle: dotted
  72. transform: rotate(-theta, contact)
  73. x_axis:
  74. formula: Axis(start=contact+ 2*rl*normal_vec, length=2*rl,label='$x$', rotation_angle=-theta)
  75. plan:
  76. formula: "Composition({'body': body, 'inclined wall': wall, 'x start': x_const,\
  77. \ 'x axis': x_axis, 'mA': mA, 'mB': mB})"
  78. - name: friction
  79. shapes:
  80. mg:
  81. formula: Gravity(c, rl, text='$Mg$')
  82. style:
  83. linecolor: black
  84. angle:
  85. formula: Arc_wText(r'$<bslash>theta$', center=B, radius=3, start_angle=180-theta,
  86. arc_angle=theta, fontsize=fontsize)
  87. style:
  88. linecolor: black
  89. linewidth: 1
  90. ground:
  91. formula: Line((B[0]-L/10., 0), (B[0]-L/2.,0))
  92. stlye:
  93. linecolor: black
  94. linestyle: dashed
  95. linewidth: 1
  96. friction:
  97. formula: "Composition({'plan': plan, 'ground': ground, 'mg': mg, 'angle':\
  98. \ angle})"