Welcome to Adams/Mechatronics

About Adams/Mechatronics
Adams/Mechatronics is a plug-in to Adams which can be used to easily incorporate control systems into mechanical models. Adams/Mechatronics has been developed based on the Adams/Controls functionality and contains modeling elements which transfer information to/from the control system. For example, using Adams/Mechatronics in Adams/Car, you can quickly create assemblies of vehicle systems including control systems, and then analyze them to understand their performance and behavior. Using Adams/Mechatronics you can create control systems with different level of complexity. You can use function builder to build a simple control function. If you have your control system defined in a control package such as Easy 5 or Matlab/Simulink, then you can perform a co-simulation between mechanical model defined in Adams and control system defined in the control package. Alternatively, you can generate the control system code as a dynamic link library file (a dll file in Windows, also known as external system library or simply ESL file in Adams/Mechtronics) using the control package and then do all calculations with Adams. You will also be able to include control system parameters in a design study in Adams/Insight for simultaneous optimization of both control system and mechanical system. Furthermore, you will be able to switch the control code in the model by selecting ESL (external system library) property files which refer to different ESL files. You can, for instance, use Adams/Mechatronics together with Adams/Car to:
• Tune both control parameters and suspension/driveline parameters to optimize shunt-and-shuffle

phenomena
• Investigate the influence of active damping control on the forces in the suspension components

or body structure
• Validate your complete vehicle model including control system with a corresponding model for

Hardware-In-The-Loop studies Based on the analysis results, you can quickly adjust the chassis characteristics or control parameters and redo the analysis to evaluate the effects of the adjustment. For example, you can quickly change control code to investigate the best handling characteristics for your vehicle. Once you complete the analysis of your model, you can easily share your work with others. You can also create different plots of the controller input/output signals and vehicle dynamic responses. In addition, you can access other users' models without overwriting their data.

Benefits of Adams/Mechatronics
Adams/Mechatronics enables you to work faster and smarter with control systems, facilitate understanding the effects of design change in the controls systems and mechanical system on total system performance.

2 Adams/Mechatronics

From a modeling perspective, Adams/Mechatronics has following benefits: • A control system has to be setup and coupled to mechanical system only once
• Control systems and control signals are handled as components among others • The model can easily be used by different users, including those who are not familiar with the

control systems
• Automatic signal unit conversions • Easy to connect transducer and actuator signals to the control systems • Overview and modify the control system input and output specifications

Model and Data Reuse
A key benefit of using Adams/Mechatronics is that it shares data and simulation components of control system with Adams. This means that complete system-level optimization becomes easier for complex problems such as shunt-and-shuffle, ABS impact on ride/judder, etc. For instance, you can load the Adams/Car assembly containing a control system as any other assembly, without having to perform several manual tasks to run the coupled simulation. In addition, Adams/Mechatronics includes a Signal Manager for setting up the connection (transducer and actuator signals) between the mechanical system and the control systems. The settings you choose in the Signal Manager are automatically saved with the subsystems of the assembly, so that the next time the assembly is opened, no further settings are needed before submitting the simulation.

Starting Adams/Mechatronics
Because Adams/Mechatronics is a plug-in to Adams, you first start Adams and then load Adams/Mechatronics. In Windows, you start Adams/Car or Adams/View from the start menu. For more information, see
Starting Adams/Car or Starting Adams/View.

In UNIX, you start Adams/Car or Adams/View from the Adams Toolbar. For information on the Adams Toolbar, see Running and Configuring Adams. To start Adams/Mechatronics: 1. Start Adams/Car or Adams/View as explained in respective documentation 2. From the Tools menu, select Plug-in Manager 3. Find Adams/Mechatronics in plug-in list, and then select one or both of the following options
• Load: loads Adams/Mechatronics in the current session • Load at Startup: instructs Adams to load Adams/Mechatronics in all future Adams

sessions 4. Select OK

Welcome to Adams/Mechatronics 3

Adams/Mechatronics will be loaded into Adams. The Adams interface now includes Mechatronics menu in last position. Please also note that the Mechatronics plug-in will load automatically if you open an assembly which refers to a subsystem which contains a control system related object.

File Architecture in Adams/Mechatronics
In Adams/Car case, figure below shows the database table directories in the shared database of Adams/Mechatronics.

Note that:
• external_system_libraries.tbl contains property files related to external system files generated by

control software like Matlab/Simulink and Easy5
• disturbance_files.tbl contains property files containing control signal disturbance data in ASCII,

RPCIII or DAC format In Adams/View case, as there is no database table, dynamic link file is stored in a user-specified target folder.

4 Adams/Mechatronics

Learning the Basics

6 Adams/Mechatronics

Basic Concepts in Adams/Mechatronics
Here the basic components and terms used in Adams/Mechatronics are briefly described.
• Transducer Signal • Actuator Signal • Control System • Control System Input • Control System Output • Mechanical System • Signal Manager • External System Library (ESL)

While the picture below illustrates how the (transducer and actuator) signals from the mechanical systems are connected to the control systems via the control system inputs/outputs, we will try to describe each term.

Learning the Basics 7

Transducer Signal Transducer signals are used to measure a certain signal from an arbitrary location of the mechanical system. For example, it can measure the rotational velocity of a wheel or the instantaneous brake pressure. The measured signal is sent to the control system via the control system input. Actuator Signal Actuator signals are used to transfer the output from the control system to the mechanical system. For example, the actuator signal could be a brake pressure of an ABS control system, which would be used in the force expressions of the brake model in the mechanical system. Typically in Adams/Car, you would

8 Adams/Mechatronics

create a point torque actuator in the template builder and in the function expression refer to the actuator signal. Note:

it is important to pay attention to difference between following terms: the Actuator Signal which is an Adams/Mechatronics component and Actuators which is an Adams/Car component.

Control System A Control System in the context of Adams/Mechatronics is an object which contains information about the type of controller, the number of input channels and output channels, etc. Control System Input Control system inputs are created when you create a control system. The number of inputs specified for the control system will determine the number of control system input objects that are auto-created. Using the Signal Manager, you can hook up the appropriate transducer signal (or other control system output) to the corresponding control system input. Since the control system inputs are always automatically created, you can only perform Modify operations on them. Control System Output Control system outputs are created when you create a control system. The number of outputs specified for the control system will determine the number of control system output objects that are auto-created. Using the Signal Manager, you can hook up the appropriate control system output to the corresponding actuator signal. Since the control system outputs are always automatically created, you can only perform Modify operations on them. Mechanical System In Adams/Mechatronics the mechanical system refers to the mechanical model excluding the control systems. Note that you can exploit Adams/Mechatronics components such as transducer/actuator signals without the need for a new version of the model (template in Adams/Car) since you can activate/deactivate the control system. See Activity in Adams/Mechatronics for more information. Signal Manager The Signal Manager is a graphic interface in Adams/Mechatronics where you connect the mechanical system(s) to the control system(s), i.e., connect the transducer signals to the control system inputs and control system outputs to the corresponding actuator signals. Note that you can also connect a control system output of one control system to input of another control system. Typically, you need to use the Signal Manager only once for a complete model and then connections will be saved within the model. The next time you open the model, the signal connections will be setup automatically.

Learning the Basics 9

External System Library (ESL) External system library (ESL) is a general term used for code generated by control packages like Matlab/RTW (Real-Time Workshop) or Easy5. This code is saved in a file with dll (dynamic link library) extension on Windows or so (shared objects) extension on Unix operating system. To provide an effective access to the ESL file, Adams/Mechatronics uses ESL property file, which in turn points to a ESL file and contains other information such as control system parameters name and value. This provides the possibilities to perform a design study in Adams/Insight. In Adams/Car, ESL property files are stored in external_system_libraries.tbl directory in the Adams/Car database. In Adams/View, they are stored in a user-specified folder.

10 Adams/Mechatronics

Working with Adams/Mechatronics
Working with Components
What you can do in the Adams/Car Template Builder and in Adams/View is:
• Create, modify, rename and delete transducer signals and actuator signals • Create, modify, rename and delete control systems • Modify, rename, rearrange and delete the auto-generated control system inputs/outputs

Please note that there is no dialog box available to create a control system input/output object; however, they can be modified by using Modify dialog box. In contrast to Adams/Car Template Builder and Adams/View, you are only allowed to modify the components in the Adams/Car Standard Interface mode, i.e., modify different signals and the control systems. Transducer Signals The following picture shows how to create a transducer signal which should measure a state in the mechanical system. This menu is available in Adams/Car Template Builder and in Adams/View. Note that in Adams/Car case, the transducer signal should be created in the template where the signal arises.

12 Adams/Mechatronics

The menu choice above will display the following dialog box:

Among other inputs such as name and type (only valid for Adams/Car), you should enter a function expression that is measuring a state of the mechanical system. Note that you can alternatively consider the function definition as a user routine subroutine. For more help on this please refer to Create/Modify Transducer/Actuator or Control System Input/Output dialog box help. As for all type of signals in Adams/Mechatronics in addition to choosing the applicable unit type and unit string, you alos have the possibility to scale the function and apply a disturbance and/or delay. The later options are described more in detail here. Further, you also have the option to turn on/off the auto-created signal request and measure. The request and the measure can be expressed in model unit and, if the unit string differs from the model units, also in the user specified signal unit. In the following example, the signal can be easily plotted in the Adams/Postprocessor in model units "deg/second" (in this case "degrees" and "second" are angle and

Working with Adams/Mechatronics 13

time model units, respectively) and also in "rpm" (in this case it is assumed that the function expression is producing result in "rpm").

A transducer signal activity can be set in two different ways:
• Always: the transducer signal object is always active in your model • Only if connected: the transducer object is inactive until it gets connected to a corresponding

control system input. If it is not connected, it will stay inactive, and will not be visible to the solver (i.e. not visible in the .adm file) To understand more about how to use the activity setting, please refer to Activity settings section. More details about the dialog settings can be found in the dialog box help (F1- help).

14 Adams/Mechatronics

Last, by selecting the push button shown in following picture, you will get the option to select entities located in the model that should be activated/deactivated dependent on if the signal gets connected or not. Please refer to Activity settings to learn about this feature.

In Adams/Car Standard Interface mode, the function expression cannot be edited as expected. But other options like request/measure activity, scale factor, disturbance, delay and unit information can still be modified. These choices are then stored in the subsystem file. In Adams/View all dialog box options above are available except the possibility to create symmetric signals. Hence, all signals in Adams/View are of ‘single’ type.

Working with Adams/Mechatronics 15

Actuator Signals The actuator signal is used to transfer the output from the control system to the mechanical system and is created via the menu below. In Adams/Car the signal should be created in the template where the signal is used and referred to.

The dialog box of creating a new actuator signal is similar to one for the transducer signal except for the function expression which is deactivated. The reason is that the actuator signal gets its value from a control system output and hence the function expression is already defined and cannot therefore be changed.

16 Adams/Mechatronics

The available activity settings for an actuator signal are:
• Always: the actuator signal object is always active in your model • Only if connected: the actuator object is inactive until it gets connected to a corresponding

control system output. If it is not connected, it will stay inactive, and will not be visible to the solver (i.e. not visible in the .adm file)
• Only if referred to: If another object is using the actuator signal in a function expression, the

actuator signal will be active. A typical example is if you have a force using the actuator signal in its expression. The user has the option – as for the transducer signal – to select entities whose activities depends on if the actuator signal gets connected or not. To understand more about how to use the activity setting together with the options to select activity dependent objects, please read Activity settings. Control Systems To create a control system, please use the menu below.

Working with Adams/Mechatronics 17

Dialog box below will be displayed and more detailed information about each option menu and field can be found in the Create/Modify Control System dialog box help.

In this dialog box, you specify control system Name, Type (only in Adams/Car), System Type and Number of Inputs/Outputs. The System Types can be one of the three following types:
• Function Expression - use the function builder to create a controller based on Adams entities • Co-simulation - run co-simulation between Adams and a controls package (Easy5 or

MATLAB/Simulink)
• External System Library (ESL) - use an external system library (i.e dynamic link library) that

has been exported from Easy5 or MATLAB/Real-Time Workshop. An ESL Property File refers to an ESL (also known as dynamic link library) file. If the System type Function Expression is chosen, no property file or other additional input is needed, see below. The function expression of the controller is instead defined and saved in each control system output. In Adams/Car the function expression for each control system output is defined in the Template Builder mode, however, you are able to modify the control signal output expression using Create/Modify Control System dialog box.

18 Adams/Mechatronics

If the System type Co-simulation is chosen, then you need to select the Control Package software you want to use and if Initial Static Analysis should be performed or not. The selected co-simulation settings will be used by default when exporting the plant using Adams/Mechatronics Export Plant for Cosimulation /Setting up ESL dialog box.

If the System type External System Library is selected, then you need to select the External System Library file and whether Static Hold should be on or off, which determines if Adams/Solver should keep the initial value of the control signal constant during static analysis.

By selecting the push button shown in following picture, you can open the Control Signal Editor dialog box, where you enter Signal Name (port name), Unit type and Unit string and Scale factor for each input

Working with Adams/Mechatronics 19

and output of the control system. Typically that information is received from the supplier of the control system.

Control System Inputs When you create a control system, you specify the number of control system inputs and thereby control system inputs are auto-created. After creation, you can – as for all types of signals- modify the unit type, unit string, delay, disturbance, etc of control system inputs using Create/Modify Control System dialog box. Using the Signal Manager, you can hook up the appropriate transducer signal to the corresponding Control System Input. Control System Outputs When you create a control system, you also specify the number of control system outputs and thereby they are auto-created directly. After creation, you can modify the unit type, unit string, delay, disturbance, etc of control system outputs using Create/Modify Control System dialog box. Using the Signal Manager, you can hook up the appropriate Control System Output to the corresponding actuator signal.

Naming conventions
In Adams/Mechatronics names of the control system and the different signals conform to the following conventions: Transducer Signal: ues_cst_’signal name’ (cst = Control Signal Transducer)

20 Adams/Mechatronics

Actator Signal: Control System:

ues_csa_’signal name’ (csa = Control Signal Actuator) ues_’system name’

Control System Input:ues_csi_’system name’_’input port name’ (csi = Control System Input) Control System Output:ues_csi_’system name’_’output port name’ (cso = Control System Output) Here ‘ues’ stands for ‘user-defined entity single’. In Adams/Car it is possible to create symmetric signals and control systems. In that cases the prefixes for the symmetric (left/right) signals are uel_cst_’signal name’ and uer_cst_’signal name’ (for a transducer signal)

Signal Manager
The Signal Manager is the key feature of Adams/Mechatronics and is where all connections are set, i.e., the connection between the control systems and transducer/actuator signals of the mechanical system. The following schematic illustrates the signal flow in Adams/Mechatronics.

While an overview of Signal Manager is presented here, a more detailed description can be found in the Adams/Mechatronics Tutorials. To open Signal Manager, use the following menu. Note that in Adams/Car this menu is only available in Standard Interface Mode.

Working with Adams/Mechatronics 21

Select the assembly (Adams/Car) or model (Adams/View) in which the control system exists.

As an example from the information in the preceding dialog box, you can notice that there are two control systems in the assembly and they are located in the two subsystems with major roles 'control system' and the minor roles are 'ABS' and 'ESP'. Note that, alternatively, the control systems could have been created in the one single template/subsystem. In that case, both control systems would have the same major and minor roles. In Adams/View, as there is no major and minor role concept; the major/minor role columns are hided. By selecting a control system in the dialog box above (you select by double clicking on any cell in the row of the corresponding control system), a new dialog box pops up which gives an overview of the connectivity for each input and output port of the control system (following picture). The information in the gray area (input port name and unit type) is related to the control system itself - and therefore cannot be changed here - while the white area is a 'selectable' area. You also get the information (from the major and minor role) that in which subsystem the connected signal is located. The name convention of the signals also reveals the type of connected signal. For

22 Adams/Mechatronics

instance input port number 8 with port name 'wheel_speed_fl' below is connected to a ('uel_cst') left side transducer signal named as 'wheel_speed_front'.

By selecting an input port row in the white area, you will have the possibility to choose a signal from the Available Signal List in ‘Selecting input’ dialog box to connect to the certain input port. Please note that only the signals of the same unit type as the input port are displayed in the (available signal) list. In the example below, only the transducer signals and control system outputs of ‘angular velocity’ unit type are shown in the table as possible candidates to be connected to the ‘wheel_speed_fl’ input port.

The output tab, as depicted in following picture, is quite similar to input tab except that here the gray area (information related to the control system; i.e., output port name and unit type) is located on the left side

Working with Adams/Mechatronics 23

of the table (to resemble the signal flow) and also that more then one signal can be connected to the output port.

