# No. 468 (Brown 1868): "Flexible water main, plan and section. Two pipes of 15 and 18 inches interior diameter, having some of their
# joints thus formed, conduct water across the Clyde to Glasgow Water-works. Pipes are secured to strong log frames, having hinges with
# horizontal pivots. Frames and pipes were put together on south side of the river, and, the north end of pipe being plugged, they were
# hauled across by machinery on north side, their flexible structure enabling them to follow the bed."
# Model (cm, gravity on, the section seen from upstream: south on the left). 6 log frames, each 9 cm long with its length of pipe
# fastened on it, are hinged end to end with horizontal pivots, and lie put together on the south bank, the north end of the pipe
# plugged. A rope from the leading frame's eye runs over a sheave on the north bank to the hauling carriage, which the machinery draws
# along the bank at 6 cm/s (the only drive). The frames are hauled down the south bank, along the river's bed and up the north
# bank, each one free on its pivots so the main lies on the bed as it goes. The frames' weight and the ground's contact and friction
# are all that shape it. The river's water is left out: it does nothing to the hauling here. Generator: opencode-runs/water/gen468.py.
number: 468
slug: flexible-water-main
name: Flexible water main, plan and section
brown: "Flexible water main, plan and section. Two pipes of 15 and 18 inches interior diameter, having some of their joints thus formed, conduct water across the Clyde to Glasgow Water-works. Pipes are secured to strong log frames, having hinges with horizontal pivots. Frames and pipes were put together on south side of the river, and, the north end of pipe being plugged, they were hauled across by machinery on north side, their flexible structure enabling them to follow the bed."
units: cm
sim:
  timestep: 0.0005
  integrator: implicitfast
  iterations: 60
  duration_s: 14
  floor: false
