Can we deactivate a motor during simulation? I'm running the simulation through an ACF file and would like to deactivate the motor once a sensor gets triggered.
Can we deactivate a motor during simulation? I'm running the simulation through an ACF file and would like to deactivate the motor once a sensor gets triggered.
There is a couple of ways of doing this. I assume that your motor is modeled as an SForce, producing a torque.
The "classic way" would be to simply define the sensor as a stop-and-go action (return to command level). Then your acf would look something like this:
sim/tra, end=42, dtout=0.025
decativate/sforce, id=991
sim/tra, end=42, dtout=0.025
I.e. start the simulation. When the sensor stops the current level, deactivate the sforce and continue to the end-time. You might also have to deactivate the sensor itself.
A more "modern" approach is to use the sensor evaluation value (SENVAL). In this case, you don't have to do anything in the acf.
Multiply your sforce function with (1-SENVAL(sensor_name))
Define the sensor evaluate function = 1.
Before the sensor is triggered the first time, the SENVAL function returns 0. Once the sensor triggered and evaluated, the function returns 1. In other words, before the sensor is triggered, your sforce is (1-0)*function(). After the sensor triggered, the sforce function is (1-1)*function().
Thanks @Jesper Slattengren. I'm using the Adams Machinery plugin-based motor with a curve-based input. So, I do not think I can access the motor SForce from the ACF. But your answer got me thinking about the fact that I can use an SForce instead of the plugin-based motor since I'm using a curve of Torque vs RPM anyway. I think that is how it would be modelled internally in the plugin-based motor as well (unless it is an analytical/external motor).
Also, I realized that there is an option to multiply the motor output with a factor/expression within the plugin, which I can appropriately use.
You can access the sforce from the acf, no matetr which tool it is modeled in. It might just be a bit more complicated to find the ID number. But export an adm-file and you will be able to find it. Adams/Solver does not know much about toolkits or UDE. But there is the likelihood that by deactivating the joint, you will break something else (requests, variables or other things depending on the sforce) and then you have to deactivate them too.