In the following lines, some background or implementation information is presented which may be of interest to advanced users.
• Note that each signal connection is based on following Connector data • Signal Name • Side (left/right/single) • Major Role

24 Adams/Mechatronics

• Minor Role

Once connections have been established, each individual connection is saved into a connector data section of the signal component.
• Connector info is only stored with control system inputs and actuator signals since these can

only be connected to only one single signal in contrast with transducer signals and control system outputs which may be connected to more than one signal
• The use of major and minor role makes the connector info independent of assembly and

subsystem name. It is then possible to swap control systems or subsystems without need of redoing the connecting process in signal manager
• The connector concept is comparable with input communicator in standard Adams/Car. One

difference is though while you work with communicators in the template builder mode, here you setup the connections on the assembled model in the Standard Interface Mode
• In the Adams/View, only the connector signal name is used when making connections

Units in Adams/Mechatronics
Adams/Mechatronics supports arbitrary units in all signal types. It also takes care of units conversion, for example, from a transducer signal to the corresponding input signal in the control system. The units are handled by two attributes in Adams/Mechatronics: unit type and unit string. Unit type indicates which kind of unit you are using, for example, velocity or torque. Adams/Mechatronics only allows connection of the same unit types when assigning a transducer signal to a control system input, a control system output to an actuator signal, or a control system output to input of another control system. The unit string is used by Adams/Mechatronics to calculate the appropriate conversion factor. For example, if you define the wheel speed transducer signal to send signal in mm/s unit and your control system input requires a km/h unit, the conversion is performed by Adams/Mechatronics. This means that a unit conversion occurs automatically if the units are not the same, for example, for a transducer signal and the corresponding control system input.

Working with Adams/Mechatronics 25

There is a set of pre-defined unit types and unit strings available in Adams/Mechatronics. However, if your control system is working with other type of unit, you can create your own unit. See the table below for more information about how to choose different unit type and unit string alternatives.

Unit type

Unit String

Used when The transducer/actuator/control signal is (or should be) dependent on model units

Comment No units conversion if model units is used in both ends Always conversion

length, angle, ... model units

length, angle, ... mm,centimeter You want the , deg,... transducer/actuator/control signal to be independent of model units. Example: user subroutine without units handling or generated control code length, angle, ... user defined You need a unit which is not available in the pre-defined unit string list

Unit string can be composed using the Adams/View convention (see here for more info). Make sure to use the appropriate unit strings for the unit type selected.

26 Adams/Mechatronics

Unit type user

Unit String user defined

Used when Desired unit type is not available in select list but unit string can be composed using the Adams/View convention (see here for more info) Desired unit type is not available in the pre-defined unit type list and unit string can't be composed using Adams convention (see here for more info)

Comment Make sure the same unit types are used in "both ends", e.g. in both transducer and control system input No units conversion will be done if you use no_units in "both ends", e.g. in both transducer and control system input. You can use scale_factor to enforce a unit conversion effect

user

no_units

Disturbance and Delay
In Adams/Mechatronics ‘Disturbance’ and ‘Delay’ can be applied to all four types of control signals.

Working with Adams/Mechatronics 27

Disturbance Disturbance can be introduced to signals by adding or multiplying as illustrated below.

The Disturbance Signal can have one of four following formats
• Run-Time Expression – Enter a constant or an arbitrary function expression • ACII File – The disturbance signal is defined in a certain Disturbance ASCII File, see file

example below. You need to specify the channel to use
• RPC File - The disturbance signal is defined in a RPCII file. You need to specify the channel

number to use
• DAC File- The disturbance signal is defined in a DAC file

A simple example of a Disturbance ASCII File is shown below: $-----------------------------------HEADER [HEADER] FILE_VERSION = 1.0 FILE_TYPE = 'daf' $----------------------------CHANNEL_UNITS [CHANNEL_UNITS] TIME = 'second' engine_rpm = 'deg/sec'

28 Adams/Mechatronics

body_acc = 'meter/sec**2' wheel_speed_fl = 'rad/sec' wheel_speed_fr = 'rad/sec' $----------------------------SCALE_FACTORS [SCALE_FACTORS] body_acc = '9.82' $----------------------------CHANNEL_DATA [CHANNEL_DATA] { TIME engine_rpm body_acc wheel_speed_fl wheel_speed_fr } 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 2.0 2.0 2.0 2.0 2.0 3.0 3.0 3.0 3.0 3.0 4.0 4.0 4.0 4.0 4.0 Delay Delay functionality accounts for delayed signal and makes it possible to set a constant time delay or a user defined time delay expression applied before or after the disturbance.

The following diagram shows the data flow for a control signal. As can be seen, the delay can be placed in three different “positions” with respect to signal function and disturbance. In addition to delay position, you need to specify the delay time function (whose value must be positive or zero), and delay initial

Working with Adams/Mechatronics 29

history, that is, the initial value of delay function. Please refer to dialog box help (F1- help) for different settings.

Whether a disturbance/delay is applied or not and where the delay function is applied affect the solver variable function and request expressions in the control signal UDE. For each configuration a picture depicts the data flow, in which the request component signal “positions” are marked in blue color. There exist a total of six disturbance and delay configurations cases as shown enumerated in the following table. Disturbance applied No No Yes Yes Yes Yes No Yes No Yes (set to “function”) Yes (set to “disturbance”) Position 1 in picture above Position 2 in picture above

Case #
Case 1 Case 2 Case 3 Case 4 Case 5 Case 6

Delay applied

Comments Default settings Delay setting “function” is the only choice

Yes (set to “disturbed function”) Position 3 in picture above

30 Adams/Mechatronics

• Case 1: No disturbance or delay is applied

• Case 2: No Disturbance is applied, Delay is applied (set to function)

Working with Adams/Mechatronics 31

• Case 3. Disturbance is applied, no Delay is applied

• Case 4: Both Disturbance and Delay is applied, Delay is set to “function”

32 Adams/Mechatronics

• Case 5: Both Disturbance and Delay is applied, Delay is set to “disturbance”

• Case 6: Both Disturbance and Delay is applied, Delay set to “disturbed_function”

Export Plant
Plant export is used to create a control package input file (an inf file for Easy5 or a m file for MATLAB/Simulink) which is needed to set up either a co-simulation or ESL (external system library) simulation.

Working with Adams/Mechatronics 33

Use the following menu to access the export plant dialog box in Adams/Mechatronics.

The following dialog box will pop up:

Note that by performing a plant export, an adm file will also be generated; however, the adm file only will be used in case of co-simulation, i.e., the ESL simulation does not need the adm file. Also note that the content of the adm file differs depending on which type of control system (ESL or Co-Simulation) is used, therefore it is important that not to use the adm file generated for ESL control system for a cosimulation analysis. There are some differences in how to use the plant export in Adams/Car and Adams/View as well as the purposes of export, i.e., co-simulation or ESL simulation.

34 Adams/Mechatronics

In Adams/Car: • For Setting Up ESL Simulation, display (by yourself) the plant export dialog box via menu as shown above and then select the control system name and a file prefix for the exported file. You can export the plant both in Template Builder and in Standard Interface mode. The following dialog box appears after plant export

• For Co-Simulation, please follow the instruction shown in the preceding information dialog

box or refer to the Running Analysis section. Note that in Adams/Car co-simulation, you need to generate an adm file by performing a "file only" simulation so that enforce Adams/Car to read the property files and set up the model parameters property. Here the plant export dialog box show up automatically In Adams/View: • For both ESL simulation setup and Co-Simulation: Display (by yourself) the plant export dialog box. Select the control system, a file prefix, and other proper settings. If the control system is not of the co-simulation type, then the following message will appear to inform that you use the generated files only for settings up external system libraries in chosen control package software.

Working with Adams/Mechatronics 35

If the control system is of the co-simulation type, then the system name field automatically fills with the names of the control systems that are of type ‘Co-Simulation’ (The ones which exist in the default model). If the control system type is set to ‘Co-Simulation’, the generated files could be used for the both purposes.

External System Library (ESL) Property file
In Adams/Mechatronics, a property file called External System Libraries (ESL) property file is used to incorporate the external system library (aka dynamic link library) files generated by control package software (Easy5 and Matlab/Real-time Workshop). An ESL property file is a text file with file extension of esl and consists of the following sections.
• Routine - reference to the external system library file name (without file extension) and the

routine within that library file (generally an ESL file may contain several routines)
• Parameters - external (tunable) parameters specified in the controls package • Initial conditions – initial conditions of continuous and discrete states of the control system

included in the library file The use of property files enables you not only to easily switch between different external system libraries (i.e imported control systems) but also to evaluate different parameter settings for a certain dynamic link library file. For example in the following picture five different property files are referring to the same dynamic link library file. In this case, the routine information in these files is the same but the values for

36 Adams/Mechatronics

the external tunable parameters differ. Examples of tunable parameters is a certain gain settings or threshold values for an ABS controller.

To generate an ESL property file in Adams/Mechatronics, use the following menu

The following dialog box appears where you choose the Control Package software that the dynamic link library (External System Library) originates from and the Property File Name of the file that is going to be generated.

While in Adams/Car, the files will be stored in the directory called 'external_system_libraries.tbl' in the default writable database, in the Adams/View you select a target directory where the property file will be

Working with Adams/Mechatronics 37

copied to. In both Adams/Car and Adams/View cases, the dynamic link library file will be copied into a sub directory named after the platform (win32, win64, linux32, linux64, etc). This is to support a platform independent use of the property files. For instance in the preceding example and on a win32 platform, the ESL property file and the ESL file will be copied into following locations: C:/Temp/external_system_libraries/abs_system_version1.esl C:/Temp/external_system_libraries/win32/abs_controller.dll In case of HPUX platform, the full path to the copied library file would be: C:/Temp/external_system_libraries/hpux/abs_controller.sl Other platform follows the same principle. Finally, if the control system type is set to ‘External System Library’, followings steps are internally performed by Adams (This is performed prior to an analysis - during reading property file procedure - in Adams/Car and after a modify action of the system in Adams/View): 1. Locates the ESL file referenced in the ESL property file. The path to the library file is “path to ESL property file”/ “platform”/ “library file name”.(dll, so, sl ...) 2. Verifies that the dimension of the control system found in the ESL property file corresponds to the one defined in Adams/Mechatronics, i.e., matches the number of inputs and outputs 3. Activates the General State Equation (GSE) in the control system component and set the dimension of the different solver arrays related to the GSE 4. Reads the default parameter values and initial conditions defined in the ESL file. 5. Overrides the values of the parameters and initial conditions with the ones specified in the ESL property file 6. Copies the ESL file to the working directory (as Adams/Solver expects the library file to be located in the working directory)

Activity settings
Imagine a scenario in Adams/Car where you on the one hand have an assembly with both mechanical subsystems and control subsystems, and on the other hand have an assembly with only the mechanical subsystems. In such a scenario, you do not want to store different versions of the same mechanical (subsystem) template just because they refer to a control system which may or may not be part of the assembled model. To allow using the same mechanical template regardless of whether it will be used in an assembly with control systems or without control systems, the concept of Activity Type is introduced for transducer/actuator signals. By using different Activity Types in conjunction with selected strategies for implementing the actuators influencing the mechanical behavior, you can make the mechanical templates compatible with both user scenarios. When you create a transducer/actuator signal, you can select the signal activity type. In the table below, a summary of the different activity options and the corresponding consequences is shown.

38 Adams/Mechatronics

When setting up your templates to be used both with and without control systems, there are two "levels" of activities. One level deals with setting up the activity of the transducer/actuator signal itself that is named Activity Type and determines whether the signal should be written into adm file or not. The other level is signal connectivity status which deals with whether the signal is connected to the control system, actuators, or components of the mechanical system. You can also define activity of a group of Adams objects to be dependent on the signals’ connectivity. Table below shows different alternatives for signal activity and signal connectivity. The table columns are explained thereafter. Signal Activity state ON ON ON OFF YES NO NO YES NO Activity Type: Activity Type deals with setting up the activity of the transducer/actuator signal itself and the following types of activity are possible. 1. Always: as the name implies, the transducer signal or actuator signal would be always active in the model 2. Only if connected: the transducer or actuator signal only would be active when it has been connected to the appropriate control system input/output. In other words, it will not be visible in the .adm file if it has not been connected 3. Only if referred to: the actuator signal will be active only if another object in the model is referring to it. As an example, consider the use of a conventional mechanical damper object. You could replace that damper with a controlled one, and then automatically have the associated actuator signals become active, since they are referred to by that controlled damper object Note that the later (“Only if referred to”) option is only applicable to actuator signal (i.e., not applicable to transducer signals). ON OFF ON OFF

Activity Type Always

Connected YES NO

Referred to

Active object state ON OFF ON OFF ON OFF OFF OFF

Only if connected

YES NO

Only if referred to

YES

Working with Adams/Mechatronics 39

Connected This indicated whether the transducer/actuator signal has been connected or not to a control system input/output. In each transducer and actuator signal object there is a variable which keeps track of whether the transducer or actuator signal has been connected to the control system input/output. The name of this variable is signal_connectivity_flag; and its value is 1 if the connection is successful and 0 if there is no connection made. You can also use this variable in function expressions in the mechanical template to build in logic supporting the use of the template both with and without control systems. Referred to For each type of activity and connection status, the actuator signal may or may not be used in an expression of some other (mechanical) object, i.e. referred to. If it is referred to by another object, then the transducer/actuator signal object will be active in the model. Signal Activity State This indicates the activity of the transducer/actuator signal itself and determines whether the signal is written into adm file or not.

Active Object State
This indicates the activity state of those objects which have been selected (if any) to be in the "Active Objects" group when you created the transducer or actuator signal. This allows you to use the connectivity of the transducer/actuator signal as a trigger to set activity of arbitrary other objects in your subsystem. For example, you could have two actuators acting on a brake disk and have one dependent on the control signal passed through the actuator signal and the other dependent on the open-loop driver demand. You could thus let only one be active at the time, dependent on the connectivity of the actuator signal.

“Intelligent” modeling
When selecting the type of signal activity, you should have a strategy in mind in terms of how to use the transducer/actuator signal in the mechanical system. Let us consider a brake torque as an example. Normally, the brake torque actuator force expression would be a function of the brake_demand signal from the driver model. If you want to let the ABS system control the brake torque, you would instead make the brake torque actuator function be dependent on an actuator signal. However, if you want to be able to use the same brake subsystem in both assemblies with and without the control system subsystems, you have a couple of alternatives as follows to make the brake torque "intelligent" enough: Alternative 1, use signal_connectivity_flag In this case, the function expression for the brake torque actuator would look something like FUNCTION = (1-signal_connectivity_flag) * F(brake_demand) + signal_connectivity_flag * F(actuator_signal)

40 Adams/Mechatronics

In this alternative, suitable activity settings for the actuator signal object would be 'Always' or 'Only If Referred To'. Note:

If you would use 'Only If Connected', you would get an error message in the Solver in case the actuator signal is not connected, i.e. if you try to use this brake system with no control subsystem in the assembly. This is because the signal_connectivity_flag will be deactivated and thus no longer visible in the .adm file, and thus the function expression refers to a non-existing object.

Alternative 2, use Active/Inactive Objects Instead of, as in the previous example, writing a complex function expression for one torque actuator object, you can create two torque actuators. Then you let one actuator be dependent on the brake_demand variable, and the other actuator be dependent on the actuator signal object. When you create the actuator_signal, you simply select the ‘arrow button’ to display a dialog box where you can put the proper actuator objects in the Active Object group and Deactive Object group. In this way, Adams/Mechatronics will automatically switch the activity of the two torque actuators if the actuator signal is connected to (or disconnected from) the control system. In other words, you should in this case use the 'Always' or 'Only If Connected' activity setting when you create the actuator signal. Note:

In this case, the only difference between the use of 'Always' and 'Only If Connected' will appear when the actuator signal is not connected. What happens with 'Always' then is that the actuator signal will stay active, producing only zero output whereas with 'Only If Connected', the actuator signal will be deactivated, thus not being visible to the Solver.

Alternative 3, use UDE replace If you are working with UDE components, there is a third alternative. For example, if you replace a conventional damper with an active damper, you want the actuator signal from the control system to automatically connect to the damper force object. An example of an active damper has been included in the Mechatronics installation as the amech damper. If your UDE is already created and implemented in Adams/Mechatronics continue at step 2. 1. Create the UDE with the necessary elements and dependencies. The UDE is created as any other UDE with a few alterations described here. The actuator has to be created in the UDE as a data element variable data_element create variable & variable_name=.tmp_damper.actuator_signal & function="0" The actuator variable is then implemented in the UDE as intended, for example in a force expression

Working with Adams/Mechatronics 41

