At X time step enable a torque load on a rotary joint which varies with the angular displacement (for example 0Deg = 1Nm, 10Deg = 3Nm, 20Deg = 2Nm, 30Deg = 0.5Nm, I have complete torque vs angular displacement graphs to input in reality) then at time step Y turn this load off allowing the component to return to its starting position by means of another external load which is constantly applied (EG a spring force).
I can easily apply a torque VS time load as is mentioned below, and I can put a torque vs angular displacement load onto a rotary joint however I cannot disable this load to allow the component to return to its home state.
Solution
I created a torque that varies with the rotation angle. That also depends on time. After a defined time its value goes to zero.
Please carefully analyze the formula into torque T001.
the formula that defines its value is:
IF(time-t_stop:IF(AZ(J002_i,J002_j)-10:1+0.2*AZ(J002_i,J002_j),1+0.2*AZ(J002_i,J002_j),IF(AZ(J002_i,J002_j)-20:3-0.1*(AZ(J002_i,J002_j)-10),3-0.1*(AZ(J002_i,J002_j)-10),2-0.15*(AZ(J002_i,J002_j)-20))),0,0)
The "IF" functions requires 4 parameters.
the first is the condition, the following are the values returned if the condition is below, equal or above zero.
First one is about time: "time-t_stop" time is the independent variable of the solver, t_stop is a user defined variable to set the time when the torque must go to zero.
the following three parameters refer to values of "time-t_stop" below zero, equal to zero and above zero.
So if "time-t_stop" < 0 then the angle value is checked: IF(AZ(J002_i,J002_j)-10, where AZ(J002_i,J002_j) is the angle value of the link on which the torque is applied. If the angle is below 10 degres (that is AZ(J002_i,J002_j)-10 < 0) then the torque value is:1+0.2*AZ(J002_i,J002_j). If the angle is equal to ten, again, the value is 1+0.2*AZ(J002_i,J002_j).
if the angle is above 10 the a new check is performed: IF(AZ(J002_i,J002_j)-20. If the angle is below 20 degres (that is AZ(J002_i,J002_j)-20 < 0) then the torque value is:3-0.1*(AZ(J002_i,J002_j)-10). If the angle is equal to zero, again, the value is 3-0.1*(AZ(J002_i,J002_j)-10). If no other check is satisfyed, that means that the angle is above 20 degress and the torque value is 2-0.15*(AZ(J002_i,J002_j)-20)).
If time is equal or above t_stop, the torque value is zero.
Notes