hexagon logo

Turning Off Force without use of Sensor/SUBS

I have a large number of non-linear springs (force as function of displacement) in a large model. These spring forces, whether from a spline or simple functions, go to 0 force after a certain displacement is reached. What I want to ensure is that the force stays 0 from the point the two bodies reach the prescribed distance, and cannot ramp back up if the two bodies come within the displacement again (this is possible in the model). I do not want to use sensors because there would be 100+ sensors in the model nor do I know the order of the spring releases to deactivate the sensors once tripped; I would also like to avoid subroutines for simplicity's sake. Is there an easy way to prevent this force from activating again with some kind of flag/check/clever function?
  • This can be accomplished by using differential equations as triggers. Attached is a small example that deactives GFORCEs based on the force magnitude. Open it and run a 5 sec 500 steps simulation. Each GFORCE will here become zero as soon as it reaches a magnitude of 50N. Diff equations are used to check the force limit.
    Diff equation:
    if (mag_force_in_gforce < force_limit)
      dy/dt = 0
    else
      dy/dt=1
    end
     
    As long as the force limit is not reached, the derivative dy/dt is zero, and the solution of the diff equation stays zero.
    When the force goes beyond the limit the derivative dy/dt is set to 1, and the solution of the diff equation starts to be greater than zero.
    So by checking the solution of the diff equation we can determine if the force has exceeded its limit and multiply the GFORCE by zero. This will effectively “deactivate” the force.
     
    In your case, use a displacement instead as the trigger.

    Attached Files (1)
  • What's the problem in modifying the springs force equation ?
    just use
    function = (if(DM(i,j)<treshold: (DM(i,j)-initial_length)*stifffness,(DM(i,j)-initial_length)*stifffness,0)
     
    Of the "softer" way with a step function:
    finction = step( DM(i,j),treshold,DM(i,j)-initial_length)*stifffness,treshold+0.01,0)
  • With that approach the spring force will come back to life again if the distance is less than the threshold.
    Using the diff equation approach the spring force will stay zero even if the distance becomes less than the threshold again.
  • Fredrik,
    Thank you very much, that is exactly what I was after! I actually use DIFFS, VARS and SENSORS in different models to 'latch' times and turn things off, but did not extrapolate that basic usage of DIFFS in this application.
  • My bad - I should read more carefully and you're completely right.
     
    If it shouldn't turn on again, I may would try the DELAY() function.
    Something with if time > x and the force history contained a value < treshold, then spring function is active, otherwise zero.
    But at the end this is just a different way of introducing diff's as DELAY is using them "under the hood".