force modify direct single_component_force & single_component_force_name=.tmp_damper.force & function=".tmp_damper.scale_factor*VARVAL(.tmp_damper.actuator_signal)" & i_marker_name=(.tmp_damper.i_marker) & j_marker_name=(.tmp_damper.j_marker) When the UDE is created the actuator variable has to be defined as an object ude create definition & def=.AMECH.udes.ac_amech_damper & inp=.tmp_damper.i_marker, & .tmp_damper.j_marker & par=.tmp_damper.scale_factor, & .tmp_damper.geoScale & obj=.tmp_damper.force, & .tmp_damper.actuator_signal, & .tmp_damper.graphic, & .tmp_damper.dmCalc, & .tmp_damper.request When the UDE is created in the correct approach, it is time to look at the methods used to handle the UDE. To be able to use UDE replace to turn on and off the control system the replace method has to include a command to find the actuator signal
macro create & macro=.AMECH.udes.ac_amech_damper.replace & user_entered_command="amech template_builder instance ac_amech_damper replace" & wrap_in_undo=no & commands="! $instance_name:t=ac_amech_damper", & "!END_OF_PARAMETERS", & "!", & "amech toolkit get actuator_signal &", & " entity=$instance_name &", & " function_object=$instance_name.actuator_signal", & "", & "ude modify instance instance_name=$instance_name"

Now the UDE is created and the replace method handles the connection to the actuator signal. But to be able to replace another damper with the new active damper our new UDE has to be added to the same group
ude modify definition & def=.AMECH.udes.ac_amech_damper & isa=.ACAR.forces.ac_damper

42 Adams/Mechatronics

