hexagon logo

How can I trigger an external action from within the driver control file?

Hello,
 
I want to trigger an action from within the driver control files that is not an standard output (throttle/steering/clutch etc). Basically I want to do some minimaneuvers to achieve a certain vehicle state, then activate a parking lock torque in the gearbox, then deactivate it and continue the simulation.
 
Of course I could use some STEP(time) functions in the torque expression to activate the torque at the right moment, but that solution wouldn't be general for different driver control files . Any ideas on how to trigger such an action from within the driver control file?
 
Thanks
/Oskar
 
 
 
 
 
 
 
  • Unfortunately you cannot do this as you would like .
    Several customers are asking for this, (in artifact ADMS-52087), and it seems like we are getting some traction on this, but do not take this as a promise!
    Unfortunately I do not think the minimaneuver_id is available as a variable either (just as a request), as that would be a nice workaround. So for now you are pretty left out with just time or other variables to change a variable or to trigger a sensor.
    Regards
    Thomas
  • You can create torque at spindle joint and in acf you activate/deactivate based on simulation time
  • @Ravichandra Gobbur​ , In ADAMS/Car do you not have access to the acf-file the same way as you do in a regular solver simulation. There is no easy way to stop/restart a run/
  • You create torque and activation/deactivation can be done by using .cmd file.
     
    Let me know which event you are doing.
  • Actually r.gobbur has got a point.
     
    You could replace the EventAll with acouple of EventRunNext in the acf then insert commands to activate/deactivate the torque. Manual work, but a valid workaround.
    When thought about, it is even possible to do it automatically with the use of a mac_ana_ful_sub_custom_pos macro (but that would only work for files_only analyses).
     
    Regards
    Thomas
  • Another thought would be saving your runs files after attaining required state and performing activation/deactivation of torques of interest
    Then you can resume your run from that state
     
    You can help document from MSC simcompanion
     
    Hope this helps
  • I'd like to avoid all solutions where manual editing of the .acf file done since all our simulations are automatically generated. My idea was (as Thomas mentioned) to try to get hold of the name of the minimanouver by calling some varsub routine. I could then match the manouver name (or id or something similar) from the variable , then latch some variables and step up a locking torque. This would avoid any manual work in the .acf files and would work for any driver control file.
     
    However if there is no routine that can get hold of this info from the driver control file, I guess the next best thing is to modify the .acf file with EventRunNext  and an activate command for the torque. Maybe I can call a script with the --pre command that rewrites the .acf based on event type
     
    @Thomas Nygards​ I couldn't find any mac_ana_ful_sub_custom_pos under the ACAR library?
  • @Oskar Jonson​  That is actually expected.
    It is the name of a macro that the user can create. If will be executed at a custom macro entry point and they exist in several places in the acar code. in the actual example at the "post" step of the execution of the macro mac_ana_ful_sub.
    So if you need something custom run at such a point then you just create a macro with a specific name (eg. mac_ana_ful_sub_custom_pos) anywhere in the database (and add it to site or plugin for ease of use)!
    Look at the macro  .acar.macros.mac_ana_ful_sub to see in the file generation process when and how it is called.
    Then you will also see that the macro should take the parameters:
    assembly
    analysis_mode
    analysis_name
    simulation_type
    (all can be strings but maybe better if : model, string, string, string) Important is also to add a user entered command to it as it cannot be empty/"use macro name".
    Note that your macro, once created, will be called for all full vehicle simulations (in this case), so be sure to insert a an appropriate if statement in the macro to only do the modifications for simulations/models which needs them to be done.
     
    The other option is as you say to change the acf file with your cluster submission script (which I guess you mean with the --pre command) depending on the analysis type. That might be easier in some cases, but unless you want to hardcode it, you have to look up the id of the torque. This can of course be done in many ways, but if not done in adams it might require some adm text processing to be on the safe side.
     
    Regards
    Thomas
  • How about introducing a new gear like -2 and trigger upon value of gear_demand ?
    That'd add a single maninimaneuver for your parking brake where you set gear_demand to -2 and you're done.
     
    Another one would be to add the parking brake trigger to the brake system and donate a speed sensor.
    Algo would be like "If speed is below threshold and brake_demand is > 0, then apply parking brake" and the inserted mini-maneuver would simply be something like zero speed and brake demand set to 100.