title: How to programmatically enforce this equation
body: <p>I'm trying to simulate vehicle power-train using component block and connectors like modelling software does. So I can connect flywheel to clutch, clutch to gearbox, gearbox to differential, differential to shaft, and shaft to wheel.</p>
  
  <p>A gear component in OpenModelica has this equation:</p>
  
  <p><code>0 = ratio * flange_a.tau + flange_b.tau</code></p>
  
  <p>Tau is a flow type variable for torque. Torque can flow from flywheel down to wheel, and from wheel back to the engine.</p>
  
  <p>My question is how to programmatically enforce this equation. So I can have flange_a.tau carrying torque from the engine and flange_b.tau carrying reaction torque from the wheels and still satisfy the equation.</p>
  
  <p>As programming is assignment based, if I do</p>
  
  <p><code>flange_b.tau = -ratio * flange_a.tau</code></p>
  
  <p>it satisfies the equation but overwrite the reaction torque from the wheel.</p>
  
  <p>I hope this make sense.</p>