The UDE is now created in the correct way and ready to be used in models. There are a few utility macros available in Adams/Mechatronics. These macros are designed to perform some simple tasks and can be used in developing new UDEs. Utility macros together with definition, macros and templates for the active damper can be found under examples in the installation. The first macro can be used to find the related actuator signal, it returns a variable with the name of the actuator amech toolkit find actuator_signal signal) The second macro finds the control system connected to a control signal amech toolkit find control_system & control_signal = (the control signal for which you want to find the control system) & control_system_variable = (a variable where the macro will return the control system) The last macro look at the type of your function object and adjust it to be dependent of the actuator signal. If your function object is a gforce or vforce you can specify in which direction the adjustment should be done amech toolkit get actuator_signal & entity = (the entity for which you want to create a dependency) & function_object = (the object that should be dependent of an actuator signal) 2. The template is created with the standard element, in our example the standard damper. Even though the standard damper isn't connected to any actuator signals it is essential to plan ahead and create the actuator signal needed by the active damper. When you create the actuator signal you use the button to specify the UDE object that should be dependent on the actuator signal. 3. In the standard interface, when working with subsystems, the standard damper can be replaced by an active damper of our amech_damper type. Right-click on the damper for which you want to change UDE definition, and choose Replace. The definition for the new UDE appears in the list if it is implemented correctly. Our active damper is called Amech_damper.
& entity = (the entity for which you want to find a dependency) & actuator_variable = (a variable where the macro will return the actuator

Working with Adams/Mechatronics 43

Adams/Mechatronics replaces the standard damper with a damper of the Amech_damper type and then finds the actuator associated with the damper. The dialog box for modifying the damper appears automatically (if you create your own UDE you have to create your own modify dialog box). In the dialog box you can see the name of the actuator signal, and if the actuator signal in turn is connected to a control system also the name of the control system is displayed in the dialog box. Use the modify buttons to the right to modify the actuator signal and the control system. The name of the control system will appear in this dialog box when you have connected the actuator signal to a control system in the signal manager.

4. You can switch between a standard damper and an active damper by using replace in both directions. The UDE definition that is in use when the subsystem is saved will be the default UDE definition in that subsystem.

44 Adams/Mechatronics

Components in Adams/Mechatronics
In this section, Adams/Mechatronics components which all are of UDE (User Defined Element) type are explained in detail. A UDE is actually just a collection of standard elements in Adams. The UDE is treated as a single element in the interface instead of just every standard element for itself. There are two types of UDE components in Adams/Mechatronics; control signal UDE object which is the base for all signal components, and control system UDE object which is used by control system. So these two types of UDEs cover all five components available in Adams/Mechatronics. 1. Transducer signals 2. Actuator signals 3. Control System Input 4. Control System Output 5. Control System Please note that control system inputs/outputs are automatically created when you create a control system object. This means that there is no dialog box available to create a control system input/output object; however, they can be modified by using Modify Control Signal Input/Output dialog box. The control system input/output objects are entirely managed internally by Adams/Mechatronics and only serve as a convenient and efficient way to transfer information from/to transducer signals and actuator signals.

Control Signal
UDE definition .AMECH.udes.ac_control_signal UDE description: The control signal UDE is used to create control signal objects. The central object in this UDE is the signal variable. Transducer signal, Actuator signal, control system input and control system output are all based on this UDE

44 Adams/Mechatronics

UDE Specification Parameters: Parameter signal_type Type string value Function Type of Control signal. There are four different types of signals:
• Transducer_signal • Actuator_signal • Control_system_input • Control_system_output

function

string value

Variable function. The User can provide an expression in two cases:
• Transducer_signal • Control_system_output (if control system

type is set to function) For all other signal types the expressions are set automatically in the control system connect procedure. function_type template_function integer value string_value 1. = function expression 2. = user parameters for a VARSUB Storing the Adams/Car template function expressions. Used when the control system type is set to ‘function’. Expression containing user parameters for a VARSUB call The routine in the VARSUB The options are:
• none • add • multiply

user_parameters routine disturbance

string value string value string value

Components in Adams/Mechatronics 45

Parameter disturbance_type

Type string value

Function The disturbance type. There are four types:
• user_function • •

file_ascii file_dac

• file_rpc

disturbance_function disturbance_function_unit disturbance_file disturbance_channel disturbance_channel_unit disturbance_time_unit disturbance_scale_factor disturbance_active_flag

string value string value string value string value string value string value real value

Additional disturbance of the signal. This could a time function or just a single constant. The unit of the disturbance function. Additional disturbance signal from a file (ascii, rpc, dac). Channel in disturbance file The unit of the disturbance file channel. Valid for rpc and dac disturbance files. The time unit of the disturbance file channel. Valid for rpc and dac disturbance files. Disturbance scale factor. Valid for file input disturbances.

integer value Disturbance active flag. Dependent on the disturbance variable. If the disturbance is set to “none” the value is 0. If not “none”, the value is set to 1. real value string value Scale factor to the complete function. Can contain following activity options:
• "active:model_and_signal_units" • "active:model_units" • "active:signal_units" • "not_active"

scale_factor request_active_flag

"active:model_units" means that the request which is expressed in model_units is active. measure_active_flag unit_type unit_string string value string value string value See comment for request_active_flag. The same options are available for measures as well. Unit type of the signal. For instance "rotational_velocity". Unit of the signal. For instance "deg/s"

46 Adams/Mechatronics

Parameter unit_conversion_factor1 unit_conversion_factor2 unit_conversion_factor3 time_unit_conversion_factor control_system signal_index

Type real value real value real value real value object value

Function Unit conversion factor from control signal unit to model units. Unit conversion factor from disturbance unit to model units. Degrees to radians. (used when angle is a part of the unit type) From disturbance time unit to model units. Valid for disturbance files. The related control system. Valid for control system inputs and control system outputs.

integer value Index of specific input / output for the control system. Valid for control system inputs and control system outputs string value Connected control signal name. Valid for the control signal of types actuator signal and control system input. Major role of the connected control signal. For instance "ESP_system". Only valid for template based products like Adams/Car. Minor role of the connected control signal. For instance "front". Only valid for template based products like Adams/Car. Either left, right or single. The connecting signal variable. (solver variable) A Dummy variable. Needed for the read property file ude method functionality.

connector_name

connector_major_role

string value

connector_minor_role

string value

connector_side connector_signal connector_signal_solver_id property_file asymmetric

string value object value string value

integer value The Adams id of the connector object.

integer value Since connector information data can be asymmetric, the control signal is always set to asymmetric. In the subsystem file there are always separate blocks for left and right side of a control signals. string value "Yes" or "No". Even though the control signal is asymmetric, the user can specify if the data which appear in the create/modify dialog box should be the same for left and right side. Disturbance, scale factors, units etc.

symmetric_dbox_data

Components in Adams/Mechatronics 47

Parameter signal_connection_flag

Type

Function

integer value Indicates if the control signal has been connected on not. Valid for control system input and actuator signal. string value The are a total of four possible values of the parameter:
• "always"

active_flag

Valid for transducer signals and actuator signals. Active even if not connected (the signal is set to zero)
• "only if connected"

Valid for transducer signal and actuator signal. The Control signal gets deactivated if not connected.
• "only if referred to"

Valid only for actuator signal. If no elements are dependent on the actuator_signal the signal gets deactivated.
• "dependent_on_control_system"

The only "option" for control system input and control system output. Is not valid for other type of control signals. active_objects object value Object that will be activated if the signal gets connected. (They are deactivated if the signal does not find any connection.) Object that will be deactivated if the signal gets connected. (They are activated if the signal does not find any connection.) Useful when replacing to an UDE entity that should use Adams/Mechatronics functionality. The "Amech" UDE entity will look for an actuator and find the only actuator which has set the specific UDE as a dependent object. Can be “none”, “function”, “disturbance” or “disturbed_function”

inactive_objects

object value

dependent_object

object value

delay_type delay_active_flag delay_time_type delay_time_function

string value

integer value Help variable, 0 if Delay is set to “none” otherwise 1 string value string value “run_time_expression” or “template_expression” Either a constant value or a function expression

48 Adams/Mechatronics

Parameter delay_time_template_function

Type string value

Function Valid only for Adams/Car. It is possible to set a model dependent delay time in template model. The user can choose to use the template expression or override it in the standard interface mode. Time unit the delay_time_function is expressed in. The time unit the delay_time_template_function is expressed in. Conversion factor from delay time unit to modeling time unit. Initial history value of the delay function

delay_time_unit delay_time_template_unit

string value string value

delay_time_unit_conversion_factor real value delay_function_init_history_flag delay_function_init_history Input Parameters: Input Parameter Type

integer value If set to 1, the init history value is used real value

Function

Objects: Object signal_variable function_variable Type Function

state variable Holding the resulting output signal value from the control signal. state variable Holds expression that measure a state of the mechanical/control system. Works as an “input” to the control signal. state variable Disturbance signal variable state variable Contains the functions which are defined in the template builder. state variable Depends on delay_time_function state variable Solver variable containing the solver expression that should be delayed. request Signal request in model units. For details refer to disturbance and delay section

disturbance_variable template_function_variable delay_time_variable delay_function_variable request_model_units

delay_time_template_variable state variable Depends on delay_time_template_function

Components in Adams/Mechatronics 49

Object request_signal_units

Type request

Function Signal request in signal units. For details refer to disturbance and delay section

signal_model_units disturbance_model_units undisturbed_model_units signal_signal_units disturbance_signal_units undisturbed_signal_units spline

measure measure measure measure measure measure spline

Signal measure in model units Disturbance measure in model units Undisturbed signal in model units Signal measure in signal units Disturbance measure in signal units Undisturbed signal in signal units Disturbance signal data values

Create Macro: (call: amech template_builder instance ac_control_signal create). This macro is executed when an instance of the definition ac_control_signal is created. Modify Macro: (call: amech template_builder instance ac_control_signal modify). This macro is executed when an instance of the definition ac_control_signal is modified. Destroy Macro: (call: amech template_builder instance ac_control_signal destroy). This macro deletes all the entities which have been created for the instance exclusively. Request definition: Disturbance/Delay settings No disturbance, no delay Component f2 Component name signal

No disturbance, delay_type is set to “function”,

f2 f4

signal function signal disturbance undisturbed signal function

Disturbance, no delay

f2 f3 f4 f7

50 Adams/Mechatronics

Disturbance/Delay settings Disturbance, delay_type is set to “function”

Component f2 f3 f4 f6 f7

Component name signal disturbance undisturbed signal delayed_function function signal delayed disturbance disturbance undisturbed signal function signal disturbed function disturbance undisturbed signal function

Disturbance, delay_type is set to “disturbance”

f2 f3 f4 f6 f7

Disturbance, delay_type is set to “disturbed_function” f2 f3 f4 f6 f7 Measure definition: Function_name signal Function complete_function

Subsystem parameters in Adams/Car: signal_type symmetric_dbox_data unit_type unit_string scale_factor delay_type delay_time_type delay_time_function delay_time_unit delay_function_init_history_flag delay_function_init_history

Components in Adams/Mechatronics 51

disturbance disturbance_type disturbance_function disturbance_function_unit disturbance_file disturbance_channel disturbance_channel_unit disturbance_time_unit request_active_flag measure_active_flag connector_name connector_major_role connector_minor_role connector_side Design parameters: scale_factor disturbance_scale_factor Template Builder (Adams/Car) - Standard Interface (Adams/Car) - Adams/View .AMECH.dboxes.dbox_tem_con_sig The dialog box has two modes - create or modify - that calls either the create or modify macro. .AMECH.macros.mac_tem_con_sig_cre Command: amech template_builder control_signal create Creates left/right or single control_signal by calling the screate macro. .AMECH.macros.mac_tem_con_sig_scr Command: amech template_builder control_signal screate Creates a single control_signal. .AMECH.macros.mac_tem_con_sig_mod Command: amech template_builder control_signal modify Modifies left/right or single control_signal by calling the smodify macro. .AMECH.macros.mac_tem_con_sig_smo

52 Adams/Mechatronics

Command: amech template_builder control_signal smodify Modifies a single control_signal.

Control System
UDE definition: AMECH.udes.ac_control_system UDE description: The control_system UDE is used to create control system objects. UDE Specification Parameters: Parameter active_flag active_objects Type integer value object value Function 1= active control system, 0 = inactive control system Object variable holding objects that are activated if the control system is active and is of type Function. (Objects get deactivated if control system is not active or if the type is not function). Valid for Function Control System type string value Type of Control system. There are three different types of systems: Function Expression External System Library Co-Simulation num_inputs num_outputs input_signal_array output_signal_array x_num xd_num x_IC_values xd_IC_values integer value integer value object value object value integer value integer value real value real value Number of inputs Number of outputs Object array holding input control signal objects Object array holding output control signal objects number of continuous states of the GSE (ESL). number of discrete states of the GSE (ESL) Initial conditions of the continuous states of the GSE (ESL) Initial conditions of the discrete states of the GSE (ESL)

Components in Adams/Mechatronics 53

Parameter parameter_num parameter_names parameter_values library library property file

Type integer value string value real value string value string value

Function Number of parameters that are passed to the GSE routines (ESL) Names of the parameters that are passed to the GSE routines (ESL) Values of parameters that are passed to the GSE routines (ESL) Name of the dynamic link library (ESL) Property file which refer to the dynamic link library file. Contains also input values for the library file such as parameter values and initial conditions. Name of the routine used for ESL Control System (ESL) Length of the routine used for ESL Control System (ESL) Dummy variable that is needed to be able to update values via a read_property_file macro. This parameter is not a subsystem parameter. Indicates that the continuous GSE states are not permitted to change during static and quasi-static simulations. (ESL) Select one of the following (Cosim): EASY5 MATLAB

routine_name routine_name_length property_file

string value integer value string value

static_hold

string value

cosim_control_package string value

cosim_initial_static

string value

Select one of the following (Cosim): Yes: Performs initial static analysis. No: Does not perform initial static analysis.

sensor_active_flag

integer_value Sets to 1 if sensor object is active (dependent on external system library file)

Input Parameters: Input Parameter Type Function

54 Adams/Mechatronics

Objects: Object GSE PLANT_INPUT PLANT_OUTPUT X_ARRAY XD_ARRAY X_IC_ARRAY XD_IC_ARRAY Y_ARRAY U_ARRAY gse plant input plant output array array array array array array Type General State Equation. Plant input used for Co-simulation and setup of ESL dynamic library file. Plant output used for Co-simulation and setup of ESL dynamic library file. ARRAY that is used to define the continuous states for the GSE ARRAY that is used to define the discrete states for the GSE ARRAY that specifies the initial conditions for the continuous states in the GSE. ARRAY that specifies the initial conditions for the discrete states in the GSE. ARRAY that holds output values of a GSE. ARRAY that is used to define the input variables for the GSE ARRAY that holds parameter values that are passed to GSE routine calls. STRING that hold the name of the routine that are passed to the GSE routine(s). Sensor object. The sensor is active if control system type is set to ‘ESL’ and the library file requires one. Function

PARAMETER_ARRAY array ROUTINE_STRING SENSOR Adams string sensor

Create Macro: (call: amech template_builder instance ac_control_system create) This macro is executed when an instance of the definition ac_control_system is created. Modify Macro: (call: amech template_builder instance ac_control_system modify) This macro is executed when an instance of the definition ac_control_system is modified. Destroy Macro: (call: amech template_builder instance ac_control_system destroy) This macro deletes all the entities which have been created for the instance exclusively. Request definition: No requests in the UDE definition Subsystem parameters: type library_property_file

Components in Adams/Mechatronics 55

static_hold cosim_control_package cosim_initial_static active_flag Template Builder (Adams/Car) - Standard Interface (Adams/Car) - Adams/View .AMECH.dboxes.dbox_tem_con_sys The dialog box has two modes - create or modify - that calls either the create or modify macro. .AMECH.macros.mac_tem_con_sys_cre Command: amech template_builder control_system create Creates left/right or single control_system by calling the screate macro. .AMECH.macros.mac_tem_con_sys_scr1 Command: amech template_builder control_system screate1 Creates a single control_system (1). .AMECH.macros.mac_tem_con_sys_scr2 Command: amech template_builder control_system screate2 Creates a single control_system (2). .AMECH.macros.mac_tem_con_sys_mod Command: amech template_builder control_system modify Modifies left/right or single control_system by calling the smodify macro. .AMECH.macros.mac_tem_con_sys_smo1 Command: amech template_builder control_system smodify1 Modifies a single control_system (1). .AMECH.macros.mac_tem_con_sys_smo2 Command: amech template_builder control_system smodify2 Modifies a single control_system (2).

56 Adams/Mechatronics

Running Analyses
Running Analyses in Adams/Mechatronics
You submit analysis using the standard Adams and Adams/Controls functionality since Adams/Mechatronics does not have its own analysis type. In case of Co-Simulation, select the control system type as “Co-Simulation” in control system dialog box and proceed as follows. In Adams/Car: 1. Set the mode of the full vehicle simulation to file_only to generate all necessary files for cosimulation 2. In the Adams/Mechatronics plant export dialog box which automatically pops up, verify that all control systems of type ‘co-simulation’ are shown in the system name field 3. Select the generated adm file 4. Choose control software package and other settings such as initial static analysis and solver choice. More information about the settings can be found in the dialog box help 5. Once all files have been exported, follow the instruction in Adams/Control manual of how to perform a co-simulation. In Adams/View: 1. Display the Adams/Mechatronics export plant dialog box, via Mechatronics --> Tools --> Export Plant. 2. Verify that the control systems of type ‘Co-simulation’ in the default model are shown in the system name field. 3. Enter a file prefix of the files that will be generated 4. Choose control software package and other settings such as initial static analysis and solver choice. More information about the settings can be found in the dialog box help. 5. Once all files have been exported, follow the instruction in Adams/Control manual how to perform a co-simulation.

58 Adams/Mechatronics

Plotting
Plotting in Adams/Mechatronics
Adams/Mechatronics automatically creates requests and/or measures for all type of signals. This saves time when you want to verify that the input/output signals to/from the controller are as expected. Moreover, studying the output and input relation can give you an understanding on how an unknown controller code works.

Plotting Control Signals in Adams/Mechatronics
The control systems you create in Adams/Mechatronics contain request signals (and optionally measures) for each input and output signal. The request signals names end with either model_units or signal_units, depending on what unit type you have assigned to the signal. In all other aspects, the plotting is handled exactly as in all other analyses. Request components depend on selecting signal disturbance and delay. For more information please refer to delay and disturbance section.

In the example above, the body yaw rate transducer signal can be expressed both in model and signal units. The model units in that case was “deg/second” and the signal unit was “rad/second”

60 Adams/Mechatronics

Tutorials

62 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

Template Builder - Create ESP and ABS control Systems
Overview This tutorial guides you through the process of creating the appropriate transducer signals, actuator signals and control systems in the Template Builder mode. One ABS control system and one ESP (Electronic Stability Program) control system will be created. Required transducer and actuator signals will be created in the body and brake system templates. It is assumed that you have already started Adams/Car and loaded the Adams/Mechatronics plug-in. The overall Template Builder process is: 1. Create control systems 2. Create transducer signals in appropriate templates 3. Create actuator signals 4. Invoke actuator signal variables in appropriate force/motion expressions in the mechanical system Note that you can also create transducer signals and actuator signals before creating the control system, i.e. using the following process: 1. Create transducer signals in appropriate templates 2. Create actuator signals 3. Invoke actuator signal variables in appropriate force/motion expressions in the mechanical system 4. Create control systems The main steps in the tutorial are listed as:
• Create an ABS control system • Create transducer signals in body and brake system template • Create actuator signals in brake system template • Create an ESP control system • Create transducer signals in body template

Create an ABS control system An ABS control system with following specification will be created:

Tutorials 63
Template Builder - Create ESP and ABS control Systems

Inputs:. Unit string Get transducer/control system output signal from:

# 1 2 3 4 5 6 7 8 9

Name brake_demand ESP_active body_long_vel ESP_signal_front_left ESP_signal_front_right ESP_signal_rear_left ESP_signal_rear_right wheel_speed_front_left

Unit type user user velocity user user user user

no_units brake_system no_units control_system (ESP) mm/sec body no_units control_system (ESP) no_units control_system (ESP) no_units control_system (ESP) rad/sec control_system (ESP) brake_system brake_system brake_system brake_system

angular_velocity rad/sec angular_velocity rad/sec angular_velocity rad/sec

wheel_speed_front_right angular_velocity rad/sec

10 wheel_speed_rear_left 11 wheel_speed_rear_right Outputs:

# 1 2 3 4

Name ABS_signal_front_left ABS_signal_front_left

Unit type user user

Unit string

Transmit to actuator signal in:

no_units brake_system no_units brake_system no_units brake_system no_units brake_system

ABS_signal_front_right user ABS_signal_front_right user

Note that five input transducers need to be created in the brake system template and one in the body template. This particular example of ABS system also uses input signals from another control system, that is, the ESP controller. Units Please note the usage of Unit Type and Unit String. Units are handled in Adams/Mechatronics as follows: You may specify units for transducer signal, actuator signal and control system input/output. Unit Type indicates which kind of unit you are using, for example velocity or torque. Adams/Mechatronics allows only connection of the same unit types when assigning a transducer to a control system input. The same principle applies when you
• assign a control system output channel to another control system's input channel • assign a control system output channel to an actuator

64 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

The unit string is used by Adams/Mechatronics to calculate the appropriate conversion factor. For example, if you define the wheel speed transducer to send out mm/s and your control system requires km/h, the conversion is automatically taken care of by Adams/Car Mechatronics. There is a set of pre-defined unit types and unit strings available in Adams/Car Mechatronics. If your control system is working with other types of units, you can create your own units. See the following table for more information. Unit type user Unit string no_units Used when signal from: desired unit type is not available in the pre-defined unit type list. Unit string can't be composed using Adams/View convention (see Units in Adams/Mechatronics for more info) user user defined desired unit type is not available in select list unit string can be composed using the Adams/View convention (see Units in Adams/Mechatronics for more info) model units mm, centimeter, deg, ... the transducer/actuator/control signal is (or should be) dependent on model units you want the transducer/actuator/control signal to be independent of model units. Example: user subroutine without units handling or generated control code Comment No units conversion will be done if you use no_units in "both ends", e.g. in both transducer and control system input. You can use scale_factor to enforce a units conversion effect.

Make sure the same unit types are used in "both ends", e.g. in both transducer and control system input. No units conversion if model units is used in both ends Always conversion

length, angle, ... length, angle, ...

length, angle, ...

user defined you need a unit which is not available in the pre-defined unit string list

Unit string can be composed using the Adams/View convention (see Units in Adams/Mechatronics for more info). Make sure to use the appropriate unit strings for the unit type selected.

Tutorials 65
Template Builder - Create ESP and ABS control Systems

Creating the control system In this example, we choose to create the control system in a separate template with the major_role control_system. (We could have chosen to create the control system in any template. There is no limitation in this regard.)

Display the Create Control System dialog box via the menu Mechatronics  Control System  New:

66 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

Click on the button in the lower left side of the Create Control Signal dialog box, to display a new dialog box, Control Signal Editor, in which you can specify information for each input and output signal:

Tutorials 67
Template Builder - Create ESP and ABS control Systems

When you have entered all the information for the input and output signals, select Apply to save the information and return to the Create Control System dialog box. Select OK there, and the following message window appears:

Close the message window and save the template. Proceed to create appropriate transducer signals. Create transducer signals in body and brake system template To feed the ABS controller with input signals from the vehicle model, we will add virtual transducer signals in the brake system and the body templates. The following transducer signals will be created: Inputs to the control system were: # 1 2 3 4 5 6 7 8 9 Name brake_demand ESP_active body_long_vel (left) ESP_signal_front (right) ESP_signal_front (left) ESP_signal_rear (right) ESP_signal_rear (left) wheel_speed_front Unit type user user velocity user user user user Unit string no_units no_units no_units no_units no_units no_units Create transducer signal in: brake_system control_system (ESP) control_system (ESP) control_system (ESP) control_system (ESP) control_system (ESP) brake_system brake_system

model_units body

angular_velocity rad/sec

(right) wheel_speed_front angular_velocity rad/sec

68 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

#

Name

Unit type

Unit string

Create transducer signal in: brake_system brake_system

10 (left) wheel_speed_rear 11 (right) wheel_speed_rear

angular_velocity rad/sec angular_velocity rad/sec

Note that five input transducer signals need to be created in the brake system template and one in the body template. This particular example of ABS system also uses five input signals from another control system, that is, the ESP controller (control system output channels). Units Please note the use of Unit Type and Unit String and how the units differ from those defined in the control system. Adams/Mechatronics will automatically convert the units from the transducer to the control system. Creating the transducer signals Open the template _brake_system_4Wdisk_mech_00.tpl from the <amech_shared> database:

Create the five transducer signals in the brake system. Use the following menu to display the dialog box for creating transducer signals:

We will start by creating the 'brake_demand' transducer signal. Use the Function Builder (click on the [...] button on the right) to enter the expression for the brake demand. After completing function expression in the Function Builder select Apply to go back to Create Transducer Signal dialog box and

Tutorials 69
Template Builder - Create ESP and ABS control Systems

fill the Function text field. Note that you have the possibility to set request and measure activity on or off, and if you set it on, you can select which unit you want the signal to be expressed in.

70 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

We use the same method to create the wheel_speed_front transducer signals. Note that the Unit Type and Unit String are changed to angular_velocity and rad/s, respectively. Also note that we here take advantage

Tutorials 71
Template Builder - Create ESP and ABS control Systems

of the left/right symmetry capability. Let's start by setting the expression for the front left wheel speed transducer signal:

72 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

Now we will set the expression for the right front transducer:

Tutorials 73
Template Builder - Create ESP and ABS control Systems

The reason why we ‘hardcode’ the unit string to rad/s is that the results from the solver variables left/righ_wheel_omega always are expressed in rad/s regardless of model units. Click Apply to execute the dialog box. Note that you have now created two transducers, ue[l,r]_cst_wheel_speed_front. Repeat this procedure for the rear wheel speed transducer signals (name them wheel_speed_rear). Save the template and then open the _rigid_chassis_lt_mech_00.tpl template from the <amech_shared> database. We will now create the body longitudinal velocity transducer signal:

Note the use of a scale factor of -1 to switch sign of the signal before sending it into the ABS controller. Save the body template. Proceed to create the actuator signals. Creating the actuator signals in brake system template We have now created all necessary transducer signals in the brake system and the body. Our next step is to create the actuator signals which control the brake torque in the brake system. Use View  Template to display the brake system template again.

74 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

The following actuator signals will be created:. # 1 2 3 4 Name (left) ABS_signal_front (right) ABS_signal_front (left) ABS_signal_rear (right) ABS_signal_rear Unit type Unit string Create transducer signal in: user user user user no_units no_units no_units no_units brake_system brake_system brake_system brake_system

Display the Create Actuator Signal dialog box via the menu Mechatronics  Mechanical System  Actuator Signal  New:

Click Apply. You have now created the two left/right actuators ue[lr]_csa_ABS_signal_front. Repeat for the remaining actuator signals left/right ABS_signal_rear. Connecting the actuator signals to the mechanical system To transfer the actuator signals into the mechanical system, in this case the brake torque, we will modify the existing expression used for the brake pressure.

Tutorials 75
Template Builder - Create ESP and ABS control Systems

Now use the menu Build  System Elements  State Variable  Modify to display the following dialog box (click on the [...] button to display the Function Builder). Start by modifying the ._brake_system_4Wdisk_mech_00.left_front_brake_line_pressure variable:

76 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

Note: 1. The use of Insert Object Name with the All Objects option to replace the selected item with the uel_csa_ABS_signal_front.signal_variable object in the expression in the top of the Function Builder. Click Apply in the Function Builder to load the new expression into the Modify State Variable dialog box, and then click Apply there too. 2. We created an expression where we use the signal_connection_flag of the actuator signal object to make this template fully compatible with use both with and without a control system. By using the formula (1 - signal_connection_flag) * brake_demand + signal_connection_flag * actuator_signal

Tutorials 77
Template Builder - Create ESP and ABS control Systems

we thus make the brake pressure dependent on the brake_demand instead of the control system signal when the actuator has not been connected, which of course happens if we do not have the control system subsystem in our assembly. Repeat this process for the remaining state variables: ._brake_system_4Wdisk_mech_00.left_rear_brake_line_pressure ._brake_system_4Wdisk_mech_00.right_front_brake_line_pressure ._brake_system_4Wdisk_mech_00.right_rear_brake_line_pressure For your reference, the following figures show how ADAMS looks for the right rear brake line pressure:

78 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

Save the template. Please proceed to the Standard User Mode to create the assembly and run an analysis, or proceed to create the ESP control system first. Create an ESP control system Now the ESP control system with following specification will be created:

Tutorials 79
Template Builder - Create ESP and ABS control Systems

Inputs: # 1 2 Name body_lat_acc body_yaw_rate Unit type acceleration Unit string mm/s
2

Create transducer signal in: body body

angular_velocity rad/sec

Outputs:: # 1 2 3 4 5 Name ESP_active ESP_signal_front_left ESP_signal_rear_left ESP_signal_rear_right Unit type user user user user Unit string no_units no_units no_units no_units no_units Create transducer signal in: control_system (ABS) control_system (ABS) control_system (ABS) control_system (ABS) control_system (ABS)

ESP_signal_front_right user

Note that the five output channels will be connected to input side of ABS control system we created earlier. This is just to illustrate the possibility to connect several control systems to each other. Therefore no additional actuator signals need to be created in the mechanical system. Creating the control system In this example, we choose to create the control system in a separate template with the major_role control_system. Note that we could have chosen to create the control system in any template instead. There is no limitation in this regard.

80 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

Display the Create Control System dialog box via the menu Mechatronics  Control System  New:

Tutorials 81
Template Builder - Create ESP and ABS control Systems

Click on the button in the lower left side of the Create Control Signal dialog box, to display a new dialog box in which you can specify information for each input and output signal:

Close the message windows and save the template. Proceed to creating the transducers.

82 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

Creating the transducer signals To feed the ESP controller with input signals from the vehicle model, we will add virtual transducer signals in the body template. The following transducer signals will be created: Inputs to the ESP control system were:: # 1 2 Name body_lat_acc body_yaw_rate Unit type acceleration Unit string model_units Create transducer signal in: body body

angular_velocity rad/sec

Units Please note the use of Unit Type and Unit String and how the units differ from those defined in the control system. Adams/Mechatronics will automatically convert the units from the transducer to the control system. Creating the transducer signals In the _rigid_chassis_lt_mech_00 template that you modified earlier, we will now create the body longitudinal velocity transducer signal.

Tutorials 83
Template Builder - Create ESP and ABS control Systems

We will start by creating the 'body_lat_acc' transducer. Use Mechatronics  Mechanical System  Transducer Signal  New to display the following dialog box:

84 Adams/Mechatronics

Template Builder - Create ESP and ABS control Systems

Create the yaw velocity transducer signal:

Save the body template and close it. You have now successfully finished the Adams/Car Mechatronics Template Builder tutorial.

Tutorials 85
Standard Interface - Use Signal Manager and run interactive analyses

Standard Interface - Use Signal Manager and run interactive analyses
Overview This tutorial guides you through the process of how to connect control systems, run full vehicle simulations with different setup of the control systems, and review the results in the Standard Interface mode. The process of adding disturbance signal is also covered here. It is assumed that you have already started Adams/Car and loaded the Adams/Mechatronics plugin. The main steps in the tutorial are listed as:
• Open assembly which includes ABS and ESP control systems • Connect control systems with Signal Manager • Run analyses with ESP turned on and off • Review the result differences • Add disturbance and rerun the analysis • Study disturbance results • Study delay result

Open assembly which includes ABS and ESP control systems Open the demo assembly model MDI_Demo_Vehicle_lt_ABS_ESP_00.asy located in the Adams/Mechatronics shared database:

The assembly originates from a standard Adams/Car demo model with two additional subsystems added, the ABS and the ESP (Electronic Stability Program) control subsystems. The control systems are not yet connected to each other or to the mechanical model.

86 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

Examine and verify the connectivity status of the control systems in the assembly by choosing Mechatronics  Info  Connectivity… The Info Connectivity dialog box below shows the number of existing control systems in the assembly.

Connect control systems with Signal Manager The next step is to define how the control systems are connected to the transducer and actuator signals of the mechanical system. To do this, go to the Signal Manager using Mechatronics  Signal Manager. First the Signal Manger – Select Assembly will show up to let you select from the active assemblies. In

Tutorials 87
Standard Interface - Use Signal Manager and run interactive analyses

addition, here you can see how many control system exist in each assembly as a text under the Assembly field. By selecting OK or Apply the Signal Manager dialog box will be displayed.

Here you can review all existing control systems in the selected assembly and then select one by doubleclicking on control system name or any cell in the row. Let’s start with the ABS control system by doubleclicking on ues_ABS cell or any other cell in the same row.

88 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

Now the Signal Manager loads the selected control system information such as the (control) System Name, its corresponding Major Role, Minor Role, and Comment. Furthermore, it lists all existing ports in two separate Inputs and Outputs tables.

Tutorials 89
Standard Interface - Use Signal Manager and run interactive analyses

Note that:
• Each table is divided into white and gray areas; the gray areas are related to port information

(name and unit type) of the control system and the white areas are related to connectivity information (connected signal name, major, and minor role), i.e., information of connected signals to the ports
• In Inputs table, the columns related to Connected Signal (white area) are in the left side of the

table whereas in Outputs table, they are in the right side of the table. This is basically to resemble the following model. Input and output signals are normally connected to the control system from left and right side, respectively.

The next step is to connect the proper signals to the ports in which the Connected Signal Name column shows ‘Connectivity Is NOT SET’. By clicking on the each cell related to connectivity information (white area), a new windows pops up where you select and connect the appropriate (transducer or control system output) signal to the selected input port name.

Getting familiar with Selecting Input… dialog box • On the top of Selecting Input dialog (first row), information related to selected input port index, port name, unit type, and comment is displayed.

90 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

• By changing the port index (leftmost field in the first row) you can display the other input ports

and edit the connectivity information.
• Clicking on Connectivity info button (rightmost in the first row) you can see whether any signal

is already connected to the port. The usage of this button is concerned with cases where a port might be connected to a signal from a previous model.
• The second row shows which signals are already connected (or selected to be connected) to the

input port, and its major and minor roles.
• Clicking the Unselect button (leftmost in the either row) unselects the selected connector signal,

however, this will not take effect until the OK or Apply button is clicked.
• Available Signal List (lowermost field and table) displays all selectable signals in a table, i.e.,

(transducers or control system outputs) signals which have the same unit type as the input port. Let’s explain this by an example; in the current case, because the brake_demand signal has user unit type, all signals (either transducers or control system outputs) which have a unit type of user are listed in the table.
• The available signal list can be filtered by Signal Type (curtain menu) and Name Filter field.

This is to help you to find the appropriate signal more conveniently.
• You can select a signal (to be connected to a selected port) from the table by selecting one of the

signal’s cell and then clicking the Select button (lower leftmost). However, this will not take effect until either the OK or Apply button is clicked.
• Double-clicking on a signal in the table is implemented as a short cut for • select a signal • apply the selection • show the next port

This is to speed up the process of connecting signals to the ports one after another.
• When a signal from the table is already selected, it appears with blue background color in the

table.
• Similar to other dialog boxes in Adams, the OK button closes the Selecting Input dialog box and

returns to the previous window while the Apply button applies the changes and keeps the current dialog box open. Now try to get the feeling of the Selecting Input dialog box by connecting the input signals as shown in the following picture. As explained earlier, a quick way to select signals is to double-click on them (see

Tutorials 91
Standard Interface - Use Signal Manager and run interactive analyses

preceding explanation). After connecting all input signals, return to Signal Manager by clicking OK or Cancel.

92 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

Now we want to connect the Outputs signals. Therefore you go to Outputs table by selecting its tab as shown in following illustration.

Similar to the Inputs table, the port information (name and unit type) columns are distinguished by gray background, however, in contrary to the Inputs side, they are located in the left side of the table to resemble the following model illustration.

As can be read from the Outputs table, the “connectivity DOES NOT SET OR MATCH” for the output ports at the moment. Therefore we try to connect the output ports by using Selecting Output … dialog

Tutorials 93
Standard Interface - Use Signal Manager and run interactive analyses

box via double-clicking on Connected Signals column or any cell on the same row (white area). This will display the Selecting Output … dialog box.

Getting familiar with Selecting Output… dialog box The Selecting Output dialog box is very similar to Selecting Input dialog box except from that here the connected signal(s) are displayed in a table instead of a single row. The reason is that an output port can principally be connected to more than one actuator signal or control signal input. Knowing this, the other features are as follows.
• Connected Signal(s) table lists signals which are currently connected (or selected to be

connected) to the output port, and their signal type, symmetry, major role, minor role, and comment.
• Use Unselect button (lower the connected signal(s) table) to unselect one or several connected

signals from the table. However, keep in mind that this will not take effect until either the OK or Apply button is clicked.
• Use Unselect All buttons (lower the connected signal(s) table) to unselect all connected signals

in the table. However, again note that this will not be applied until either the OK or Apply button is clicked.
• The Available Signal List is similar to the Input side, however, in the output port side, only

actuators and control system inputs of the appropriate unit type are listed. As an example, in current case, all signals (either actuators or control system inputs) that have a unit type of user are listed in the table because the signal ABS_Signal_fl has user unit type.

94 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

• You can select one or more signals (to be connected to a selected port) from the table by

selecting on one of the signal’s cells and then clicking the Select button (leftmost lower). Use the Ctrl button on your computer keyboard to choose more than one signal. By pressing select, the selected signal will appear in upper table, however, the selection will not take effect until either the OK or Apply button is clicked.
• If one or several signals are selected by clicking the Select button, their cells’ background color

changes from white to blue in the Available Signal List table and consequently they will also appear in the Connector Signal(s) table.
• If a signal (actuator or control signal input) appears with gray background color in the Available

Signal List table, it means that the signal has been already connected to an output port and therefore can not be selected.
• Right-clicking on the comment column in the Available Signal List table pops up a small window

where it is possible to review the connectivity information and a Disconnect Signal button for disconnecting the signal to make it available for selection.

• Double-clicking on a signal in the table is a short cut for • select the signal • apply the selection • show the next port

Now try to get the feeling of Selecting Output … dialog box by connecting the input signals as shown in the following figure. As explained earlier, a quick way to select signals is to double-click on them (see

Tutorials 95
Standard Interface - Use Signal Manager and run interactive analyses

preceding explanation). After connecting all input signals, return to Signal Manager by selecting OK or Cancel.

By now you have completed the setup of the ABS control system connections. Now we go back to select and setup the EPS control system by clicking the Arrow Icon on the top-left of the Signal Manager.

96 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

Proceed then by repeating the preceding steps for the ESP control system by selecting (double-clicking) the ESP control system:

Tutorials 97
Standard Interface - Use Signal Manager and run interactive analyses

Note that the ESP control system outputs already have the proper connections to the ABS control system. In fact, they have been set in the previous steps (input side of ABS control system). Press OK in the Signal Manager dialog box and following text will appear in the message window:

98 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

Now use the info connectivity feature for verifying that all control system inputs and actuator signals in the assembly are properly connected:

Save the assembly and the subsystems via File  Save. Note due to the connections that were defined by using the Signal Manager following subsystems have been modified:
• ABS_system_00.sub • ESP_system_00.sub • TR_Brake_System_mech_00.sub

All these subsystem files have now been updated with the appropriate connectivity data. This means that next time you open the assembly, all connections are already made. Run the analyses with ESP turned on and off Now we will submit a single lane change manoeuvre to see how the ESP influences the handling behavior of the vehicle. The ESP control system is activated by default. Before executing the full vehicle analysis and to compare the results later on, we need to activate two requests from the ESP control system outputs. Start to modify the ESP control system output

Tutorials 99
Standard Interface - Use Signal Manager and run interactive analyses

ESP_signal_fl by using Mechatronics  Control System  Output. This displays the following dialog box:

Repeat the same step for the ESP control system output ESP_signal_fr

100 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

Now submit the single lane change analysis with the following settings:

Tutorials 101
Standard Interface - Use Signal Manager and run interactive analyses

During the read property file procedure the control system inputs and actuator signals get connected:

102 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

We are now going to deactivate the ESP controller to compare the results. Use Mechatronics  Control System to display the following dialog box:

Set the activity to 'off' and select OK. The following message window appears:

Consequently, we have now deactivated the ESP controller. Therefore, all the control system inputs of the ABS system which were dependent on the output from the ESP have been disconnected, meaning that they will receive zero values on those channels. Rerun the analysis with the same settings as before.

Tutorials 103
Standard Interface - Use Signal Manager and run interactive analyses

Review the result differences Open the post processor and select the body yaw rate signal as shown in the following picture:

Clearly, deactivating the ESP causes the car to reach much higher yaw rates during this particular manoeuvre. Please note that Adams/Mechatronics has predefined requests for all types of control signals: ..._model_units (expressed in model units): ..._signal_units (expressed in transducer/actuator signal specific unit) Add disturbance and rerun analysis Now a sinusoidal disturbance signal will be added to the ESP control system input body_yaw_rate.

104 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

But before that, first activate the ESP control system again and proceed by displaying the control signal dialog box using Mechatronics  Control System  Input:

Choose to add a disturbance ASCII file (sin_amp1to5_freq2_3s.daf) from the shared database and activate all requests in the general tab container. All control system inputs and output requests are deactivated by default.

Tutorials 105
Standard Interface - Use Signal Manager and run interactive analyses

The beginning of the disturbance file looks like:

In this case the channel label signal1 is chosen and according to the channel unit block the channel unit is deg/s. With raw signal amplitude of 1 from the file and a channel scale factor set to 2 in the dialog box, we can expect a disturbance amplitude of 2 deg/s. Now change the values for the End Time and Number Of Steps to 3 sec and 300 steps respectively and rerun the analysis.

106 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

Study disturbance results Open the postprocessor and select the different result set components available for the ESP control system input body_yaw_rate as following figure:

The following result set components are available for the request ues_csi_ESP_body_yaw_rate_model_units: ..._model_units.signal (signal into ESP control system): ..._model_units.disturbance (sinusoidal signal with amplitude of 2 deg/s) ..._model_units.undisturbed_signal (received from connected transducer signal) ..._model_units.function (same as undisturbed_signal in this case)

Tutorials 107
Standard Interface - Use Signal Manager and run interactive analyses

The disturbance affects the behavior of the ESP control system. Compare the new results from the ESP control system output signals ESP_signal_fl and ESP_signal_fr with those from the first run:

Add delay and rerun analysis Now you remove the disturbance and consider adding a delay time function. Go to Modify Control System Input dialog box and activate the delay with value of 0.02 s as illustrated in picture below. Select Apply. In order to run the analysis, you need to choose the C++ Adams solver as the delay function is defined in this solver. You can do this from the Settings  Solver  Selection … . Rerun the analysis, and go to the post processor to see the delay applied in the signal.

The delay affects the behavior of the ESP control system. Compare the new results from the ESP control system output signal ESP_signal_fl with one from the first simulation.

108 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

Tutorials 109
Standard Interface - Use Signal Manager and run interactive analyses

110 Adams/Mechatronics

Standard Interface - Use Signal Manager and run interactive analyses

You have now finished the tutorial.

Tutorials 111
Standard Interface - Setup and run co-simulation

Standard Interface - Setup and run co-simulation
Overview This tutorial guides you through the process in the Standard Interface how to setup a control system for a co-simulation analysis. Steps on how to perform the co-simulation from the control package software are also included. It is assumed that you have already started Adams/Car and loaded the Adams/Mechatronics plugin. The main steps in the tutorial are listed below:
• Open assembly which includes ABS and ESP control systems • Modify ESP control system type • Run full vehicle analysis setup • Export plant • Run co-simulation from control package software

Open assembly which includes ABS and ESP control systems Open the demo assembly model MDI_Demo_Vehicle_lt_ABS_ESP_01.asy located in the Adams/Mechatronics shared database:

112 Adams/Mechatronics

Standard Interface - Setup and run co-simulation

The assembly contains connectivity information about how to connect the different control system to each other and to the mechanical system. To verify the connectivity status of the control systems in the assembly by choosing Mechatronics  Info  Connectivity…

Tutorials 113
Standard Interface - Setup and run co-simulation

Modify ESP control system type Both control systems in the assembly are of type ‘Function Expression’. However, in this tutorial we want to use the co-simulation functionality and we will therefore modify the ESP control system. To modify control systems use Mechatronics  Control System  Modify and fill in the dialog box:

The control package settings above will be the default choices in the export plant dialog box.

114 Adams/Mechatronics

Standard Interface - Setup and run co-simulation

Run full vehicle analysis setup Submit a single lane change manoeuvre to use it for a co-simulation:

The mode of simulation choice ‘files_only’ is used create the Adams/Car solver files needed for cosimulation. All files will be created in the working directory.

Tutorials 115
Standard Interface - Setup and run co-simulation

The following message will inform the user that one control system is of type ‘CoSim’ and Adams/Mechatronics specific export plant dialog box will be displayed:

Press OK and select the previously generated file ESP_cosim_test_sin.adm in export plant dialog box. Keep default values of other the dialog box settings (also the Host Name):

Now everything is done in the Adams/Car environment. All files that the control package needs for the co-simulation are created.

116 Adams/Mechatronics

Standard Interface - Setup and run co-simulation

Run co-simulation from control package software Start MATLAB and change working directory to the directory where the Adams/Car files were created. At the MATLAB prompt type the name of the m-file, ESP_cosim_test_sin. All the signals are created. Copy the following MATLAB and Simulink example files from install_dir/amech/examples/simulink_models/esp_model to the working directory:
• esp_variables.m • esp_cosim.mdl

The ESP model requires some variables to be set so remember to read them in from the esp_variables.m by typing esp_variables at the prompt. Create the Adams block by typing adams_sys at the prompt. This builds a new model in Simulink named adams_sys.mdl. This model contains the block representing the mechanical system:

Tutorials 117
Standard Interface - Setup and run co-simulation

Open the esp_cosim model and replace the adams_sub block with the adams_sub block you just created. This ensures that the proper version of the block will be used.

118 Adams/Mechatronics

Standard Interface - Setup and run co-simulation

A tip is to flip the adams_sub block before replacing the old adams_sub_block (right mouse button click on adams_sub block  Format  Flip Block). Set Communication Interval to 0.01 sec in the Adams Plant block (adams_sub block  Adams Plant). This time increment value corresponds to the output time step set in Adams/Car analysis dialog box. Verify your block settings below:

Tutorials 119
Standard Interface - Setup and run co-simulation

Start the MATLAB simulation. After the simulation the scope plots for the body yaw rate, body lateral acceleration, ESP active signal, ESP demand front left and right will look as below:

The Adams result file ESP_cosim_test_sin.res can also be read into Adams for plotting the results in Adams/Postprocessor. You have now finished the Adams/Mechatronics Co-Simulation tutorial.

120 Adams/Mechatronics

Standard Interface - Create and use External System Library

Standard Interface - Create and use External System Library
Overview This tutorial guides you through the process of how to create and use external system libraries in the Standard Interface. It is assumed that you have already started Adams/Car and loaded the Adams/Mechatronics plug-in. The main steps in the tutorial are:
• Open an assembly which includes ABS and ESP control systems • Export Adams Plant • Create an external system library within a control system package • Import the library into Adams and create a library property file • Set ESP control system type to External System Library

Open an assembly which includes ABS and ESP control systems Open the demo assembly model MDI_Demo_Vehicle_lt_ABS_ESP_01.asy located in the Adams/Mechatronics shared database:

In this assembly, the ABS and ESP control systems have been already connected to each other and to the mechanical model properly.

Tutorials 121
Standard Interface - Create and use External System Library

Verify the connectivity status of the control systems in the assembly by choosing Mechatronics  Info  Connectivity.

Export Adams plant The next step is to export plant from Adams and create an external system library suitable for Adams within a control package, Easy5 or MATLAB/RTW. To export the plant, choose Mechatronics  Tools

122 Adams/Mechatronics

Standard Interface - Create and use External System Library

 Export Plant. Select the ues_ESP control system, choose a file prefix, and keep the default values in the rest of the dialog box:

Press OK and the following information dialog box below will appear.

Tutorials 123
Standard Interface - Create and use External System Library

In case of choosing MATLAB as target software, the following information dialog box will be shown instead.

Proceed by selecting OK. By now depending on the choice of control system, a .inf file or a .m file has been created and saved in the working directory. These files can then be used to create the input and output ports for the control system in the external control package. This is necessary in order to setup the external system library. Note that the export plant can similarly be performed in the template builder mode. Create an External System Library within the control package software The two related Easy5 model files for the ESP control system can be found in the directory install_dir/amech/examples/acar/easy5_models/esp_system:
• esp_controller.0.ezadb • esp_controller.0.ezmf

The corresponding model file for MATLAB/Simulink can be found in directory install_dir/amech/examples/acar/simulink_models/esp_model/esp_cosim.mdl These files should be used to create a library suitable for Adams within the control package. This procedure is covered in detail in standard Adams/Controls documentation. While creating external system library file, make sure to publish the parameters which are controlling the ESP control value, yaw rate gain and lateral acceleration gain when exporting the control system into an external system library format. If you intend to import a library built using Easy5, you will first need to ensure your environment has been properly set up. See Setting Up the Environment section for more information. In case you don't want to build a library here, use one of the provided 'esp_controller' libraries located in <amech_shared>/external_system_libraries.tbl/ directory. These were built using Easy5. Be sure to

124 Adams/Mechatronics

Standard Interface - Create and use External System Library

select the version appropriate for your platform and Adams installation. For example, if you are running 64-bit Adams on a 64-bit Windows machine, select the win64 version. If you are running 32-bit Adams on a 64-bit Linux machine, select the linux32 version. Import library into Adams and create a library property file It is now assumed that an external system library file is available. To import it and to generate a default library property file choose Mechatronics  Tools  ESL Property File ... The dialog box shown below will be displayed:

Choose the control system package which the library is originating from and type a name of the library property to be created. Then select OK. Please note that the External System Library file could be esp_controller.so if oyu are using UNIX operating system. A message window dialog box appears which confirms that a library property file has been created:

As can be seen from the preceding message window, a library property file is created and copied into the default database in the following directory, namely /private.cdb/external_system_libraries.tbl/win32/. Note that the resulted files are saved in a platform-specific directory depending on the platform type (in this case win32). You can now close Message Window. Set ESP control system type to ‘External System Library’ Modify the ESP control system to be of type ‘External System Library’ by choosing Mechatronics  Control System  Modify.

Tutorials 125
Standard Interface - Create and use External System Library

Select the External System Library as System Type. By this the control system depends on the external system library and the default function expression control system hides. Select the ESP control system and property file as below:

126 Adams/Mechatronics

Standard Interface - Create and use External System Library

First, review the content in the library property file by selecting the information window pops up.

button. The following

In fact, Adams/Mechatronics verifies also that the library referred to in the property file matches the control system, i.e., the number of inputs and outputs defined in the library is the same as in the control system. Close information windows and then select the Apply button. The information message window below appears after a successful verification:

The control system is now prepared to be used in simulation. You have now finished the tutorial.

Tutorials 127
Adams/View - Setup and run Ball and Beam model

Adams/View - Setup and run Ball and Beam model
Overview This tutorial will guide you through the process of creating control system, transducer signals, actuator signal, connect the signals and run a simulation. For this tutorial the ‘ball and beam’ example model delivered with standard Adams/Controls will be used as a base. The control system will later on uses the code generated from MATLAB/Simulink. The main steps covered in this tutorial are:
• Open and review the base model • Create the Control System • Create the Transducer Signals • Create the Actuator Signal • Applying the Control System • Connect Signals with Signal Manager • Export Plant • Create the MATLAB/Simulink External System Library • Create Easy5 External System Library (optional alternative to MATLAB ESL) • Generate ESL Property File • Modify Control System for new ESL Property File • Simulate Model with ESL • Create Disturbance and Delay and Simulate

128 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Open and review the base model Copy the tutorial directory <install_dir>/amech/examples/aview/tutorial_ball_beam to your working directory. Start MD Adams/View, and select the just created directory as working directory and import the Adams command file ball_beam_start.cmd to load the model.

This is a model of a ball rolling on a beam and the position of the ball will be controlled by a control system torque applied in the pin joint attaching the beam to the ground.

Tutorials 129
Adams/View - Setup and run Ball and Beam model

Create the Control System In this tutorial we will start with creating the control systems however, alternatively we could as well have started by creating the transducer and actuator signals. First we will create the regulator control systems. The MATLAB/Simulink model is shown with the required angle and positions input and the produced torque output. Alternatively the model can be created in Easy5.

Then we create a control system in Adams/Mechatronics. Load the Mechatronics plugin if it is not already loaded: Tools  Plugin Manager  Adams/Mechatronics Load (Yes)  OK Next, create the Control System: Mechatronics Control System  New…

130 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Fill in the dialog box as you see below, and then select the

icon to start the Control Signal Editor.

Control Signal Editor is used to define the Control Signal Inputs/Outputs specification such as Name, Unit Type, Unit String. Fill in the three control signal input names, unit type, and unit string as depicted below.

Tutorials 131
Adams/View - Setup and run Ball and Beam model

And then the control signal output specification as shown in next picture.

Then select OK in Control Signal Editor dialog box to close the dialog box and return to the Create Control System dialog box, where you select OK button again. The following Message Window informs you that the control system output signals will be set to zero since no property file was selected.

Close the dialog box by selecting the OK button. The following Message Window appears to verify that the control system with given specification are created. You can close the Message WIndow.

132 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Create the Transducer Signals Now you create the appropriate transducers so that you can connect the mechanical system to the control system, by using the menu Mechatronics Mechanical System  Transducer Signal  New …. Start with creating the transducers as the following pictures show. Here you may take advantage of the Function Builder by selecting icon to build the function expression. Make sure to activate the requests for all three transducers.

Tutorials 133
Adams/View - Setup and run Ball and Beam model

134 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Create the Actuator Signal Next you create an actuator signal using the menu Mechatronics  Mechanical System  Actuator Signal  New … You do not need to choose a function for actuator signal of controller_torque as its value is fed by the control system. Also note that for all signals so far, we have niether applied any disturbance nor any delay.

Applying the Control System Now you need to modify the torque function which is applied to beam so that it gets its value from the actuator. To modify the torque, double-click the background of the Adams/View main window to clear

Tutorials 135
Adams/View - Setup and run Ball and Beam model

any selections. From the Edit menu, select Modify which shows the Database Navigator. Then select the torque as shown below.

Connect Signals with Signal Manager Next you start the Signal Manager from Mechatronics  Signal Manager  Display … Select the Apply button, with the shown model to see the control system.

136 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Double-click any cell of the control system in the table to select the control system of interest.

As can be seen from the following picture, no signal is connected to the input ports of the controller, i.e., Connectivity is NOT SET.

Tutorials 137
Adams/View - Setup and run Ball and Beam model

Neither any signal is connected to the output port.

You can select and connect appropriate signals by double-clicking on any cell of interest that has a white background. For instance, start with a double-click on the first cell under the connected signal name in the inputs list. The Selecting Input… dialog box pops up. As you see, there is only one signal of unit type of Angle in Available Signal List. You select this signal to be connected the input port of beam angle by clicking on one of the corresponding cells in the table, and consequently selecting the select button in the lower-left area of the dialog box.

138 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Upon selecting the select button, the transducer signal name will appear in Selected Connector Signal Name. Select Apply to save the selection. Note that when a selection is saved, the corresponding row in the Available Signal List table gets a blue background color.

Now by changing Port Index counter, review the next input port, i.e., ball_postion.

As there are two signals of unit type of Length which can be seen in the Available Signal List table, you should select the ues_cst_ball_x_position_rel_beam transducer signal by double-clicking on one of the corresponding cell in the table. Note that after selection by double-clicking, you have automatically guided to the next (third) input port. Hint: Double-clicking in this table is short cut for selecting the signal, selecting the Apply button, and going to the next port.

Tutorials 139
Adams/View - Setup and run Ball and Beam model

In the third input port, select the ues_cst_ball_x_position_set_value by clicking in a cell in the corresponding row, clicking the select button, and then selecting the OK button to both confirm the selection and close the Selecting Input … dialog box in the same time.

Now you are back again in the page that you could review the input/output ports. As you see now all the input ports are connected to appropriate transducer signals.

140 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Similarly, you navigate to the output port side by selecting the Outputs tab and then by double-clicking the connected signal cell (white area) in the table, you go to the Selecting Output … dialog box.

Similarly, select the controller_signal to be connected to output port of the controller.

Tutorials 141
Adams/View - Setup and run Ball and Beam model

As a result, the selected actuator signal will show up in the connected signal(s) list. Click OK to confirm the selection and close this dialog box.

Now you can see that the torque_out output port is connected to controller_torque actuator signal.

142 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Select OK to confirm all selection you have done in the signal manager. The following message windows reports the connection made.

Export Plant You now export the plant in order to create the External System Library (ESL) file in MATLAB/Simulink or Easy5. Go to the Mechatronics  Tools  Export Plant Fill out the dialog box as shown below. In particular, select a File Prefix (in this case, ball_beam_export), verify the control System Name and Target Software have chosen correctly, and keep the default values for other parameters. Finally, select OK; the message window confirms that the MATLAB file ball_beam_export.m, or Easy5 ball_beam_export.inf has been successfully created.

Tutorials 143
Adams/View - Setup and run Ball and Beam model

Since this is an External System Library system, you will see this message:

Create the MATLAB/Simulink External System Library Now Start the MATLAB/Simulink and open the model ball_beam_amech.mdl which is provided in the example directory. Read in the file ball_beam_amech_param.m to set the PID parameters for the two PID-Controllers.

144 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Read in the exported plant file ball_beam_export.m. The following message appears.

Enter setio to generating the input and output ports in MATLAB/Simulink as depicted below.

Tutorials 145
Adams/View - Setup and run Ball and Beam model

You now merge the two models (ball_beam_amech.mdl and the io model) by connecting the signal and then save the model as ball_beam_amech_esl. The model should look like below.

Follow the instructions on how to generate the ESL file in standard Adams/Controls. In particular, you need to setup the Adams files for Real-Time workshop by manually running process.py or using the command setup_rtw_for_adams which will do this for you. Do not forget to verify that the PID parameters are defined as inline parameters (i.e. tunable parameters). Create Easy5 External System Library (optional alternative to MATLAB ESL) Copy the files from <install_dir>/amech/examples/ball_beam/easy5 into your working directory. The file from the Mechatronics Plant Export need to be in the same directory as the Easy5 model.

146 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Start Easy5 in your working directory and open the model ball_beam.0.ezmf. Double click on the Adams block and go to the Documentation/Configuration tab. Click on Select/Configure Adams model

Select the exported plant file and choose Function Evaluation - No Feed through as the simulation mode. Click Done in this dialog box and OK in the AD- Component Data Table dialog box to apply these changes. Now, go to the Build menu to create the External System Library Build  Export Model As ADAMS External System Library… The following dialogbox is displayed:

Tutorials 147
Adams/View - Setup and run Ball and Beam model

148 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

To expose the PID gains as design variables in Adams/View, change Use Design Parameters to Yes, and select gains K_GN2, K_GN3, K_GN4, K_GN5, K_GN6, and K_GN7 from the PID controller submodels. Select Export in this dialog box to create the ESL (that is, ball_beam.dll on Windows) and supporting ball_beam.xfe.ezanl file. You can now close Easy5. Generate ESL Property File Now go back to Adams/View to generate ESL property file via Mechatronics  Tools  ESL Property File … Select the Control Package to use, as well as the .dll just created in MATLAB or Easy5. Choose a name of the property file you want, as well as the location of the property file, as shown below:

Upon successful creation of the ESL property file, you will see the following message:

The generated ESL file looks like the following. $---------------------------------------------------------MDI_HEADER [MDI_HEADER] FILE_TYPE = 'esl' FILE_VERSION = 2.0 FILE_FORMAT = 'ASCII' HEADER_SIZE = 9 (COMMENTS) {comment_string}

Tutorials 149
Adams/View - Setup and run Ball and Beam model

'Number of Inputs = 3, Number of Outputs = 1' $------------------------------------------------------------ROUTINE [ROUTINE] CONTROL_PACKAGE = 'MATLAB' LIBRARY = 'ball_beam_amech_esl' ROUTINE = 'ball_beam_amech_esl' $----------------------------------------------------------PARAMETER [PARAMETER] d_gain1 = 1.3 d_gain2 = 0.16 i_gain1 = 0.0 i_gain2 = 0.005 p_gain1 = 1.0 p_gain2 = 0.2 $------------------------------------------------X_INITIAL_CONDITION [X_INITIAL_CONDITION] IC_state_1 = 0.0 IC_state_2 = 0.0 IC_state_3 = 0.0 IC_state_4 = 0.0 IC_state_5 = 0.0 IC_state_6 = 0.0 IC_state_7 = 0.0 IC_state_8 = 0.0 $-----------------------------------------------XD_INITIAL_CONDITION [XD_INITIAL_CONDITION] Modify Control System for new ESL Property File Select Mechatronics  Control System  Modify … to select the generated ESL property file as input for the control system.

150 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Upon selecting Apply, the library file is verified, i.e., checking the number of inputs/outputs of library file vs control system defined in Adams.

Simulate Model with ESL Next, perform a 4 second, 400 step simulation as follows.

After finishing simulation, go to the Adams/Post Processor to review the results. Save your results as “Original_ana”.

Tutorials 151
Adams/View - Setup and run Ball and Beam model

The following plot illustrates the actual and desired ball position with respect to time.

The beam angle signal can now be plotted both in signal unit (rad) and model units (deg) as shown below.

152 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

And finally the torque from the controller.

Create Disturbance and Delay and Simulate Now you apply some disturbance and compare the results. Switch back from Adams/PostProcessor to Adams/View.

Tutorials 153
Adams/View - Setup and run Ball and Beam model

Go to the Mechatronics  Mechanical System  Transducer Signal  Modify… to modify the ball_position signal by adding a disturbance signal as shown below.

154 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Rerun the simulation, save the result as “Disturbance_Run”, and plot the result. You can easily plot the different signal components as depicted below. You may refer to the online help to review the request definition with existence of disturbance.

Review the disturbance effect on output torque.

Tutorials 155
Adams/View - Setup and run Ball and Beam model

Now return to Adams/View and you deactivate the disturbance by modifying the Transducer Signal shown below:

156 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

And apply a Delay of 0.03 sec

Set the solver type to C++ (which must be used to support the DELAY function) and rerun the simulation. Save the analysis result as “Delay_Run”, and plot the following requests to observe the difference in ball

Tutorials 157
Adams/View - Setup and run Ball and Beam model

positions. Delay can be seen ball_x_position.signal and ball_x_position.function. For more information on the details of the delay function, see Solver guide, DELAY function.

And review the effect of applied delay on the controller torque.

158 Adams/Mechatronics

Adams/View - Setup and run Ball and Beam model

Tutorials 159
Adams/View - Setup and run Excavator model

Adams/View - Setup and run Excavator model
Overview This tutorial will guide you through the process of creating four systems in Easy5, connecting the signals in Adams/Mechatronics and running a simulation for the combined system. For this tutorial a model of an excavator is used. The control systems are imported as four different external library files and consist of three different PI-controllers and a simple hydraulic system. The main steps covered in the tutorial are:
• Open the model and perform a test simulation • Create external system library files • Create four control systems • Create transducer signals • Create actuator signals • Apply the control system to the mechanical system • Connect the signals in signal manager • Simulate the model and review the results

160 Adams/Mechatronics

Adams/View - Setup and run Excavator model

Import the model file and simulate a test. First, copy the tutorial directory <Adams installation>/amech/examples/aview/tutorial_excavator to your working directory. Start MD Adams/View, select the just created directory as working directory and import the Adams command file excavator_start.cmd to load the model.

This is a model of an excavator where the turret, boom, arm, and bucket are controlled by four different motion statements. In this tutorial the motions for moving the hydraulic cylinders for the boom, arm and bucket will be replaced by a hydraulic system controlled by three different controllers. First examine how the excavator moves using motions by performing a scripted simulation using the motions. A simulation script named simple_run is prepared. This simulates 25 seconds with 1250 output steps and starts with an initial equilibrium simulation.

Tutorials 161
Adams/View - Setup and run Excavator model

Simulate  Scripted Controls…

Animate the results to see how the excavators move. The motion of the hydraulic cylinders will be used as the desired values sent to the controllers that will regulate the hydraulic system to deliver correct forces. Go to the Postprocessor tool by pressing F8, switch the Source to Result Sets, and plot the desired boom displacement boom_ACT_set_value and then overlay the actual boom hydraulic cylinder position boom_l_ACT_EZ5_position. Note that they follow each other since the system is controlled by a motion

162 Adams/Mechatronics

Adams/View - Setup and run Excavator model

statement. After reviewing the results, leave your Adams session open so that you can work on the model later. Otherwise, you will need to reload the model after finishing the next section.

Create External System Library files In this tutorial we will start with creating the four control systems, but we could as well have started by creating the transducer and actuator signals. But before we use the control systems in Adams we need to build the Easy5 External System Libraries (ESL’s) and we also need to create property files in Adams/Mechatronics to be able to import the external control systems. Start by opening MSC Easy5 and open the model arm_controller found in <adams_installation>\amech\ examples\aview\

Tutorials 163
Adams/View - Setup and run Excavator model

tutorial_excavator\easy5 folder. In Easy5 you now have a model of a PI controller and an Adams block as illustrated below.

Please note that in all control systems in this tutorial the Adams block is already defined and exists to save time. In a real application, the Adams block should be manually created or defined. This procedure has been covered in standard Adams/Control manual in detail or tutorial for ball and beam example of Adams/Mechatronics. The procedure can be summarized as follows: 1. define the (number/name of inputs/outputs of) control system in Adams/Mechatronics 2. perform a Plant Export in Adams/Mechatronics 3. create an Adams block in the control system package from the exported plant, and 4. connect the control system and Adams block as depicted in the above picture.

164 Adams/Mechatronics

Adams/View - Setup and run Excavator model

The above controller, similar to all other controllers in this tutorial, is a simple PI-controller that takes a desired signal and a feedback signal as input and delivers a current output that will control the servo valve in the hydraulic system.

We need to export this model to get our external system library from Easy5. In Easy5, from the top menu select Build menu  Export Model As  Adams External System Library… .

Tutorials 165
Adams/View - Setup and run Excavator model

The following dialog box is displayed

Make sure that in General tab the value for Use Design Parameters is set to Yes (this enables the previously selected Easy5 parameters in arm_controller.0.ezadb to be used as design parameters in Adams) and then select Export and then close the dialog box. Upon a successful model export, a library file is generated called arm_controller.dll (.so, .sl) located in the Easy5 working directory.

166 Adams/Mechatronics

Adams/View - Setup and run Excavator model

Now redo the same steps for the boom_controller, bucket_controller and the hydraulic_system model to build all necessary External System Libraries). After exporting the ESL's from Easy5, you may close Easy5. Create External System Library Property Files We now need to create External System Library property files to be able to use these libraries in Adams/Mechatronics in a effective way. In Adams/View, using the excavator model from the previous section, create the External System Library property files: Mechatronics  Tools  ESL Property File… . (Note that these Mechatronics menus are loaded by the Mechatronics Plugin. In this case, the plugin was automatically loaded by this Adams model, but this can be loaded manually by selecting Tools  Plugin Manager  Mechatronics  Load) The following dialog box displays where you need to fill in the external system library file name, the ESL property file name, and make sure the Target Directory is your working directory.

