# No. 407 (Brown 1868): "Instrument for describing pointed arches. Horizontal bar is slotted and fitted with a slide having pin for loop of cord.
# Arch bar of elastic wood is fixed in horizontal at right angles. Horizontal bar is placed with upper edge on springing line, and back of arch bar
# ranging with jamb of opening, and the latter bar is bent till the upper side meets apex of arch, fulcrum-piece at its base insuring its retaining
# tangential relation to jamb; the pencil is secured to arched bar at its connection with cord."
#
# Model (cm, Brown's elevation; the instrument lies on the drawing, so no gravity). The horizontal bar's upper edge is the springing line; the arch
# bar is fixed in it upright, at the jamb, with the fulcrum-piece at its foot, and rises in 15 short pieces of 2 cm jointed end to end, each
# joint a spring of 2.5 N m/rad (the bar's stiffness), so straight when free. A cord (a chain of links) is looped on the slide's pin in the
# slot and tied to the bar's end, where the pencil is; it holds the bar bent (1.6 N with the cord upright). The hand sliding the slide along
# the slot (6 cm either way) is the one driven joint: the cord leans with the slide and draws the bar's end out or lets it in, and the
# bar bends more or less at its foot (a little: the bar is far stiffer sideways than the cord's lean). The bar is held bent by nothing but the cord. Generator: opencode-runs/batch13/gen407.py (it also solves the bar's
# bending for each place of the slide, quasi-statically, for the check's expected slope).
number: 407
slug: pointed-arch-instrument
name: Instrument for describing pointed arches
brown: "Instrument for describing pointed arches. Horizontal bar is slotted and fitted with a slide having pin for loop of cord. Arch bar of elastic wood is fixed in horizontal at right angles. Horizontal bar is placed with upper edge on springing line, and back of arch bar ranging with jamb of opening, and the latter bar is bent till the upper side meets apex of arch, fulcrum-piece at its base insuring its retaining tangential relation to jamb; the pencil is secured to arched bar at its connection with cord."
units: cm
sim: {timestep: 5e-05, integrator: implicitfast, iterations: 60, duration_s: 10, floor: false, gravity: 0}
bodies:
  - id: bar
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#d8ccb0"
    pieces:
      - {kind: poly, points: [[-2.5, -3.2], [31.3463, -3.2], [31.3463, 0], [-2.5, 0]], y: [-0.4, 0.6]}   # the horizontal bar, its upper edge on the springing line
      - {kind: poly, points: [[3.0, -2.1], [28.9463, -2.1], [28.9463, -0.9], [3.0, -0.9]], y: [-0.45, -0.4], color: "#5c5244"}   # the slot
      - {kind: poly, points: [[0.5, 0], [2.6, 0], [2.6, 0.5], [1.8, 1.4], [0.5, 1.4]], y: [-0.4, 0.4]}   # the fulcrum-piece at the arch bar's foot
      - {kind: poly, points: [[-0.5, -2.6], [0.5, -2.6], [0.5, 0], [-0.5, 0]], y: [-0.6, 0.6], color: "#b89a6a"}   # the arch bar's foot, fixed in the bar at right angles
      - {kind: poly, points: [[-2.4, 0], [-2.2, 0], [-2.2, 22.0232], [-2.4, 22.0232]], y: [0.7, 0.8], color: "#8f8a80"}   # the jamb of the opening
      - {kind: poly, points: [[-0.6, 0], [-0.5, 0], [-0.5, 22.0232], [-0.6, 22.0232]], y: [0.7, 0.8], color: "#8f8a80"}
  - id: slide
    shape: part
    pos: [21.3463, 0, -1.5]
    density: 7800
    color: "#9a948a"
    pieces:
      - {kind: poly, points: [[19.9463, -2.0], [22.7463, -2.0], [22.7463, -1.0], [19.9463, -1.0]], y: [-1.6, -0.45]}   # the slide in the slot (a brass plate)
      - {kind: disc, center: [21.3463, -1.5], radius: 0.3, y: [-1.0, 0.2], color: "#5c5244"}   # its pin, the cord looped on it
  - id: arch0
    shape: part
    pos: [0.0, 0, 0.0]
    mount: bar
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[-0.4953, 0.0681], [-0.223, 2.0495], [0.7677, 1.9133], [0.4953, -0.0681]], y: [-0.6, 0.6]}   # the elastic arch bar, piece by piece
  - id: arch1
    shape: part
    pos: [0.2724, 0, 1.9814]
    mount: arch0
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[-0.2093, 2.1154], [0.327, 4.0422], [1.2904, 3.774], [0.7541, 1.8473]], y: [-0.6, 0.6]}
  - id: arch2
    shape: part
    pos: [0.8087, 0, 3.9081]
    mount: arch1
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[0.3488, 4.1042], [1.133, 5.944], [2.0529, 5.5519], [1.2687, 3.7121]], y: [-0.6, 0.6]}
  - id: arch3
    shape: part
    pos: [1.5929, 0, 5.7479]
    mount: arch2
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[1.1614, 6.0004], [2.1713, 7.7267], [3.0345, 7.2217], [2.0245, 5.4955]], y: [-0.6, 0.6]}
  - id: arch4
    shape: part
    pos: [2.6029, 0, 7.4742]
    mount: arch3
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[2.2046, 7.7765], [3.4139, 9.3695], [4.2104, 8.7649], [3.0011, 7.1719]], y: [-0.6, 0.6]}
  - id: arch5
    shape: part
    pos: [3.8122, 0, 9.0672]
    mount: arch4
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[3.4503, 9.4122], [4.8303, 10.8598], [5.5541, 10.1698], [4.1741, 8.7222]], y: [-0.6, 0.6]}
  - id: arch6
    shape: part
    pos: [5.1922, 0, 10.5148]
    mount: arch5
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[4.8679, 10.8953], [6.3899, 12.1927], [7.0386, 11.4317], [5.5166, 10.1343]], y: [-0.6, 0.6]}
  - id: arch7
    shape: part
    pos: [6.7143, 0, 11.8122]
    mount: arch6
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[6.4269, 12.2214], [8.0637, 13.3708], [8.6384, 12.5524], [7.0016, 11.403]], y: [-0.6, 0.6]}
  - id: arch8
    shape: part
    pos: [8.351, 0, 12.9616]
    mount: arch7
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[8.0987, 13.3932], [9.8252, 14.4027], [10.3299, 13.5394], [8.6034, 12.53]], y: [-0.6, 0.6]}
  - id: arch9
    shape: part
    pos: [10.0776, 0, 13.9711]
    mount: arch8
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[9.857, 14.4198], [11.6518, 15.3022], [12.093, 14.4048], [10.2982, 13.5224]], y: [-0.6, 0.6]}
  - id: arch10
    shape: part
    pos: [11.8724, 0, 14.8535]
    mount: arch9
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[11.6794, 15.3147], [13.5243, 16.0868], [13.9104, 15.1643], [12.0654, 14.3922]], y: [-0.6, 0.6]}
  - id: arch11
    shape: part
    pos: [13.7174, 0, 15.6255]
    mount: arch10
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[13.5471, 16.0956], [15.4275, 16.7767], [15.7681, 15.8365], [13.8876, 15.1554]], y: [-0.6, 0.6]}
  - id: arch12
    shape: part
    pos: [15.5978, 0, 16.3066]
    mount: arch11
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[15.445, 16.7827], [17.3492, 17.3941], [17.6549, 16.442], [15.7507, 15.8306]], y: [-0.6, 0.6]}
  - id: arch13
    shape: part
    pos: [17.5021, 0, 16.9181]
    mount: arch12
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[17.361, 17.3977], [19.2797, 17.9622], [19.5619, 17.0028], [17.6432, 16.4384]], y: [-0.6, 0.6]}
  - id: arch14
    shape: part
    pos: [19.4208, 0, 17.4825]
    mount: arch13
    density: 900
    color: "#b89a6a"
    pieces:
      - {kind: poly, points: [[19.2856, 17.9639], [21.2111, 18.5046], [21.4815, 17.5418], [19.5559, 17.0011]], y: [-0.6, 0.6]}
      - {kind: disc, center: [21.3463, 18.0232], radius: 0.22, y: [-1.2, 0.6], color: "#3a3632"}   # the pencil, at the cord's tie
