Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
12 Adams/Car
phenomena
Investigate the influence of active damping control on the forces in the suspension components
or body structure
13
Mechatronics
Validate your complete vehicle model including control system with a corresponding model for
Hardware-In-The-Loop studies
and many more
Based on the analysis results, you can quickly alter the chassis characteristics or control parameters and analyze the vehicle again to evaluate the effects of the alterations. For example, you can quickly change control code to see which yields the best handling characteristics for your vehicle. Once you complete the analysis of your model, you can share your work with others. You can also print plots of the controller input/output signals and vehicle dynamic responses. In addition, you can access other users' models without overwriting their data.
require. For example, you can change springs with a few mouse clicks instead of waiting for a mechanic to install new ones in your physical prototype before re-evaluating your design.
Vary the kinds of analyses faster and more easily than if you had to modify instrumentation, test
14 Adams/Car
control software such as Matlab/Simulink and Easy5. Note:ESL stands for External System Library
disturbance_files.tbl contains property files which have control signal disturbancy data stored in
15
Mechatronics
Adams/Car sessions. 4. Select OK. Adams/Car loads Adams/Car Mechatronics. The interface now includes a new menu, Mechatronics. Please 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.
16 Adams/Car
pressure. The measured signal is sent to the control system in the assembled model. Please note that a transducer signal can have it's activity set in two different ways: 1. Always 2. Only if connected Always: In this case, the transducer signal object is always active in your model. Only if connected: In this case, 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). Actuator Signals Actuator Signals are used to apply the output from the control system to the mechanical system. For example, the actuator signal could be a brake pressure for an ABS system, and the actuator signal would be used in the force expressions for the brake model. Typically, you would create an actuator in the template builder and the refer to the actuator signal in the function expression of the actuator. Please note that an actuator signal can have it's activity set in three different ways: 1. Always 2. Only if connected 3. Only if referred to Always: In this case, the actuator signal object is always active in your model. Only if connected: In this case, 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 an actuator using the actuator signal in it's expression. To understand more about how to use the activity setting, please read here. Control System A Control System in the context of Adams/Car Mechatronics is an object which stores information about the type of controller and the number of input channels and output channels. Control System Inputs Control System Inputs are auto-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 which 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.
17
Mechatronics
Control System Outputs Control System Outputs are auto-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 which 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 the context of Adams/Car Mechatronics, the mechanical system is your vehicle model excluding the control systems. Note that you can add control system related objects such as transducer signals and actuator signals without the need for a new version of the template since you can use that template (subsystem) both with and without the control system active. See Using Activity Types for more information. Signal Manager The Signal Manager is a graphical user interface, i.e. a dialog box, where you tie transducer objects to the control system input channels and control system output channels to the corresponding actuator signal objects. Note: you can also connect a control system output to another control system input. Typically, you use the Signal Manager only once for a complete assembly. The next time you open the assembly, the signal connections will be done automatically. (Dynamic Link) Library In Adams/Car Mechatronics, dynamic link libraries (shared objects on unix) are stored in a table directory in the Adams/Car database. The name of the table directory is external_system_libraries.tbl, and is used for c-code generated from e.g. Matlab RTW or Easy5. Select an entry on the left to learn more about Adams/Car Mechatronics.
18 Adams/Car
The unit string is used by Adams/Car 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 taken care of automatically by Adams/Car Mechatronics. This means that a units conversion takes place automatically if the units are not the same for e.g. a transducer and the corresponding control system input. There is a set of pre-defined unit types and unit strings available in Adams/Car Mechatronics. However, if your control system is working with other types of units, you can create your own units. See the table below for more information.
Used when desired unit type is not available in the pre-defined unit type list unit string can't be composed using Adams/View convention (see here for more info)
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.
user
user defined
desired unit type is not available in select list unit string can be composed using the Adams/View convention (see here for more info)
Make sure the same unit types are used in "both ends", e.g. in both transducer and control system input.
model units
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 user defined you need a unit which is not available in the pre-defined unit string list
Always conversion
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.
19
Mechatronics
Connecte d yes no
Active object state ON ON OFF OFF ON ON OFF OFF ON OFF OFF OFF
Only if connected
yes no
Only if referred to
yes no
When setting up your templates for use both with and without control systems, there are two "levels" of activities. One level deals with setting up the activity of the transducer/actuator itself and the other is how to implement the actuators or components on the mechanical level.
20 Adams/Car
Activity Type: The following types of activity are available. Note that only the first two are available for transducer signals. 1. Always: As the name implies, the transducer or actuator signal is always active in the model. 2. Only if connected: The transducer or actuator signal is only 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 transducer or 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 transducer signals and actuator signals become active, since they are referred to by that controlled damper object. Connected This indicated whether the transducer/actuator signal has been properly connected or not. Signal Connectivity Flag 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 appropriate control system input/output channel. The name of this variable is signal_connectivity_flag, and it's value is 1 if the connection is successful and 0 if there is no connection made. Thus you can use this variable in function expressions in the mechanical template to build in logic supporting the use of the template both with control systems and without. Referred to? For each type of activity and connection status, the transducer/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, see Activity State below. Activity State This indicates the activity of the transducer/actuator signal itself. Active Object State: This indicates the activity state of those objects you have selected (if any) to be in the "Active Objects" group when you created the transducer or actuator signal. This allows you to use the activity 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 activity of the actuator signal.
21
Mechatronics
Inactive Object State: This is the inverse of the Active Object State. How to think when making the template compatible both with and without control systems Please note that when selecting the type of activity, you should have a strategy in mind in terms of how to use the transducer/actuator signal in the mechanical system. Let us use 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 that same brake system subsystem unaltered in assemblies both with and without the control system subsystems, you have a couple of alternatives 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) In this alternative, suitable activity settings for the actuator signal object would be 'Always' or 'Only If Referred To'. (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 button to display a dialog box where you can put the actuator objects in the Active Object group and Deactive Object group, respectively. In this way, Adams/Car 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' is when the actuator signal is not connected. What happens with 'Always' then is that the actuator signal (but not the actuator!) 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.
22 Adams/Car
Below you will find step-by-step instructions for using this approach (using brake template as an example): 1. Open template <acar_shared>/templates.tbl/_brake_system_4wdisk.tpl 2. Copy existing brake line pressure variables ._brake_system_4Wdisk.left_front_brake_line_pressure to ._brake_system_4Wdisk.left_front_brake_line_pressure_amech and so on (four variables). Use Tools -> Command Navigator -> data_element copy:
Do the same with the remaining two variables right_front_brake_line_pressure and rear_brake_line_pressure (note that there is only one pressure variable for the rear axle in this template). 3. Create actuator signals. These actuator signals will later on be fed with data from the controller which we will put in another template (subsystem). Let's start with the front actuator signals. Note that we here make use of the left/right symmetry capability:
23
Mechatronics
Now create the rear actuator signal, and note that we now use a single type because we only had one pressure variable in the rear:
4. Modify the copied pressure variables so they are dependent on the actuator signal objects we just created. Use Build -> System Elements -> State Variable -> Modify: Note how we insert the signal_variable object of the left front actuator signal instead of the brake_demand variable:
24 Adams/Car
5. Create torque actuators which refer to the copied pressure variables (for simplicity in this example, we will let the brake torque actuators be dependent only on the pressure variable. In the original "un-controlled" actuator, the torque is of course dependent on pressure multiplied with piston areas etc. We are only illustrating work process in this example.):
25
Mechatronics
6. Now you have two torque actuators acting on each brake disk. You now need to set it up so that only one torque actuator per brake disk is active at the same time. Display the Actuator Signal Modify dialog box. Select the so that the activity of the pressure variables and torque actuators is set as in the picture below:
26 Adams/Car
Important note: Note in the picture above that we were modifying the left front actuator signal (uel_...). However, we selected objects representing both left and right side in the dialog box to the right. We could have instead selected only objects from the left side, but then we would need to also do a modify on the right front actuator signal (uer_...) and then select the right hand side objects. Which method you use is entirely a matter of personal preference since the end result will be the same.
27
Mechatronics
In the picture below, we are modifying a single type actuator signal and thus we need to select both left and right hand side objects, as shown.
7. Proceed to create the brake_demand and wheel speed transducers as described in the tutorial. 8. Create a new subsystem for the brake template. 9. Create a new full vehicle assembly with this subsystem, using all other subsystem from the tutorial. 10. Use the Signal Manager to hook up this transducer signals and actuator signals of this template with the rest of the system. 11. Run a brake analysis. You can verify the activity of the controlled brake torque actuator by turning on the icons and doing a right-click on the torque icon on any wheel. You should only see one actuator, and it should thus be the controlled one. 12. Create an assembly with no ABS or ESP controllers, i.e. a purely mechanical one. Rerun a brake analysis and verify that the brake torque is now determined by the mechanical torque actuators. 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/Car 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 &
28 Adams/Car
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 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 manner 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. But to be able to replace another damper with the new active damper our new UDE has to be added to the
29
Mechatronics
same group ude modify definition & def=.AMECH.udes.ac_amech_damper & isa=.ACAR.forces.ac_damper 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/Car 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 & entity = (the entity for which you want to find a dependency) & actuator_variable = (a variable where the macro will return the actuator 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.
30 Adams/Car
The damper is given as the dependent object despite the fact that it is a standard damper with no need for 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.
Adams/Car 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
31
Mechatronics
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.
32 Adams/Car
Components 1-4. I.e. all signal components are based on the same single control signal UDE object. Read more details about the control signal UDE definition below. Information about the control system component UDE can be found here:
33
Mechatronics
Control Signal
UDE definition .AMECH.udes.ac_control_signal UDE description: The control_signal UDE is used to create objects control signals. The central object in this UDE is the signal variable. Transducer signal, Actuator signal, control system inputs and control system outputs are all vbased on the control signal UDE
34 Adams/Car
UDE Specification Parameters: Parameter signal_type Type string variable 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
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 user_parameters routine disturbance integer value string_value string value string value string value 1. = function expression 2. = user parameters for a VARSUB Storing the 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
disturbance_type
string value
35
Mechatronics
Function 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. 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. Scale factor to the complete function. Can contain following activity options:
"active:model_and_signal_units" "active:model_units" "active:signal_units" "not_active"
disturbance_channel_un string value it disturbance_time_unit disturbance_scale_facto r disturbance_active_flag string value real value integer value
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" 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 )
36 Adams/Car
Function From disturbance time unit to model units. Valid for disturbance files. The related control system. Valid for control_system_input and control_system_output. Index of specific input / output for the control system. Not valid for transducer_signals and actuator_signals. Connected control signal name. Valid for the control signal types actuator and control_system_input. Major role of the connected control signal. For instance "ESP_system" Minor role of the connected control signal. For instance "front" Either left, right or single. The connecting signal variable. (solver variable) The adams id of the connector object. Used if function expressions. A Dummy variable. Needed for the read property file ude method functionality. Due to connector information data can be non symmetric, the control signal are always set to asymmetric. In the subsystem file there are always separate blocks for left and right side of a control signal. "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. Note! connector information is not visible for the user in the any dialog box. Indicates if the control signal has been connected on not. Valid for control_system_input and actuator_signals.
connector_name
string value
connector_signal_solver integer value _id property_file asymmetric string value integer value
symmetric_dbox_data
string value
signal_connection_flag
integer value
37
Mechatronics
Parameter active_flag
Valid for transducer_signals and actuator signal. Active even if not connected and actuator_signals will therefore be 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 signals does not find any connection.) Useful when replacing to an UDE entities that should use A/Car Mechatronics functionality. The "Amech" UDE entity will look for an actuator and find only the actuator which has set the specific UDE as a dependent object.
inactive_objects
object value
dependent_object
object value
38 Adams/Car
Objects: Object signal_variable function_variable disturbance_variable template_function_variable request_model_units request_signal_units signal_model_units disturbance_model_units undisturbed_model_units signal_signal_units disturbance_signal_units undisturbed_signal_units spline Type state_variable state_variable state_variable state_variable request request measure measure measure measure measure measure spline Function Communicating control signal. undisturbed signal variable disturbance signal variable Contains the functions which are defined in the template builder. signal request in model units. signal request in signal units. 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.
39
Mechatronics
Request definition: Component f2 f3 f4 Component name signal disturbance undisturbed_signal Component units no_units no_units no_units Definition
Subsystem parameters: signal_type symmetric_dbox_data unit_type unit_string scale_factor delay 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
40 Adams/Car
Design parameters: scale_factor disturbance_scale_factor Disturbance ASCII File: $-----------------------------------HEADER [HEADER] FILE_VERSION = 1.0 FILE_TYPE = 'daf' $----------------------------CHANNEL_UNITS [CHANNEL_UNITS] TIME = 'second' engine_rpm = 'deg/sec' 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 Template Builder .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 Command: amech template_builder control_signal smodify Modifies a single control_signal.
41
Mechatronics
Standard Interface .AMECH.dboxes.dbox_sta_con_sig The dialog box modifies a control_signal by calling the mac_sta_con_sig macro. .AMECH.macros.mac_sta_con_sig Command: amech standard_interface control_signal Modifies single control_signal UDE.
Control System
UDE definition: AMECH.udes.ac_control_system UDE description: The control_system UDE is used to create control system objects.
42 Adams/Car
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 four different types of systems:
Function Controller RTW Hook User subroutine Cosim
num_inputs num_outputs input_signal_array output_signal_array x_num xd_num x_IC_values xd_IC_values parameter_num parameter_names
integer value integer value object value object value integer value integer value real value real value integer value string 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) Number of parameters that are passed to the GSE routines (ESL) Names of the parameters that are passed to the GSE routines (ESL)
43
Mechatronics
Type
Function 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. The extension of this file is *.esl for ESL control systems and *.usl for User control systems. (ESL/User) Name of the routine used for ESL Control System (ESL) Length of the routine used for ESL Control System (ESL) Dummy variable that needs to exists in order 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
static_hold
string value
cosim_control_package
string value
cosim_initial_static
string value
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)
44 Adams/Car
Objects: Object GSE PLANT_INPUT PLANT_OUTPUT X_ARRAY XD_ARRAY X_IC_ARRAY XD_IC_ARRAY Y_ARRAY U_ARRAY PARAMETER_ARRAY ROUTINE_STRING SENSOR gse plant input plant output array array array array array array array Adams string sensor Type Function 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.
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.
45
Mechatronics
Request definition: Subsystem parameters: type library_property_file static_hold cosim_control_package cosim_initial_static active_flag Template Builder .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). Standard Interface .AMECH.dboxes.dbox_sta_con_sys The dialog box modify control_signal(s) by calling the mac_sta_con_sys macro.
46 Adams/Car
.AMECH.macros.mac_sta_con_sys Command: amech standard_interface control_system Modify control_system UDE. .AMECH.macros.mac_sta_con_ssy Command: amech standard_interface control_system Modifies single control_system UDE.
47
Mechatronics
Transducer Signals Transducer Signals are used to measure a certain signal from an arbitrary location of the vehicle system. For example, it can measure the rotational velocity of a wheel, or it can measure the instantaneous brake pressure. The measured signal is sent to the control system in the assembled model. Actuator Signals Actuator Signals are used to apply the output from the control system to the mechanical system. For example, the actuator signal could be a brake pressure for an ABS system, and the actuator signal would be used in the force expressions for the brake model. Control Systems The Control System component are used to store information about, among other things, the type of control code interface is used and the number of input/output channels. Control System Inputs Control System Inputs are auto-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 which are auto-created. Using the Signal Manager, you can hook up the appropriate transducer signal to the corresponding Control System Input. Since the Control System Inputs are always automatically created, you can only perform Modify operations on them.
48 Adams/Car
Control System Outputs Control System Outputs are auto-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 which 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. Creating a Transducer Signal In order to create a Transducer, use menu Mechatronics -> Mechanical System -> Transducer -> New... This will display the following dialog box:
49
Mechatronics
50 Adams/Car
Running Analyses
Running Analyses in Adams/Car Mechatronics
You submit analyses using the standard Adams/Car functionality. If you use control systems of type cosim in your assembled model, please follow the instructions in Adams/Controls once Adams/Car has written out all the files.
51
Mechatronics
Plotting
Plotting in Adams/Car Mechatronics
Adams/Car Mechatronics automatically creates requests and/or measures for all transducer and actuator signal objects. This saves time for you when you want to verify that the input and output signals to and from the controller are as expected. Studying the outputs from a certain input gives you an understanding how an unknown controller code works.
In all other respects, the plotting is handled exactly as in all other analyses.
52 Adams/Car
Tutorials
Template Builder Tutorial - Create ESP and ABS control systems Standard Interface Tutorial - Use Signal Manager and run interactive analyses Standard Interface Tutorial - Setup and run Co-Simulation analysis
Create an ABS control system The following ABS control system will be created:
53
Mechatronics
Inputs Get transducer/control system output signal from: brake_system control_system (ESP) body control_system (ESP) control_system (ESP) control_system (ESP) control_system (ESP) brake_system brake_system brake_system brake_system
# 1 2 3 4 5 6 7 8 9 10 11 Outputs # 1 2 3 4
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 wheel_speed_rear_left wheel_speed_rear_right
Unit type Unit string user user no_units no_units no_units no_units
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, the ESP controller. Units Please note the use of Unit Type and Unit String. Units are handled in Adams/Car 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, e.g. velocity or torque. Adams/Car 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.
54 Adams/Car
The unit string is used by Adams/Car 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 taken care of automatically by Adams/Car Mechatronics. This means that a units conversion takes place automatically if the units are not the same for e.g. a transducer and the corresponding control system input. There is a set of pre-defined unit types and unit strings available in Adams/Car Mechatronics. However, if your control system is working with other types of units, you can create your own units. See the table below for more information. Unit type user Unit String no_units Used when desired unit type is not available in the pre-defined unit type list unit string can't be composed using Adams/View convention (see here for more info) desired unit type is not available in select list unit string can be composed using the Adams/View convention (see here for more info) 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 you need a unit which is not available in the pre-defined unit string list 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.
user
user defined
length, angle,....
model units
length, angle,....
mm,centimet er,deg,...
Always conversion
length, angle,....
user defined
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.
55
Mechatronics
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:
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:
56 Adams/Car
57
Mechatronics
When you have entered all the information for the input and output signals, press OK. You will then return to the Create Control System dialog box. Press OK there, and the following message window appears:
Save the template. Proceed to creating the transducer signals. Creating Transducer Signals in body and brake system template In order to feed the ABS controller with input signals from the vehicle model, we will start by adding virtual transducer signals in the brake system and the body templates. The following transducer signals will be created:
58 Adams/Car
Inputs to the control system: 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 brake_system brake_system
# 1 2 3 4 5 6 7 8 9 10 11
Name brake_demand (ESP_active) body_long_vel ((left) ESP_signal_front) ((left) ESP_signal_rear) ((right) ESP_signal_rear) (left) wheel_speed_front (left) wheel_speed_rear (right) wheel_speed_rear
model_units body
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 (i.e. control system output channels), the ESP controller. Units Please note the use of Unit Type and Unit String and how the units differ from those defined in the control system. Adams/Car 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 menu below to display the dialog box for creating transducers:
59
Mechatronics
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. Select Apply in the Function Builder to fill the Function text field in the Create Transducer Signal dialog box. Note that you have the possibility to set request and measure activity on or off, and if you set it on, you can select in which unit you want the signal to be expressed in.
60 Adams/Car
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 of the left/right symmetry capability. Let's start by setting the expression for the left front wheel speed transducer:
Now we will set the expression for the right front transducer:
61
Mechatronics
The reason why we hardcode the unit string to rad/s is that the results from the solver variables left/right_wheel_omega always are expressed in rad/s regardless of model units. Click Done (or 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 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.
62 Adams/Car
The following actuator signals will be created: Create actuator signal in: brake_system brake_system brake_system brake_system
# 1 2 3 4
Display the Create Actuator Signal dialog box via the menu Mechatronics -> Mechanical System -> Actuator Signal -> New:
63
Mechatronics
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 In order to make the actuator signals actually influence the mechanical system, in this case the brake torque, we will modify the existing expression used for the brake pressure. Now use the menu Build -> System Elements -> State Variable -> Modify to display the dialog box below (click on the [...] button to display the Function Builder). Start by modifying the ._brake_system_4Wdisk_mech_00.left_front_brake_line_pressure variable:
64 Adams/Car
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. Select Apply in the Function Builder to load the new expression into the Modify State Variable dialog box, and then select 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 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_02.left_rear_brake_line_pressure, ._brake_system_4Wdisk_mech_02.right_front_brake_line_pressure ._brake_system_4Wdisk_mech_02.right_rear_brake_line_pressure. For your reference, below we show how it looks for the right rear brake line pressure:
65
Mechatronics
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. Creating ESP Control System The following ESP control system will be created:
66 Adams/Car
# 1 2 Outputs # 1 2 3 4 5
In template major role control_system (ABS) control_system (ABS) control_system (ABS) control_system (ABS) control_system (ABS)
Note that the five output channels will be connected to actuators in the ABS control system we created earlier. This is just to illustrate the possibilities you have 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. (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:
67
Mechatronics
Click on the button in the lower left side of the Create Control Signal dialog box. This will display the dialog box in which you can specify information for each input and output signal:
68 Adams/Car
Save the template. Proceed to creating the transducers. Creating Transducer Signals In order to feed the ESP controller with input signals from the vehicle model, we will start by adding virtual transducer signals in the body template. The following transducer signals will be created: Inputs to the ESP control system: Create transducer signal in: body body
# 1 2 Units
Please note the use of Unit Type and Unit String and how the units differ from those defined in the control system. Adams/Car Mechatronics will automatically convert the units from the transducer to the control system. Creating the transducer signals Open the _rigid_chassis_lt_mech_00.tpl template from the <amech_shared> database. We will now create the body lateral acceleration and the yaw velocity transducer signals. We will start by creating the 'body_lat_acc' transducer. Use the Mechatronics -> Mechanical System -> Transducer Signal -> New to display dialog box below:.
69
Mechatronics
Save the body template and close it. You have now successfully finished Adams/Car Mechatronics Template Builder tutorial.
Standard Interface Tutorial - Use Signal Manager and run interactive analyses
Overview This tutorial guides you through the process in the Standard Interface how to connect control systems, run full vehicle simulations with different setup of the control systems and review the results. The process of adding disturbance signal is also included. It is assumed that you have already started Adams/Car and loaded the Adams/Car Mechatronics plugin. The main steps in the tutorial are listed below:
70 Adams/Car
Open assembly which includes ABS and ESP control systems Connect control systems with Signal Manager Run analysis with ESP turned on and off Review the result differences Add disturbance and rerun analysis Study disturbance results
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/Car 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.
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.
71
Mechatronics
Connect control systems with Signal Manager The next step is to define how the control systems are connected to the transducers and actuators of the mechanical system. To do this, display the Signal Manager using Mechatronics -> Signal Manager. Start with the ABS control system.
72 Adams/Car
Please note that when you select e.g. the ABS controller, the connected Transducer/Control System Output column displays 'not_set'. By clicking on the '>' button on the left, you can now start selecting the appropriate transducer/control system output signals:
Note that when you click the '>' button, a selection list dialog box appears:
73
Mechatronics
Also note that the list of selectable signals is always filtered with respect to unit types. Only transducers or control system outputs of the appropriate unit type can be selected.
Connect the last input signal port of the ABS control system:
Press Apply button in order to save the setup of the ABS control system connections. Proceed by repeating the steps for the ESP control system:
74 Adams/Car
Note that the ESP control system outputs already have the proper connections to the ABS control system. They were in the previous steps set on input side of ABS control system.
Use the info connectivity feature again for verifying that all control system inputs and actuator signals in the assembly are properly connected:
75
Mechatronics
Save the assembly and the subsystems via File -> Save. Note due to the connections that were defined by using the Signal Manager following subsystems were 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 next you open the assembly, all connections are already made.
Run analysis with ESP turned on and off In this example, 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 by default activated.
Before executing the full vehicle analysis the requests for two of the ESP control system outputs need to be activated for later result comparisons. Start to modify the ESP control system output ESP_signal_fl by using Mechatronics -> Control System -> Output to display dialog box below:
76 Adams/Car
Repeat the step for the ESP control system output ESP_signal_fr
Now submit the single lane change analysis with the settings below:
During the read property file procedure the control system inputs and actuator signals get connected:
77
Mechatronics
We will deactivate the ESP controller to compare the results. Use Mechatronics -> Control System to display the dialog box below:
Set the activity to 'off' and press OK. The message window below appears:
78 Adams/Car
In effect, 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, which means that they will receive zero values on those channels. Rerun the analysis with the same settings as before. Review the result differences Open the postprocessor and select the body yaw rate signal as shown below:
Clearly, deactivating the ESP causes the car to reach much higher yaw rates during this particular manoeuvre.
Please note that Adams/Car Mechatronics have predefined requests for all types of control signals:
79
Mechatronics
Add disturbance and rerun analysis A sinusoidal disturbance signal will be added to the ESP control system input body_yaw_rate. But 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 from the shared database and activate the request. All control system inputs and output requests are deactivated by default.
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 disturbance signal amplitude of 2 deg/s.
80 Adams/Car
Rerun the analysis with the same values except those for the End Time and Number Of Steps. They should be set to 3 sec and 300 steps respectively..
Study disturbance results Open the postprocessor and select the different result set components available for the ESP control system input body_yaw_rate as shown below:
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.undisturbed_signal (received from connected transducer signal) ..._model_units.disturbance (sinusoidal signal with amplitude of 2 deg/s)
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:
81
Mechatronics
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/Car Mechatronics shared database:
82 Adams/Car
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
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:
83
Mechatronics
The control package settings above will be the default choices in the export plant dialog box.
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.
The following message will inform the user that one control system is of type 'CoSim' and Adams/Car Mechatronics specific export plant dialog box will be displayed:
84 Adams/Car
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.
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_test_cosim_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.
85
Mechatronics
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:
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.
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:
86 Adams/Car
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.