Select OK or Apply to create the ESL property file. You should see a message similar to the following in Adams: Copying 'file://C:/examples/aview/tutorial_excavator/easy5/arm_controller.dll' to 'file://C:/ /examples/aview/tutorial_excavator/win32/arm_controller.dll'. Copying 'file://C:/examples/aview/tutorial_excavator/easy5/arm_controller.xfe.ezanl' to 'file://C:/examples/aview/tutorial_excavator/win32/arm_controller.xfe.ezanl'. Copying 'file://C:/examples/aview/tutorial_excavator/easy5/arm_controller.dll.manifest' to 'file://C:/examples/aview/tutorial_excavator/win32/arm_controller.dll.manifest'. Library property file 'file://C:/examples/aview/tutorial_excavator/arm_controller.esl' is created successfully.

Tutorials 167
Adams/View - Setup and run Excavator model

Now, create ESL property files also for the other External System Library files i,e., boom_controller, bucket_controller, and hydraulic_system. Use the same name for the ESL property file name as the ESL file name. Create Control Systems Next we will create the four control systems in Adams/Mechatronics of external system library type. From the top menu select Mechatronics  Control System  New… to show the Create Control System dialog box. You select the control system and type, the external Library Property File (.esl), and number of inputs and outputs as shown in the figures below.

