Presentation is loading. Please wait.

Presentation is loading. Please wait.

SECTION 1 ADAMS/Solver subroutines overview

Similar presentations


Presentation on theme: "SECTION 1 ADAMS/Solver subroutines overview"— Presentation transcript:

1 SECTION 1 ADAMS/Solver subroutines overview
Example body page using the Section Header layout, shows correct fonts. Course information shown in the footer needs to be updated for your particular class on the Slide Master. (View tab, Slide Master in Presentation Views group)

2 WHAT IS IN THIS SECTION Why use subroutines?
Incorporation into a model Running Adams with a custom library

3 WHY USE SUBROUTINES Subroutines are used to override the standard functionality in Adams/Solver. Examples of such situations include: Implementing complex logic that might be difficult using Adams/Solver function expressions Incorporating existing code for specialty mechanical elements Example – a mature control system created for vehicle handling control Including proprietary mechanical elements Example – equations for a proprietary spring-damper system can be ‘hidden’ within a subroutine and distributed safely to others When you need to interact with other software or complex data files

4 INCORPORATING INTO A MODEL
The Adams model must be set up properly so that Adams/Solver knows to use user-written code for the particular element(s). The Adams/Solver manual shows the following syntax for many of the statements in an Adams/Solver dataset (.adm) file: where: e refers to an expression using Adams/Solver built-in function expressions, for example: STEP(time,1,0,10,10) USER()indicates that the Solver must call a provided user-written subroutine for this element. For example, if you had a subroutine that expected to be passed a spring constant followed by a damper constant then the expression might be: USER(120.0,10.1) where the spring and damper constants are and 10.1 respectively. The input parameters can be anything that is defined by the user-written subroutine.

5 INCORPORATING INTO A MODEL (CONT.)
Here is an example of a single component force element statement in an Adams/Solver dataset that uses standard function expressions: SFORCE/1, TRANSLATIONAL, I=10, J=11, ACTIONONLY, FUNCTION= STEP(TIME,0,0,12.5,200) This same SFORCE element could be instructed to calculate its value from a user-written subroutine if it was rewritten as: SFORCE/1, TRANSLATIONAL, I=10, J=11, ACTIONONLY, FUNCTION= USER(120,10.1) Adams/View has a toggle for most function expression fields that lets one use either standard function expressions or user-written code. The Define Using field for most elements in Adams/View has the options Subroutine and Function.

6 RUNNING ADAMS WITH A CUSTOM LIBRARY
Specifying a user-written subroutine in the model file lets Adams/Solver know to look for a user library which calculates values User-written code libraries are typically stored in files of type: .dll (dynamically linked/loaded library) on Windows .so (shared object) on Linux This user library must be specified before running a simulation There are three ways to specify an Adams/Solver user library before running a simulation. They are detailed in the following table. Product Specification Notes Adams/Solver adams2013 ru-user library_name.dll Start with ‘ru-user’ flag and specify a library to use Adams/View Settings → Solver → Solver Executable Set ‘Solver Library’ field in this dialog box adams2013 aview ru-user i -n library_name.dll Start View with ‘ru-user’, specify a Solver library but not a View library

7 RUNNING ADAMS WITH A CUSTOM LIBRARY
For example: adams2013 ru-user mysolver.dll run_commands.acf Would run Adams/Solver from the command line on Windows, using Adams v2013 The custom library mysolver.dll would be loaded at runtime The run_commands.acf file would specify the Solver commands needed to exercise the model

8 EXERCISE Perform Workshop 1 “Custom Tire Subroutine” in your exercise workbook


Download ppt "SECTION 1 ADAMS/Solver subroutines overview"

Similar presentations


Ads by Google