bodies:
  - id: cx
    shape: part
    pos: [-30.5, 0, 12.52]
    mass: 0.01
    color: "#4f4a43"
    pieces:
      - {kind: rod, from: [-30.7, 0, 12.52], to: [-30.3, 0, 12.52], radius: 0.05, collide: 0}
  - id: cz
    shape: part
    mount: cx
    pos: [-30.5, 0, 12.52]
    mass: 0.01
    color: "#4f4a43"
    pieces:
      - {kind: rod, from: [-30.7, 0, 12.52], to: [-30.3, 0, 12.52], radius: 0.05, collide: 0}
  - id: f1
    shape: part
    mount: cz
    pos: [-30.5, 0, 12.52]
    mass: 2
    color: "#8b6a44"
    pieces:
      - {kind: loft, a: [[-39.35, -2, 13.02], [-30.65, -2, 13.02], [-30.65, 2, 13.02], [-39.35, 2, 13.02]], b: [[-39.35, -2, 12.02], [-30.65, -2, 12.02], [-30.65, 2, 12.02], [-39.35, 2, 12.02]], collide: 1, color: "#8b6a44"}
      - {kind: rod, from: [-39.2, 0, 14.32], to: [-30.8, 0, 14.32], radius: 1.3, collide: 0, color: "#4f4a43"}
      - {kind: rod, from: [-39.2, 0, 14.32], to: [-38.6, 0, 14.32], radius: 1.55, collide: 0, color: "#3f3a33"}
      - {kind: rod, from: [-30.5, -2.3, 12.52], to: [-30.5, 2.3, 12.52], radius: 0.35, collide: 0, color: "#3f3a33"}
      - {kind: rod, from: [-30.8, 0, 14.32], to: [-30.1, 0, 14.32], radius: 1.5, collide: 0, color: "#c8781e"}
  - id: f2
    shape: part
    mount: f1
    pos: [-39.5, 0, 12.52]
    mass: 2
    color: "#8b6a44"
    pieces:
      - {kind: loft, a: [[-48.35, -2, 13.02], [-39.65, -2, 13.02], [-39.65, 2, 13.02], [-48.35, 2, 13.02]], b: [[-48.35, -2, 12.02], [-39.65, -2, 12.02], [-39.65, 2, 12.02], [-48.35, 2, 12.02]], collide: 1, color: "#8b6a44"}
      - {kind: rod, from: [-48.2, 0, 14.32], to: [-39.8, 0, 14.32], radius: 1.3, collide: 0, color: "#4f4a43"}
      - {kind: rod, from: [-48.2, 0, 14.32], to: [-47.6, 0, 14.32], radius: 1.55, collide: 0, color: "#3f3a33"}
      - {kind: rod, from: [-39.5, -2.3, 12.52], to: [-39.5, 2.3, 12.52], radius: 0.35, collide: 0, color: "#3f3a33"}
  - id: f3
    shape: part
    mount: f2
    pos: [-48.5, 0, 12.52]
    mass: 2
    color: "#8b6a44"
    pieces:
      - {kind: loft, a: [[-57.35, -2, 13.02], [-48.65, -2, 13.02], [-48.65, 2, 13.02], [-57.35, 2, 13.02]], b: [[-57.35, -2, 12.02], [-48.65, -2, 12.02], [-48.65, 2, 12.02], [-57.35, 2, 12.02]], collide: 1, color: "#8b6a44"}
      - {kind: rod, from: [-57.2, 0, 14.32], to: [-48.8, 0, 14.32], radius: 1.3, collide: 0, color: "#4f4a43"}
      - {kind: rod, from: [-57.2, 0, 14.32], to: [-56.6, 0, 14.32], radius: 1.55, collide: 0, color: "#3f3a33"}
      - {kind: rod, from: [-48.5, -2.3, 12.52], to: [-48.5, 2.3, 12.52], radius: 0.35, collide: 0, color: "#3f3a33"}
  - id: f4
    shape: part
    mount: f3
    pos: [-57.5, 0, 12.52]
    mass: 2
    color: "#8b6a44"
    pieces:
      - {kind: loft, a: [[-66.35, -2, 13.02], [-57.65, -2, 13.02], [-57.65, 2, 13.02], [-66.35, 2, 13.02]], b: [[-66.35, -2, 12.02], [-57.65, -2, 12.02], [-57.65, 2, 12.02], [-66.35, 2, 12.02]], collide: 1, color: "#8b6a44"}
      - {kind: rod, from: [-66.2, 0, 14.32], to: [-57.8, 0, 14.32], radius: 1.3, collide: 0, color: "#4f4a43"}
      - {kind: rod, from: [-66.2, 0, 14.32], to: [-65.6, 0, 14.32], radius: 1.55, collide: 0, color: "#3f3a33"}
      - {kind: rod, from: [-57.5, -2.3, 12.52], to: [-57.5, 2.3, 12.52], radius: 0.35, collide: 0, color: "#3f3a33"}
  - id: f5
    shape: part
    mount: f4
    pos: [-66.5, 0, 12.52]
    mass: 2
    color: "#8b6a44"
    pieces:
      - {kind: loft, a: [[-75.35, -2, 13.02], [-66.65, -2, 13.02], [-66.65, 2, 13.02], [-75.35, 2, 13.02]], b: [[-75.35, -2, 12.02], [-66.65, -2, 12.02], [-66.65, 2, 12.02], [-75.35, 2, 12.02]], collide: 1, color: "#8b6a44"}
      - {kind: rod, from: [-75.2, 0, 14.32], to: [-66.8, 0, 14.32], radius: 1.3, collide: 0, color: "#4f4a43"}
      - {kind: rod, from: [-75.2, 0, 14.32], to: [-74.6, 0, 14.32], radius: 1.55, collide: 0, color: "#3f3a33"}
      - {kind: rod, from: [-66.5, -2.3, 12.52], to: [-66.5, 2.3, 12.52], radius: 0.35, collide: 0, color: "#3f3a33"}
  - id: f6
    shape: part
    mount: f5
    pos: [-75.5, 0, 12.52]
    mass: 2
    color: "#8b6a44"
    pieces:
      - {kind: loft, a: [[-84.35, -2, 13.02], [-75.65, -2, 13.02], [-75.65, 2, 13.02], [-84.35, 2, 13.02]], b: [[-84.35, -2, 12.02], [-75.65, -2, 12.02], [-75.65, 2, 12.02], [-84.35, 2, 12.02]], collide: 1, color: "#8b6a44"}
      - {kind: rod, from: [-84.2, 0, 14.32], to: [-75.8, 0, 14.32], radius: 1.3, collide: 0, color: "#4f4a43"}
      - {kind: rod, from: [-84.2, 0, 14.32], to: [-83.6, 0, 14.32], radius: 1.55, collide: 0, color: "#3f3a33"}
      - {kind: rod, from: [-75.5, -2.3, 12.52], to: [-75.5, 2.3, 12.52], radius: 0.35, collide: 0, color: "#3f3a33"}
  - id: carriage
    shape: part
    pos: [58, 0, 14]
    mass: 1
    color: "#5f5a52"
    pieces:
      - {kind: loft, a: [[55, -2.5, 15.6], [61, -2.5, 15.6], [61, 2.5, 15.6], [55, 2.5, 15.6]], b: [[55, -2.5, 12.8], [61, -2.5, 12.8], [61, 2.5, 12.8], [55, 2.5, 12.8]], collide: 0, color: "#5f5a52"}
      - {kind: rod, from: [56, -2.8, 13.6], to: [56, 2.8, 13.6], radius: 0.8, collide: 0}
      - {kind: rod, from: [60, -2.8, 13.6], to: [60, 2.8, 13.6], radius: 0.8, collide: 0}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#d6cdb8"
    pieces:
      - {kind: loft, a: [[-88, -6, 0], [-88, -6, 12], [-30, -6, 12], [-30, -6, 0]], b: [[-88, 10, 0], [-88, 10, 12], [-30, 10, 12], [-30, 10, 0]], collide: 2, color: "#9b8a6a"}
      - {kind: loft, a: [[-30, -6, 0], [-30, -6, 12], [-15, -6, 0]], b: [[-30, 10, 0], [-30, 10, 12], [-15, 10, 0]], collide: 2, color: "#9b8a6a"}
      - {kind: loft, a: [[-16, -6, -3], [-16, -6, 0], [16, -6, 0], [16, -6, -3]], b: [[-16, 10, -3], [-16, 10, 0], [16, 10, 0], [16, 10, -3]], collide: 2, color: "#9b8a6a"}
      - {kind: loft, a: [[15, -6, 0], [30, -6, 12], [30, -6, 0]], b: [[15, 10, 0], [30, 10, 12], [30, 10, 0]], collide: 2, color: "#9b8a6a"}
      - {kind: loft, a: [[30, -6, 0], [30, -6, 12], [142, -6, 12], [142, -6, 0]], b: [[30, 10, 0], [30, 10, 12], [142, 10, 12], [142, 10, 0]], collide: 2, color: "#9b8a6a"}
      - {kind: loft, a: [[-88, -6, -3], [142, -6, -3], [142, 10, -3], [-88, 10, -3]], b: [[-88, -6, -5], [142, -6, -5], [142, 10, -5], [-88, 10, -5]], collide: 0, color: "#7d6e52"}
      - {kind: rod, from: [52, -2.5, 15], to: [52, 2.5, 15], radius: 0.4, collide: 0, color: "#5f5a52"}
      - {kind: loft, a: [[51.2, 2.6, 15.5], [52.8, 2.6, 15.5], [52.8, 3.6, 15.5], [51.2, 3.6, 15.5]], b: [[51.2, 2.6, 12], [52.8, 2.6, 12], [52.8, 3.6, 12], [51.2, 3.6, 12]], collide: 0, color: "#5f5a52"}
      - {kind: loft, a: [[56, 3, 12.8], [138, 3, 12.8], [138, 4, 12.8], [56, 4, 12.8]], b: [[56, 3, 12], [138, 3, 12], [138, 4, 12], [56, 4, 12]], collide: 0, color: "#6d675c"}