Before selecting OK or Apply, select icon on the lower left corner to start the Control Signal Editor, where the input/output ports, unit types, unit strings, and so on are defined. Click on the first cell below the Signal Name column and start to fill the table as following picture depicts. It is required that the signals are defined in the same order as the External System Library. By defining the correct units that the external control system expects, Adams/Mechatronics automatically converts the signals to correct units. The output signal is created in the same way, but in this case we set the unit type to user since current is not defined in Adams/Mechatronics. This output signal will later be connected to an input in the hydraulic system that expects a current signal.

168 Adams/Mechatronics

Adams/View - Setup and run Excavator model

Then select OK in Control Signal Editor, followed by OK in the Create Control System. A message window verifies that the control system inputs/output have been created as shown below.

Tutorials 169
Adams/View - Setup and run Excavator model

Two more control systems for the other two controllers also needs to be created in the same way as above, with the following specifications. Control system name: boom_controller Library property file: boom_controller.esl Inputs: # Name Unit type Unit string Scale Model units Model units 1.0 1.0

1 boom_demand length 2 boom_position length Outputs: # Name

Unit type Unit string Scale Model units 1.0

1 boom_cur_sig user

Control system name: bucket_controller Library property file: bucket_controller.esl Inputs: # Name Unit type Unit string Scale Model units 1.0 Model units 1.0