joints:
  - {id: j_x, type: slide, body: slide, axis: [1, 0, 0], damping: 0.01}   # the hand moving the slide along the slot: the one driven joint
  - {id: j_b0, type: hinge, body: arch0, axis: [0, 1, 0], stiffness: 2.5, springref: -0.1366, damping: 0.01}   # the bar's spring at 0.0 cm from its foot (straight when free)
  - {id: j_b1, type: hinge, body: arch1, axis: [0, 1, 0], stiffness: 2.5, springref: -0.1349, damping: 0.01}   # the bar's spring at 2.0 cm from its foot (straight when free)
  - {id: j_b2, type: hinge, body: arch2, axis: [0, 1, 0], stiffness: 2.5, springref: -0.1314, damping: 0.01}   # the bar's spring at 4.0 cm from its foot (straight when free)
  - {id: j_b3, type: hinge, body: arch3, axis: [0, 1, 0], stiffness: 2.5, springref: -0.1264, damping: 0.01}   # the bar's spring at 6.0 cm from its foot (straight when free)
  - {id: j_b4, type: hinge, body: arch4, axis: [0, 1, 0], stiffness: 2.5, springref: -0.12, damping: 0.01}   # the bar's spring at 8.0 cm from its foot (straight when free)
  - {id: j_b5, type: hinge, body: arch5, axis: [0, 1, 0], stiffness: 2.5, springref: -0.1122, damping: 0.01}   # the bar's spring at 10.0 cm from its foot (straight when free)
  - {id: j_b6, type: hinge, body: arch6, axis: [0, 1, 0], stiffness: 2.5, springref: -0.1034, damping: 0.01}   # the bar's spring at 12.0 cm from its foot (straight when free)
  - {id: j_b7, type: hinge, body: arch7, axis: [0, 1, 0], stiffness: 2.5, springref: -0.0936, damping: 0.01}   # the bar's spring at 14.0 cm from its foot (straight when free)
  - {id: j_b8, type: hinge, body: arch8, axis: [0, 1, 0], stiffness: 2.5, springref: -0.0832, damping: 0.01}   # the bar's spring at 16.0 cm from its foot (straight when free)
  - {id: j_b9, type: hinge, body: arch9, axis: [0, 1, 0], stiffness: 2.5, springref: -0.0721, damping: 0.01}   # the bar's spring at 18.0 cm from its foot (straight when free)
  - {id: j_b10, type: hinge, body: arch10, axis: [0, 1, 0], stiffness: 2.5, springref: -0.0606, damping: 0.01}   # the bar's spring at 20.0 cm from its foot (straight when free)
  - {id: j_b11, type: hinge, body: arch11, axis: [0, 1, 0], stiffness: 2.5, springref: -0.0488, damping: 0.01}   # the bar's spring at 22.0 cm from its foot (straight when free)
  - {id: j_b12, type: hinge, body: arch12, axis: [0, 1, 0], stiffness: 2.5, springref: -0.0368, damping: 0.01}   # the bar's spring at 24.0 cm from its foot (straight when free)
  - {id: j_b13, type: hinge, body: arch13, axis: [0, 1, 0], stiffness: 2.5, springref: -0.0246, damping: 0.01}   # the bar's spring at 26.0 cm from its foot (straight when free)
  - {id: j_b14, type: hinge, body: arch14, axis: [0, 1, 0], stiffness: 2.5, springref: -0.0123, damping: 0.01}   # the bar's spring at 28.0 cm from its foot (straight when free)
