Test-Rig Templates
You can extend the functionality of your templates by converting them into test-rig templates, also referred to as test rigs.
In the template-based products, test rigs are almost completely comparable to regular templates. The basic topological difference between test rigs and regular templates is that besides containing parts that are attached using attachments and forces, test rigs also contain actuator elements, such as motions and forces, to excite the assembly. Just like regular templates, test rigs also contain communicators to enable the exchange of information with other templates.
You use test rigs when creating assemblies. A collection of subsystems and a test rig form an assembly.
Note that the name of a test rig is always preceded by a period and two underscores, that is “.__”. For example, .__MY_TESTRIG. This is a convention used by all template-based products to differentiate between templates (period and one underscore, “._”), subsystems (period, “.”), and test rigs (period and two underscores, “.__”).
Learn about test rigs:
Process Overview
The process of working with test-rig templates involves the following steps:
For Adams Car:
Creating Test-Rig Templates
You create test-rig templates the same way you create regular templates.
To create a test-rig template:
1. From the File menu, select New.
2. Press
F1 and then follow the instructions in the dialog box for
New Template.
3. Select OK.
Note: | You must specifically set the minor roles of communicators in test-rig templates to any. Do not set them to inherit. You set the minor roles to any because generally a template test rig should be capable of connecting with any subsystem. |
Saving Test-Rig Templates
You can save test-rig templates to files, just as you would save regular templates. We recommend that you save test rigs in ASCII format so you can hand edit them. Storing test-rigs in ASCII format also ensures portability from one machine to another. It allows you, for example, to use the same file when building a site binary on either a Windows or Linux machine.
To save a test-rig template:
1. From the File menu, select Save or Save As.
2. If you selected:
■Save - Your template-based product saves the binary version of the template to the default writable database and prompts you if the template already exists. For save options, select Save As.
■Save As - Press
F1 and then follow the instructions in the dialog box help for
Save Template. Select
OK.
3. Depending on the template-based product you are using, continue as follows:
Converting Templates into Test Rigs
To convert templates into test rigs you must make the following modifications to your ASCII test-rig template file generated from your template-based product:
Removing the Header Information
You must remove the header information that is added at the beginning of the ASCII template file because the command file reader will not understand the information stored in this header and will output errors.
The following example shows a typical header from an ASCII template file:
$-----------------------------------------------MDI_HEADER
[MDI_HEADER]
FILE_TYPE = 'tpl'
FILE_VERSION = 13.3
FILE_FORMAT = 'ASCII'
HEADER_SIZE = 9
(COMMENTS)
{comment_string}
'Simple Double Wishbone Suspension'
$--------------------------------------------TEMPLATE_HEADER
[TEMPLATE_HEADER]
MAJOR_ROLE = 'suspension'
TIMESTAMP = '1999/07/15,17:21:32'
HEADER_SIZE = 5
You should remove all the lines from the beginning of the file up to, and including, the line containing the HEADER_SIZE attribute.
Modifying Adams View Variables
Templates and test rigs in template-based products have information that is stored in Adams View variables to determine how the template is used. All templates, including test rigs, have three required variables: major role, minor role, and model class. Test rigs, however, have an additional required Adams View variable called test rig class.
When you create the test-rig template, your template-based product automatically creates the first three variables. You must, however, manually create the last variable, the test rig class variable.
The following sections introduce the variables:
Major Role
The major role of templates and test rigs is stored in an Adams View variable called role. The major role of a test rig is always analysis.
When creating a test rig, make sure that you set the major role as shown next:
variable create &
variable_name = .__acme_4PostRig.role &
string_value = "analysis" &
comments = "Memory for Adams Car major role"
Minor Role
The minor role of templates and test rigs is stored in an Adams View variable called minor_role. The minor role of a test rig is typically any. Setting the minor role to any is very important if you are designing a test rig that is supposed to work with other subsystems that can have different minor roles.
In Adams Car for example, a suspension test rig should work with either front, rear, or trailer-type suspensions. If the minor role of the test rig were defined as front, the test rig would hook up only to front suspensions.
Set the minor role as shown next:
variable create &
variable_name = .__acme_4PostRig.minor_role &
string_value = "any" &
comments = "Memory for Adams Car minor role"
Model Class
Every assembly in template-based products has a specific model class. The model class of an assembly is stored in an Adams View variable called model_class. Your template-based product automatically creates this variable when you create the assembly.
Currently, in template-based products, there are four model classes defined: template, subsystem, testrig, and assembly.
Set your model class as shown next:
variable create &
variable_name = .__acme_4PostRig.model_class &
string_value = "testrig" &
comments = "Memory for Adams Car model class"
Test-Rig Class
You can associate any test rig with a particular class of assembly. In Adams Car for example, the test rig .__MDI_SUSPENSION_TESTRIG is associated with suspension assemblies. The assembly class of a test rig is stored in an Adams View variable called testrig_class.
Set the test rig class as shown next:
variable create &
variable_name = .__acme_4PostRig.testrig_class &
string_value = "full_vehicle" &
comments = "Memory for Adams Car testrig class"
You can reference the variable testrig_class directly from the graphical user interface. In Adams Car for example, this variable is used in the suspension assembly and the full-vehicle assembly dialog boxes. Each of these two dialog boxes contain an option menu from which you can select the test rig to be included in the new assembly. The option menu will only contain test rigs that are compatible with the particular class of assembly you specified.
The following steps describe how you can reference testrig_class from the Adams Car interface. You can follow the same basic steps for the other template-based products.
To reference testrig_class from the Adams Car interface:
1. From the File menu, point to New, and then select Suspension Assembly.
2. From the pull-down menu for
Suspension Test Rig option, select the Test Rig you want to use in your assembly. To fill out the entire dialog box Press
F1 and then follow the instructions in the dialog box help for
New Suspension Assembly.
3. Select OK.
Adding Test Rigs to Binaries in Adams Car
Adding a test rig to your private or site binary makes it available for use whenever you start a private or site session. See
Organizing Custom Code.
You should move the test rig you modified from the template table (templates.tbl) in your template-based product databases to a directory that contains the source for the custom private or site binary file. Typically, you will need to create custom analysis macros that work with the new test rig. All these files should be located in the same directory structure.
For example, you could enter this command in the acar_build.cmd file to read the test rig:
file command read &
file=(eval(getenv("MDI_ACAR_SITE")//"/analysis/models/acme_4PostRig.cmd"))
When you add this command to the acar_build.cmd file, Adams Car reads in and stores the test rig in the private or site binary, making the test rig available for use whenever you start an Adams Car private or site session.
As an additional option, you can rename your test rig file from the .tpl extension to a .cmd extension to reflect the fact the test rig is now a command file.
Adding a Test Rig
When you add a
test rig into an assembly, your template-based product disassembles the assembled model, copies the test rig into the assembly, and then reassembles the model to include the new test rig.
To add a test rig:
1. From the File menu, point to Manage Assemblies, and then select Add Testrig.
2. Press
F1 and then follow the instructions in the dialog box help for
Add Testrig.
3. Select OK.
Your template-based product does the following:
■Disassembles the assembly, which includes 'unassigning' communicators.
■Copies the test rig under the existing assembly.
■Reassembles the assembly, which includes re-assigning the communicators.
Replacing the Test Rig
When you replace a test rig in an assembly with a new test rig, your template-based product disassembles the assembled model, deactivates the current test rig, copies the new test rig into the assembly, and then reassembles the model to include the new test rig.
To replace a test rig:
1. From the File menu, point to Manage Assemblies, and then select Replace Testrig.
2. Press
F1 and then follow the instructions in the dialog box help for
Replace Testrig.
3. Select OK.
Your template-based product does the following:
■Disassembles the assembly, which includes 'unassigning' communicators.
■Deactivates the current test rig in the existing assembly.
■Copies the new test rig underneath the existing assembly.
■Reassembles the assembly, which includes re-assigning the communicators.
Removing the Test Rig
When you remove a test rig from the assembly to which it belongs, your template-based product disassembles the assembled model, deletes (or deactivates) the test rig, and then (optionally) reassembles the model.
To remove a test rig:
1. From the File menu, point to Manage Assemblies, and then select Remove Testrig.
2. Press
F1 and then follow the instructions in the dialog box help for
Remove Testrig.
3. Select OK.
Your template-based product does the following:
■Disassembles the assembly, which includes 'unassigning' communicators.
■Deletes the test rig from the assembly.
■Optionally reassembles the assembly, which includes re-assigning the communicators.
Controlling Test Rig Activity
You can control the activity status of an existing
test rig. Your template-based product disassembles the assembled model, sets the test rig activity accordingly, and then reassembles the model to take into account the test rig's activity status.
When you set the test rig activity status to inactive, your template-based product ignores the test rig during model assembly, and therefore some communicators may not find matches.
Note that compared to the Remove Testrig functionality, which (optionally) deletes the test rig, the Testrig Activity functionality only de-activates the test rig and all objects in it.
To control test rig activity:
1. From the File menu, point to Manage Assemblies, and then select Testrig Activity.
2. Press
F1 and then follow the instructions in the dialog box help for
Testrig Activity.
3. Select OK.
If activating the test rig, your template-based product does the following:
■Disassembles the assembly, which includes 'unassigning' communicators.
■Activates the selected test rig, which means that it will now be considered a valid part of the assembly.
■Renames the selected test rig as “testrig”.
■Reassembles the assembly (with the activated test rig now taking part), which includes re-assigning the communicators.
If deactivating the test rig, your template-based product does the following:
■Disassembles the assembly, which includes 'unassigning' communicators.
■Deactivates the test rig, which means that it is not actually removed from the assembly, but simply ignored.
■Renames the selected test rig as its original name (e.g. “__MDI_SDI_TESTRIG”).
■Reassembles the assembly (with the deactivated test rig not considered), which includes re-assigning the communicators.