1 bucket_demand length 2 bucket_position length Outputs:: # Name

Unit type Unit string Scale no_units 1.0

1 bucket_cur_sig user

Now we will create the control system for the hydraulic system in the same way, but with 11 inputs and 4 outputs. The hydraulic system needs a current input for each hydraulic cylinder to regulate the servo valve which controls the hydraulic cylinder. Hydraulic cylinder position and velocity are also sent as feedback to the hydraulic control system. Output from the hydraulic system is four cylinder forces. This

170 Adams/Mechatronics

Adams/View - Setup and run Excavator model

totally yields 11 inputs and 4 outputs. Now create the hydraulic control system as shown in the following figures.

The inputs should be defined as the following figure shows.

Tutorials 171
Adams/View - Setup and run Excavator model

And the output should be defined as the following figure shows.

Then select OK in Control Signal Editor, followed by OK in the Create Control System. A message window verifies that the control system inputs/output have been created. By now we have created all the control systems needed for the model. Next we will move on to create the transducer signals that will feed the control systems with appropriate information. Create Transducer Signals To feed the control systems with input signals from the mechanical model, virtual transducer signals are created. We need to create transducer signals that measure the hydraulic cylinder positions and velocities. We start with one of the arm transducers. Go to Mechatronics  Mechanical System  Transducer Signal  New… to create the first transducer according to picture below. Note that you have the possibility to set request and measure activity on or off.

172 Adams/Mechatronics

Adams/View - Setup and run Excavator model

You may use Mechatronics  Info  Signals… to verify that the rest of the transducers are already prepared according to the table below.. Name arm_velocity arm_set_value Boom_l_position Boom_l_velocity Boom_r_position Boom_r_velocity Boom_set_value Bucket_position Bucket_velocity Function VARVAL(arm_ACT_set_value) Unit type length Unit string Model units Model units Model units Model units Model units Model units Model units Model units Model units Model units

VZ(MARKER_65,MARKER_66,MARKER_66) velocity DZ(MARKER_63,MARKER_64,MARKER_64) length VZ(MARKER_63,MARKER_64,MARKER_64) velocity DZ(MARKER_61,MARKER_62,MARKER_62) length VZ(MARKER_61,MARKER_62,MARKER_62) velocity VARVAL(boom_ACT_set_value) length DZ(MARKER_67,MARKER_68,MARKER_68) length VZ(MARKER_67,MARKER_68,MARKER_68) velocity length

Bucket_set_value VARVAL(bucket_ACT_set_value)

Tutorials 173
Adams/View - Setup and run Excavator model

You have now created all necessary transducer signals in the mechanical system. Our next step will be to create the actuator signals which control the hydraulic cylinders. Create Actuator Signals Actuator signals are signals that are received from the control system and should be connected to the mechanical system. In this case there are four hydraulic cylinder force signals that should be connected to the system. First we need to create the actuators and then we need to use them in the mechanical system. Display the Create Actuator Signal dialog box via the top menu Mechatronics  Mechanical System  Actuator Signal  New… to create an actuator signal according to the figure below.

Select OK or Apply to create the actuator signal. You may use Mechatronics  Info  Signals … to verify that the actuator signals for the boom and bucket are already prepared in the model. Apply the control system to the mechanical system Next we need to reference these actuator signals in the mechanical system. This is done by modifying the force statements that are used in hydraulic cylinders. The actuator signal is stored in a variable named

174 Adams/Mechatronics

Adams/View - Setup and run Excavator model

signal_variable under the actuator signal object. The force function should be set to get the value of this signal. To modify the arm_ACT_actuator, you may use the top menu Edit  Modify and look for all forces using Filter. See figure below for how to modify the arm_ACT_actuator force.

Next, continue to modify the remaining forces, that is, boom_l_ACT_actuator, boom_r_ACT_actuator, bucket_ACT_actuator to reference the corresponding actuator signal variable. Connect the signals in Signal Manager The next step is to define how the control systems are connected to the transducer and actuator signals. To do this, go to the Signal Manager using the menu Mechatronics  Signal Manager  Display… First the Signal Manager – Select Model will show up to let you select from the active models (in this case only one model exists, that is, excavator_model). Additionally you can also see how many control systems exist in each model.

Tutorials 175
Adams/View - Setup and run Excavator model

By selecting Apply the Signal Manager will be displayed. In the Signal Manager you can review all existing control systems in the selected model and then select one by double clicking on the control system name.

Let us start with the arm controller and double click on ues_arm_controller cell (or on any other cell in the same row). Now the Signal Manager loads the selected control system information and lists all existing ports in two separate Input and Output tabs. Note that:
• Each table are separated into white and gray areas; the gray area are related to port information

(name and unit type) of the control system and the white area is related to connectivity information (connected signal name), that is, information of connected signals to the ports

176 Adams/Mechatronics

Adams/View - Setup and run Excavator model

• In Inputs table, the columns related to Connected Signal (white area) are in the left side of the

table; whereas in Outputs table they are in the right side of the table. This is basically to resemble the signal flow model illustrated in the following figure. Input and output signals are normally connected to the control system from left and right side, respectively.

Tutorials 177
Adams/View - Setup and run Excavator model

By double clicking on “Connectivity Is NOT SET” cell, the Selecting Inputs dialog box will be displayed as follows.

Getting familiar with Selecting Input… dialog box • On the top of Selecting Input dialog box (first row), information related to selected (in previous step) input port index, port name, unit type, and comment is displayed
• By changing the port index (leftmost field in the first row) you can navigate through other input

ports and edit the connectivity information
• Second row shows which signal are connected (either already or selected to be connected) to the

input port, and its corresponding major and minor role
• Clicking the Unselect button (leftmost in the second row) unselects the selected connector

signal, however, this will not take effect until the OK or Apply are selected
• Available Signal List (above the table) displays all selectable signals in a table, that is,

(transducers or control system outputs) signals which have the same unit type as the input port. Let’s explain this by an example. In current case as the arm_position signal has length unit type, all signals (either transducers or control system outputs) which have a unit type of length are listed in the table
• The available signal list can be filtered by Signal Type (‘curtain’ menu) and Name Filter field.

This is to help you to find the appropriate signal more conveniently
• You can select a signal (to be connected to selected port) from the table by selecting one of the

table cell in which signal attributes are shown and then clicking the Select button (lower below table). However, this will not take effect until the OK or Apply are subsequently selected
• Double-clicking on a signal in the Available Signal list table is implemented to be a short cut for • selecting a signal • applying the selection • showing the next port.

178 Adams/Mechatronics

Adams/View - Setup and run Excavator model

This is to help you in the process of connecting signals to the ports one by one.
• When a signal from the table is already selected, its row in the table have blue background color

in the table
• Similar to other dialog boxes in Adams, OK closes the Selecting Input dialog box and returns to

the previous windows while Apply button applies the changes and keep the current dialog box alive Now try to get the feeling of Selecting Input dialog box by connecting ues_cst_arm_set_value to arm_demand. As explained earlier, you may just double click on ues_cst_arm_set_value which select the signal and lead you directly to the next port, that is, arm_position. Similarly, select ues_cst_arm_position to be connected to arm_position and then select OK. The arm_controller input signals should be connected as the following picture.

The outputs from the control systems will remain unassigned for now (those will get completed when dealing with hydraulic system controller). Select icon in top left area of dialog box to continue

with the input side of the boom and bucket controller in a similar way as following pictures shows.

Tutorials 179
Adams/View - Setup and run Excavator model

Next, continue with the hydraulic system controller and connect the input signals according to the following figure.

180 Adams/Mechatronics

Adams/View - Setup and run Excavator model

Now we want to connect the Outputs signals. Therefore we select the Outputs tab and select the appropriate signal connections as shown in following illustration.

After connecting all input signals, return to Signal Manager by selecting OK.

Tutorials 181
Adams/View - Setup and run Excavator model

Next, display the arm controller again to verify that the output is now connected to the hydraulic system. By now, you have completed the setup of assigning all transducer and actuator signals to the control systems. Select OK twice to go back to the main Adam windows. A message window pops up with messages confirming that the control system signals are connected. Deactivate the Motions Before performing a simulation, we need to deactivate the motion statements used in the introductory simulation. First from the top menu, select Edit  Deselect All to make sure that nothing is selected, then from top menu select Edit  Deactivate This will open the Database Navigator. In the list find and select, arm_Motion, boom_Motion, and bucket_Motion (following picture) and select OK. This will deactivate the motion statements that were used to control the motion of the excavator.

Simulate the model and review the results Rerun the simulation script that was used in the beginning of this tutorial and animate the model again. Once again plot the signal ues_cst_boom_set_value in the Adams/Postprocessor and then overlay the

182 Adams/Mechatronics

Adams/View - Setup and run Excavator model

actual boom hydraulic cylinder position ues_cst_boom_l_position. Note the difference of using these control systems instead of the motion controlled system.

You have now finished this tutorial.

Dialog Box - F1 help 1

Dialog Box - F1 help

2 Adams/Mechatronics
Connectivity Information

Connectivity Information
Mechatronics -> Info -> Connectivity

Displays information on all actuator signals and control system inputs connections in an assembly. For the option: Model Display in information window Save information to a file Do the following: Enter the name of the model. If you check this option, you can see the information in a window. If you check this option, you can write the file name in the adjoining field, and the information will be saved to the provided file.

Dialog Box - F1 help 3
Control System Overview

Control System Overview
Mechatronics -> Info -> Control Systems

Displays overview information about the control system(s) in the model. For the option: Model System Side Do the following: Select the model you want to get information about. Select the type of signals you want to include in the overview.
• Both Input and Output • Only Input • Only Output

All Systems / Single System Select one or all control systems.

Signal View Options

Select the content of the information. You can select:
• Unit Types • Unit Strings • Scale factors • Request/Measure • Connector Info • Comments • Disturbances • Delay

Display in information window Save information to a file

If you check this option, you can see the information in a window. If you check this option, you can write the file name in the adjoining field, and the information will be saved to the provided file.

4 Adams/Mechatronics
Convert Controls Plant

Convert Controls Plant
Mechatronics -> Tools -> Convert Controls Plant...

Converts Controls Plant. For the option: Controls Plant Do the following: Select the Controls Plant to be converted.

Dialog Box - F1 help 5
Create/Modify Control System

Create/Modify Control System
Mechatronics -> Control System -> New/Modify

Creates or modifies a Control System. For the option: Name Type Do the following: Enter the name that you want assigned to the control system. This option is only available in Adams/Car. (In Adams/View this option is disabled as there is no symmetry). Select one of the following:
• left/right - Define if the left or the right signal are displayed in the

dialog box. The corresponding opposite control system will be created/modified in the same manner.
• single - A nonsymmetric control system will be created/modified.

System Type

Here you can select among the following alternatives: 1. Function Expression The controller is expressed by its output control signals as function expressions of input signals. For instance, a control system with 4 inputs and 2 outputs:
output1 = 3*input1 + 2*input2 / 6*input3 - input4 output2 = -9*input1 * 2*input2 + 12*input3 / input4