cords:
  - id: cord
    from: {body: slide, at: [21.3463, 0, -1.5]}
    to: {body: arch14, at: [21.3463, 0, 18.0232]}
    links: 25
    segments: 1
    root_damping: 0.0001
    joint_armature: 1e-06
    thickness: 0.2
    density: 5000
    stiffness: 60000
    pretension: 1.6
    damping: 2
    bend_damping: 1e-06
    color: "#7a4f2a"
driver: {joint: j_x, kind: velocity, rpm: 0, swing: {amplitude: 0.06, hz: 0.3}, kv: 800, max_torque: 30}
checks:
  - {type: follow, out: j_b0, in: j_x, expect: 0.191, tol: 0.019, min_r2: 0.98, settle_s: 1.0, window_s: 6}   # the bar bends at its foot as the cord lets it: 0.191 rad/m solved quasi-statically for this bar, r2 0.989 there (gen407.py)
  - {type: amplitude, joint: j_x, min: 0.02, max: 0.08, sustain: 0.7, settle_s: 1.0, window_s: 6}   # the slide moved well along the slot
camera: {target: [11.6731, 0, 5.0116], position: [11.6731, -80, 5.0116], fov: 34}
display:
  output: j_b0
  labels: {j_x: "The slide in the slot (driver)", j_b0: "Arch bar bending at its foot", j_b7: "Arch bar bending midway"}
