Obstacle.mo 374 B

12345678910111213
  1. model Obstacle
  2. parameter Real c = 1e10;
  3. parameter Real fixed_x = 0.45;
  4. input Real disp;
  5. output Real reaction_force;
  6. Real compression;
  7. equation
  8. compression = disp - fixed_x;
  9. reaction_force = if disp > fixed_x then c * compression else 0;
  10. annotation(
  11. experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002));
  12. end Obstacle;