joints:
  - {id: j_x, type: slide, body: cx, axis: [1, 0, 0], damping: 0.01}
  - {id: j_z, type: slide, body: cz, axis: [0, 0, 1], damping: 0.01}
  - {id: j_1, type: hinge, body: f1, axis: [0, 1, 0], damping: 0.05}
  - {id: j_2, type: hinge, body: f2, axis: [0, 1, 0], range: [-1.2, 1.2], damping: 0.05}
  - {id: j_3, type: hinge, body: f3, axis: [0, 1, 0], range: [-1.2, 1.2], damping: 0.05}
  - {id: j_4, type: hinge, body: f4, axis: [0, 1, 0], range: [-1.2, 1.2], damping: 0.05}
  - {id: j_5, type: hinge, body: f5, axis: [0, 1, 0], range: [-1.2, 1.2], damping: 0.05}
  - {id: j_6, type: hinge, body: f6, axis: [0, 1, 0], range: [-1.2, 1.2], damping: 0.05}
  - {id: j_c, type: slide, body: carriage, axis: [1, 0, 0], range: [-1, 100], damping: 0.1}
ropes:
  - {id: haul, from: {body: f1, at: [-30.1, 0, 14.32]}, over: {center: [52, 0, 15], radius: 1.5, axis: y, side: [52, 0, 17.5]}, to: {body: carriage, at: [55, 0, 14.2]}, width: 0.7, thickness: 0.7, color: "#3a2616"}

driver: {joint: j_c, kind: velocity, speed: 6, kv: 3000, max_torque: 400}
checks:
  - {type: position, joint: j_x, settle_s: 12.8, window_s: 1.0, min: 45, max: 90}
  - {type: penetration, max: 0.01}
camera: {target: [25, 0, -8], position: [25, -500, 17], fov: 16}
display:
  output: j_x
  labels: {j_c: "Hauling carriage (driver)", j_x: "Leading frame", j_1: "Frame 1", j_2: "Frame 2"}