In addition to the control system inputs, the output could also be dependent on any other Adams/Solver entity. If other solver entities are used in the function expressions and they are only valid when the control system type is set to function, use select objects dialog box for activating/deactivating the entities which are dependent on the type and activity of the control system. 2. External System Library The controller is modelled in Matlab/Simulink or Easy5. By using Real-Time Workshop (RTW) in Simulink or code generator in Easy5, together with Adams interface routines, a dynamic link library file can be created to be used in Adams/Controls and Adams/Mechatronics. In order to effectively access the library file in Adams/Mechatronics, a special external system library property file (*.esl file) is created. Learn more about Control System Import. 3. Co-Simulation The controller is defined in a separate control application and the (discrete) communication between Adams and the control application is handled via the Co-Simulation functionality in Adams/Controls.

6 Adams/Mechatronics

Create/Modify Control System

For the option: Library Property File

Do the following: If you selected the External System Library option as the controller type, you need to select an ESL property file (*.esl) which points to the ESL (aka dynamic link library) file. In Adams/Car you may postpone selecting ESL property file to the Standard User mode prior to starting the simulation. While in Adams/Car the ESL property file is saved in the Adams/Car database under the external_system_libraries.tbl directory, in Adams/View it is saved in a user specified target directory. The ESL file itself, is saved in a subdirectory named as the operative system platform (e.g. win32 in Windows), which is located under the ESL property files directory. See an Example of ESL file.

Static Hold Control Package

Determines if you want Adams/Solver to keep the initial value of the control signal constant during static analysis. If you have selected Co-Simulation as control system type, select the controls software you are using.

Initial Static Analysis Adams/Car will automatically run the appropriate static analysis, and therefore you should normally select 'No' on this option. Number of Inputs Number of Outputs Active Enter the number of inputs of the control system. Enter the number of output of the control system. Select whether the control system should be active or not in the assembled model. Select to add any comments about the control system to help you manage and identify it. Select to define the input and output control signals. Please note that you must perform this task before selecting Apply or Done in the current dialog box. Select to import a library file and generate an ESL property file. Select to export files to a control package. This (shortcut) button is only available for a control system of type ESL, and when you select to generate an ESL property file. To make an export for Co-Simulation, run an analysis first.

Dialog Box - F1 help 7
Create/Modify Control System

For the option:

Do the following: Select to view property file information. By default, your template-based product displays this information in the Information window, but you can choose to display the information in a text editor. Learn about:
• The Information window • Displaying files in a text editor

Select to set the entities that should be activated/deactivated depending on whether the control system type is set to "function" or not.

Example below shows the content of an ESL file: The LIBRARY keyword in this example points to a dynamic link library file called 'Case4_ABS_GSE.dll' (the file suffix may be .so or .sl in other platforms). The .esl property file can be created using the following menu Mechatronics -> Tools -> ESL Property File. $--------------------------------------------------------MDI_HEADER [MDI_HEADER] FILE_TYPE = 'esl' FILE_VERSION = 1.0 FILE_FORMAT = 'ASCII' HEADER_SIZE = 9 (COMMENTS) {comment_string} 'Num. Inputs: 11, Num. Outputs: 4' $-------------------------------------------------------------UNITS [UNITS] LENGTH = 'mm' ANGLE = 'degrees' FORCE = 'newton' MASS = 'kg' TIME = 'second' $------------------------------------------------------------ROUTINE [ROUTINE] LIBRARY = 'Case4_ABS_GSE' ROUTINE = 'Case4_ABS_GSE' $-----------------------------------------------------------------PARAMETER [PARAMETER] dummy = 1.0 $-----------------------------------------------------------X_INITIAL_CONDITION [X_INITIAL_CONDITION] IC_state_1 = 0.0 IC_state_2 = 0.0 IC_state_3 = 0.0 IC_state_4 = 0.0

8 Adams/Mechatronics

Create/Modify Control System

$----------------------------------------------------------XD_INITIAL_CONDITION [XD_INITIAL_CONDITION] IC_discrete_state_1 = 0.0

Dialog Box - F1 help 9
Create/Modify Transducer/Actuator or Control System Input/Output

Create/Modify Transducer/Actuator or Control System Input/Output
Mechatronics -> Mechanical System -> Transducer Signal/Actuator Signal -> New/Modify Mechatronics -> Control System -> Input/Output -> Modify

Creates or modifies a Transducer Signal or an Actuator Signal or a Control System Input/Output. For the option: Signal Name Type Do the following: Enter the name that you want assigned to the transducer/actuator signal. This option is only available in Adams/Car. (In Adams/View this option is disabled as there is no symmetry).
• left/right - Define either the left or the right signal, and your

template-based product creates the corresponding opposite signal by default.
• single- Define a nonsymmetric signal.

Active

Select one of the following:
• always - The signal is always active (i.e., appears in adm file). If

it is not connected it is set to zero.
• only if connected - The signal is active only when it is connected. • only if referred to - (only applicable to actuator signals) - If

another object is using the actuator signal in a function expression, the actuator signal will be active. General: Function Definition General: Parameter List (VARSUB) If you select Run-time Expression, enter the function expression that defines the variable. Select the [...] button to display the Function Builder and build an expression. See Function Builder and Using the Adams/View
Function Builder

If you selected User written subroutine, enter constants to the user-written subroutine VARSUB to define a variable.

10 Adams/Mechatronics

Create/Modify Transducer/Actuator or Control System Input/Output

For the option: General: Routine

Do the following: If you select User written subroutine, enter the routine name of the varsub if you want to call the varsub from your own dynamic link library. Example of syntax you can use are: my_dll::my_varsub (will look for 'my_varsub' in the dynamic link library called 'my_dll') my_dll:: (will look for 'varsub' in the dynamic link library called 'my_dll') my_varsub (will look for 'my_varsub' in the std available solver dll's)

General: Unit Type General: Unit String

Select type of unit (user, length, acceleration, etc.)

Select the appropriate unit identifier string. Learn more about Units in Adams/Mechatronics. Some examples of available unit strings for different unit types:
• length • model_units • millimeter • meter • ... • angular_velocity • model_units • deg/sec • rad/sec • rpm • user_defined • user • no_units • user_defined

General: Scale Factor Disturbance: Active

Scale factor applied to the total signal: Total signal = scale_factor * (general_function* unit_factor1) Determines if disturbance should be applied or not.

Dialog Box - F1 help 11
Create/Modify Transducer/Actuator or Control System Input/Output

For the option: Disturbance: Operator There are two alternatives

Do the following:

• Add - the disturbance is added to the original signal. • Multiply - the disturbance is multiplied with the original signal.

12 Adams/Mechatronics

Create/Modify Transducer/Actuator or Control System Input/Output

For the option: Disturbance: Disturbance Signal

Do the following: There are four ways to specify the disturbance signal:
• Run-time expression: • Function Expression

In Adams/Car, the expression must be a function on time or set to a constant value In Adams/View, it can be any arbitrary function
• Function Unit

Choose a unit string available the unit type Total signal = scale_factor * (general_function * unit_factor1 +/* disturbance_function* unit_factor2)
• ASCII file (*.daf): • ASCII File

Disturbance ASCII file
• Channel Label

Specifies with column data to use in the file
• Scale Factor

Disturbance Scale Factor: Total signal = scale_factor * (general_function * unit_factor1 +/* disturbance_file_data * disturbance_scale_factor * unit_factor2)
• RPC file: • RPCII file • Channel Number¨ • Scale Factor • Channel Unit

Set the specific unit used by the channel
• Time Unit

Set the time unit that is used in the RCPII file Total signal = scale_factor * (general_function * unit_factor1 +/* RPCII_file_data (channel_bnumber)* channel_scale_factor* unit_factor2)

Dialog Box - F1 help 13
Create/Modify Transducer/Actuator or Control System Input/Output

For the option:
• DAC file • DAC file • Channel Unit

Do the following:

Set the specific unit used by the channel
• Time Unit

Set the time unit that is used in the DAC file Total signal = scale_factor * (general_function * unit_factor1 +/* DAC_file_data * DAC_scale_factor * unit_factor2) Delay: Active Delay: Signal To Delay If disturbance is not active, there is only one choice (function). In that case delay applies to the function specified in the general tab container. If disturbance is active, then there are three choices on where to apply the delay as follows.
• Function (only) • Delays only the function (specified in the general tab

Determines if any delay signal effect should be applies or not

container) Total Signal = scale_factor * (delayed[general_function] * unit_factor1 +/* disturbance * unit_factor2)
• Disturbance (Only) • Delays only the disturbance input

Total Signal = scale_factor * (general_function * unit_factor1 +/* delayed[disturbance] * unit_factor2)
• Disturbed Function • Delays the disturbed general function, i.e., after disturbance

has been applied on the function signal Total Signal = scale_factor * delayed [general_function * unit_factor1 +/* disturbance * unit_factor2] Delay: Initial History If active, you enter the delay function initial history value which is used when time is less than delay time. If inactive, the initial history value is calculated from the initial value of function being delayed. (not implemented)

14 Adams/Mechatronics

Create/Modify Transducer/Actuator or Control System Input/Output

For the option: Delay: Delay Time Type

Do the following: Shown only in the Adams/Car Standard Interface mode Determines the type of delay time function to be used:
• Run time expression • Function dependent only on time or a constant value • Template Expression • A delay time function that has been defined and stored in the

template.
• The function could also be dependent on a state • You can not modify the template expression. You can only

override it with the run time expression above. Delay: Delay Time Function Adams expression defining the magnitude of the delay. The delay can be constant, function of time or state dependent. In Adams/Car standard Interface, the function should only dependent on time or set to a constant value. The magnitude must be positive. Negative values will be taken as zero. Request Active Measure Active Turns auto-created signal request on or off Turns auto-created signal measure on or off Select to add any comments about the control system to help you manage and identify it. Select to open a dialog box where you can set active and inactive objects and also dependent object.

Dialog Box - F1 help 15
Delete Control System

Delete Control System
Mechatronics -> Control System -> Delete

Deletes a Control System. For the option: Control System Do the following: Use the right mouse button to browse for the control system object you want to delete.

16 Adams/Mechatronics

Delete Transducer/Actuator or Control System Input/Output

Delete Transducer/Actuator or Control System Input/Output
Mechatronics -> Mechanical System -> Transducer Signal/Actuator Signal -> Delete Mechatronics -> Control System -> Input/Output -> Delete

Deletes a Transducer or Actuator Signal or Control System Input/Output. For the option: Transducer Signals/ Actuator Signals/ Control System Inputs/ Control System Outputs Do the following: Right click to browse for the control signal object you want to delete.

Dialog Box - F1 help 17
Export Plant for Co-simulation /Setting up ESL

Export Plant for Co-simulation /Setting up ESL
Mechatronics -> Tools -> Export Plant

Exports necessary files for a chosen control package. For the option: System Name File Prefix Adm File Do the following: Right-click to browse for the control system of type co-simulation or ESL. This option is only used in case of ESL simulation preparation. Specify the file prefix for the exported files. This option is only used in case of co-simulation in Adams/Car. Pick the appropriate adm file (you must run a 'file only' analysis before choosing this option to generate an adm file which provides the analysis name to Adams). Select the controls software you want to use for creating your controller. Currently it is always set to non_linear, which exports the plant for dynamic analysis. Previously you might select between non_linear and linear, which created a linearized representation of the model in terms of (A, B, C, D) matrices to perform a linear analysis Select one of the following:
• Yes: Performs initial static analysis. • No: Does not perform initial static analysis.

Target Software Analysis Type

Initial Static Analysis

Adams will automatically run the appropriate static analysis, and thus you should normally say 'No' on this option. Initialization Command Adams/Solver Choice Select and provide the command for initialization. Select one of the following:
• Fortran - Uses the default Adams/Solver (FORTRAN) for this

simulation.
• C++ - Uses Adams/Solver (C++) for this simulation.

User Defined Library Name Adams Host Name

Enter the name of the user-defined library. Enter the name of the host machine from which the Adams plant is being exported. This host name is used if you choose TCP/IP-based communication to perform co-simulation or function evaluation between Adams and MATLAB or Easy5.

18 Adams/Mechatronics

External System Library (ESL) Property File

External System Library (ESL) Property File
Mechatronics -> Tools -> ESL Property File...

Creates a property file for an ESL. For the option: From Control Package External System Library Property file name Do the following: Select either Easy5 or MATLAB as the control package which has been used to generate the External System Library file. Right-click to select the existing ESL file (.dll or .so) which includes the subroutines you want to use in your ESL controller. Enter a name for the property file. The file will be stored in the external_system_libraries.tbl directory in the Adams/Car database. In Adams/View, it will be placed in target directory (see below). (only in Adams/View) Select path to where the ESL property file will be stored (only in Adams/View) Select to easily choose the path of target directory

Target Directory

Dialog Box - F1 help 19
Rearrange Control Signal Input/Output

Rearrange Control Signal Input/Output
Mechatronics -> Control System -> Input/Output -> Rearrange

Changes the channel number of a Control Signal Input/Output. For the option: Input/Output Control Signal Signal Index Control System Number of Inputs/Outputs Do the following: Use the right mouse button to browse for the control signal you want to move. Enter an integer value indicating on which channel you want the signal to be. This field is automatically filled in. This field is automatically filled in. Select to display a dialog box where you can get information about the control system and its input and output signals.

20 Adams/Mechatronics
Rename Control System

Rename Control System
Mechatronics -> Control System -> Rename

Renames a Control System. For the option: Old System Name Do the following: Use the right mouse button to browse for an existing control system.

New System Name Enter the new name that you want assigned to the control system.

Dialog Box - F1 help 21
Rename Transducer/Actuator or Control Signal Input/Output

Rename Transducer/Actuator or Control Signal Input/Output
Mechatronics -> Control System -> Input/Output -> Rename Mechatronics -> Mechanical System -> Transducer Signal/Actuator Signal -> Rename

Renames a Transducer or Actuator or Control Signal Input/Output. For the option: Old Signal Name New Signal Name Do the following: Right click to browse for an existing control signal. Enter the new name of the transducer/actuator signal.

22 Adams/Mechatronics
Select Model

Select Model
Mechatronics -> Signal Manager -> Display..

Select the model with the control systems to display the Signal Manager. For the option: Model Do the following: Select the model with control systems.

Dialog Box - F1 help 23
Select Objects

Select Objects
Select objects that should be activated or deactivated depending on the connection of the related actuator/transducer signal. If the dialog box is entered via the control system create/modify dialog box, you specify the objects which should be activated if the control system is set to function. Note:

There is no symmetry functionalities when selecting objects. Therefore, the user has to select objects for the left and right sides separately. The same applies when selecting function objects for control systems of type function.

For the option: Object Active objects

Do the following: Shows the name of the actuator or control signal input (not editable). Right click to select all the objects that should be active if the actuator/transducer signal is connected. For control systems, select the objects that should be activated when the control system is active and of function type. Right click to select all the objects that should be inactive if the actuator/transducer signal is connected.

Inactive objects

Dependent Object Right click to find the object that should be dependent on the actuator signal.

24 Adams/Mechatronics
Signal Manager

Signal Manager
Mechatronics -> Signal Manager -> Display

Select Model dialog box opens and the text box is populated with the available models. Select the appropriate model and click OK. Signal Manager dialog box enables you to hook up transducer signals and actuator signals to the appropriate input/output channel in the control system. For the option: Assembly Control System Name Nume Inputs Do the following: Assembly you want to work on is already displayed. Select the control system you want to hook up. Click on the button to display a list of available Transducer Signals or other control system's Output Signals. Note that the list will only display those Transducer Signals (or Control System Output Signals) which have the correct Unit Type. Click on the button to display a list of available Actuator Signals or other control system's Input Signals. Note that the list will only display those Actuator Signals (or Control System Input Signals) which have the correct Unit Type. Further, on the right-hand side of the selected Actuator or Input Signal, there is an integer indicating how many Actuators or Control System Input Signals make use of the same Control System Output. Select to display a dialog box where you can get information about the control system and its input and output signals.

Num Outputs

Dialog Box - F1 help 25
Signal Overview

Signal Overview
Mechatronics -> Info -> Signals

Displays overview information about the different kinds of signals in the assembly; Transducer Signals, Actuator Signals, Control System Inputs and Control System Outputs. For the option: Model Signal Type View options Display in information window Do the following: Select the model you want to get information about. Select the type of signals you want to include in the overview. Select the content of the information. If you check this option, you can see the information in a window.

Save information to a file If you check this option, you can write the file name in the adjoining field, and the information will be saved to the provided file.

26 Adams/Mechatronics
Signal Overview

Sign up to vote on this title
UsefulNot useful