Getting Started Using ADAMS/Controls - Started Using ADAMS... · Getting Started Using ADAMS/Controls…

  • Published on
    29-Jun-2018

  • View
    214

  • Download
    2

Transcript

Getting Started Using ADAMS/ControlsAbout this Guide 3Learning the Basics 5Introducing and Starting the Tutorials 11Learning ADAMS/Controls with MATLAB 29Learning ADAMS/Controls with Control System Import 45Learning ADAMS/Controls with EASY5 57Learning ADAMS/Controls with MATRIXx 77Setting Simulation Parameters 101Advanced Topics 107 2 Getting Started Using ADAMS/ControlsCopyrightU.S. Government Restricted Rights: If the Software and Documentation are provided in connection with a government contract, then they are provided with RESTRICTED RIGHTS. Use, duplication or disclosure is subject to restrictions stated in paragraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at 252.227-7013. Mechanical Dynamics, Incorporated, 2300 Traverwood Drive, Ann Arbor, Michigan 48105.The information in this document is furnished for informational use only, may be revised from time to time, and should not be construed as a commitment by Mechanical Dynamics, Incorporated. Mechanical Dynamics, Incorporated, assumes no responsibility or liability for any errors or inaccuracies that may appear in this document.This document contains proprietary and copyrighted information. Mechanical Dynamics, Incorporated permits licensees of ADAMS software products to print out or copy this document or portions thereof solely for internal use in connection with the licensed software. No part of this document may be copied for any other purpose or distributed or translated into any other language without the prior written permission of Mechanical Dynamics, Incorporated.2002 by Mechanical Dynamics, Incorporated. All rights reserved. Printed in the United States of America.ADAMS is a registered United States trademark of Mechanical Dynamics, Incorporated.All other product names are trademarks of their respective companies.Part number: 120CTGS-01Getting Started Using ADAMS/ControlsAbout this Guide3About this GuideWelcome to ADAMS/ControlsADAMS/Controls is a plug-in to MDIs ADAMS/Car, ADAMS/Chassis, ADAMS/Rail, ADAMS/View, or ADAMS/Solver that helps you add sophisticated controls to your ADAMS model. ADAMS/Controls lets you connect your ADAMS model to block diagrams that youve developed with control applications such as EASY5, MATLAB, or MATRIXX.ADAMS/Controls offers you the option of: Simulating the combined mechanical system and controller entirely within the controls application, Simulating entirely within ADAMS, or Solving the controls equations with the control package and solving the mechanical system equations with ADAMS. ADAMS/Controls also lets you interactively view the simulation results in ADAMS/Car, ADAMS/Chassis, ADAMS/Rail, and ADAMS/View.What You Need to KnowThis guide assumes that you know how to run ADAMS/View or ADAMS/Solver. It also assumes that you have a moderate level of proficiency with one of the controls packages with which ADAMS has an interface. These include: EASY5, MATLAB, or MATRIXX. To use ADAMS/Controls, you need access to one of these controls packages so that you can prepare a controls block diagram, add it to your mechanical model, and simulate the combined system. For information on other MDI products, see the online Road Map to ADAMS Documentation.Getting Started Using ADAMS/ControlsAbout this Guide41 Learning the BasicsOverviewADAMS/Controls helps you connect your ADAMS mechanical system models to block diagrams developed with EASY5, MATLAB, or MATRIXX. This chapter introduces you to ADAMS/Controls and the basics of its interface features. It contains the following sections: How You Benefit from Using ADAMS/Controls, 6 How to Improve the Design Process with ADAMS/Controls, 6 Ways in Which You Can Use ADAMS/Controls, 8 About the ADAMS/Controls Four-Step Process, 9 How to Learn ADAMS/Controls, 10Getting Started Using ADAMS/ControlsLearning the Basics6How You Benefit from Using ADAMS/ControlsBy combining mechanical system simulation tools and controls design tools, you can: Add sophisticated controls to an ADAMS model and simulate the combined system. Generate mechanical system simulation models directly from your ADAMS data without having to write equations. Analyze the results of your simulation in the ADAMS environment or the controls application environment.How to Improve the Design Process with ADAMS/ControlsIn the typical design process of a mechanical system with controls, the mechanical designer and the controls designer work from the same concept, but use different sets of software tools. The result is that each designer produces a model for the same problem.Each design is then subject to verification and testing, and the first time the two designs are brought together is during physical prototype testing. If a problem occurs during the interaction between the controls design and the mechanical design, the engineers must refine the control design, the mechanical design, or both, and then go through the entire verification process again as shown in Figure 1 on page 7.Getting Started Using ADAMS/ControlsLearning the Basics7Figure 1. Design Process Before ADAMS/ControlsWith ADAMS/Controls, the two designers can share the same mechanical model. They can also verify from one database the combined effects of a control system on a nonlinear, non-rigid model. The physical testing process is greatly simplified, and the risk of having a control law that is developed for the wrong mechanical model is eliminated as you can see in Figure 2 on page 8.Getting Started Using ADAMS/ControlsLearning the Basics8Figure 2. Improved Design Process with ADAMS/ControlsWays in Which You Can Use ADAMS/ControlsYou can use ADAMS/Controls in the ways listed below. The simulation method you choose, interactive or batch, determines which application you use. ADAMS/Car, ADAMS/Chassis, ADAMS/Rail and ADAMS/View - By using ADAMS/Controls with one of these products, you can animate your model and view the effects of the control system and any structural modifications you make. This is the application you use if you are running an interactive simulation. ADAMS/Solver - For faster simulation results, you can run ADAMS/Controls directly with ADAMS/Solver, MDIs powerful analysis engine. This is the application you use if you are running a simulation in batch mode.Getting Started Using ADAMS/ControlsLearning the Basics9Note: You also have the option with ADAMS/Controls to export either a linear or nonlinear version of your ADAMS plant to the controls application, or to import the controls system definition into ADAMS. Importing the control system requires Mathworks Real-Time Workshop.About the ADAMS/Controls Four-Step ProcessThe diagram in Figure 3 describes the four-step process of combining controls with a mechanical system. The tutorials in this guide walk you through the detailed procedures for each step.Figure 3. ADAMS/Controls Four-Step Process Step One: Build the Model - The first step in working with ADAMS/Controls is to build or import an ADAMS model. The model should be complete and include all necessary geometry, constraints, forces, and measures. Step Two: Identify the ADAMS Inputs and Outputs - Define the inputs and outputs through the information or startup file in your ADAMS product. The outputs describe the variables that go to the controls application (the output from the ADAMS model is the input to the controls system). The inputs describe the variables that come back into ADAMS (the output of the controls application) and, therefore, complete a closed loop between ADAMS and the controls application. All inputs and outputs must be set up as variables. Optionally, export the plant system files from ADAMS for use in the controls simulation software.Step One:Build the ADAMS model. Step Two:Identify the ADAMS inputs and outputs and export the plant model. Step Three:Build the control system block diagram.Step Four:Simulate the model.Getting Started Using ADAMS/ControlsLearning the Basics10 Step Three: Build the Block Diagram - Build the control system block diagram with one of the following applications: EASY5, MATLAB, or MATRIXX. Include the ADAMS plant in your block diagram, or if using Real-Time Workshop, export the controls system and import into ADAMS. Step Four: Simulate the Model - Simulate the combined mechanical model and control system. Several different methods are available to run your simulation. How to Learn ADAMS/ControlsThis guide introduces you to the most basic concepts of Using ADAMS/Controls through a series of tutorials. You begin learning ADAMS/Controls with Chapter 2, Introducing and Starting the Tutorials. This material explains the basics of the ADAMS side of the ADAMS/Controls interface. After you complete Chapter 2, you continue with the tutorial that is associated with the specific controls application you are using, including EASY5, Control System Import, MATLAB, or MATRIXX. ADAMS/Car, Chassis, Rail, or View or ADAMS/SolverADAMS Input ADAMS OutputControls InputControls ApplicationControls Output2 Introducing and Starting the TutorialsOverviewThis chapter starts you off on the process of adding controls to your ADAMS model. Following this chapter are four different tutorials, one for each of the controls applications you can use with ADAMS/Controls: EASY5, Control System Import, MATLAB, or MATRIXX. After you finish this chapter, continue with the tutorial that is specific to the controls application you are using. This chapter contains the following sections: About the Tutorial, 12 How Youll Learn ADAMS/Controls, 12 Starting ADAMS/View, 13 Step One - Importing the ADAMS Model, 14 Step Two - Creating the ADAMS Plant Inputs and Outputs, 18Note: Before doing these tutorials, you should be familiar with the basic features of the ADAMS/View interface. See the guide, Learning ADAMS/View Basics, for information about the ADAMS/View interface. This tutorial takes about two hours to complete.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials12About the TutorialThe tutorials in this guide give you an overview of the four-step process of adding controls to an ADAMS model. This chapter covers Steps One and Two of the process in depth. Youll learn how to: Import an ADAMS model and run a trial simulation with ADAMS/View. Use the ADAMS/Controls interface features to identify forces, motions, and sensors on your mechanical model.Steps Three and Four are covered in the chapters that follow for each controls application.How Youll Learn ADAMS/ControlsBy following the tutorials in this guide, youll apply the four-step process of using ADAMS/Controls on a simple antenna-pointing problem. The objective of the problem is to add a control system to the antenna that will move the antenna along a defined path to track a satellite signal.For this tutorial, you will supply the torque that pivots the antenna in the azimuthal (horizontal) direction. The torque level will be computed by a control system, based on the error between the actual antenna position and the desired antenna position. This is more realistic than attaching an ADAMS motion to the pivot and driving the motion directly. By applying a torque, you can look at issues related to motor size in an actual mechanical system.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials13Starting ADAMS/ViewIn this section, you learn how to create a new directory and start ADAM/Controls from within ADAMS/View in the UNIX and Windows environments.In the UNIX environment, you start ADAMS/View from the ADAMS Toolbar, and then, from within ADAMS/View, you load the ADAMS/Controls plug-in. For information on the ADAMS Toolbar, see the guide, Running and Configuring ADAMS on UNIX. In the Windows environment, you start ADAMS/View from the Start menu, and then load the ADAMS/Controls plug-in. For more information, see the guide, Running ADAMS on Windows.To start ADAMS/View:1 Copy all of the files in install_dir/controls/examples/antenna to a new directory.2 Do either of the following depending on the platform on which you are running ADAMS/View: In UNIX, type the command to start the ADAMS Toolbar at the command prompt, and then press Enter. Select the ADAMS/View tool . In Windows, from the Start menu, point to Programs, point to ADAMS 12.0, point to AView, and then select ADAMS - View. The Welcome dialog box appears, in the ADAMS/View main window.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials14Step One - Importing the ADAMS ModelNow youll import an ADAMS model and familiarize yourself with its construction by following the next four sections: Importing the ADAMS Model, 14 Loading ADAMS/Controls, 15 Running a Trial Simulation, 16 Running a Trial Simulation, 16Importing the ADAMS Model1 In the Start In text box on the ADAMS/View welcome screen, enter the name of your new directory (the one created in Step 1 on page 13).This sets your new directory as your working directory.2 Select Close to close the ADAMS/View welcome screen and open ADAMS/View.3 In ADAMS/View, from the File menu, select Import.4 Right-click the File to Read text box, and then select Browse. The File Selection dialog box appears.5 Select the file antenna.cmd.6 Select OK. This file contains a model called main_olt. An antenna model like the one shown in Figure 4 on page 15 appears.7 Wait for the model to load and then select Render from the Main Toolbox to change the display of the antenna from a line drawing into a shaded, three-dimensional image.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials15Figure 4. Shaded Model of AntennaLoading ADAMS/ControlsBecause ADAMS/Controls is a plug-in for ADAMS/View, you need to load ADAMS/Controls when you use it with ADAMS/View. To load ADAMS/Controls: From the Tools menu, point to Plugins, point to Controls, and then select Load.ADAMS/View loads the ADAMS/Controls plug-in. Azimuth rotorAntenna supportElevation bearingsPlateReduction gearAntennaGetting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials16Familiarizing Yourself with the ModelThis model is designed so that its base turns in the azimuthal (horizontal) direction and its antenna moves in the vertical direction.To familiarize yourself with the model, locate the following components: Azimuth rotor (peach) tied by revolute joint to ground. Azimuth reduction gear (sky blue) tied by revolute joint to ground. Azimuth plate (magenta) tied by revolute joint to ground. Antenna support (silver) tied by fixed joint to plate. Elevation bearings (peach) tied by fixed joint to support. Antenna (sky blue) tied by revolute joint to bearings.Running a Trial SimulationTo run a trial simulation with ADAMS/View:1 From the Main toolbox, select the Simulate tool .2 Enter the following in the Simulation container of the Main toolbox: In the End Time text box, enter 0.5 seconds. In the Steps text box, enter 250. 3 Select the Static Equilibrium tool to equalize the applied forces and locate the static position of the model.4 Select the Simulation Start tool . The base of the mechanism turns counterclockwise as the antenna moves up and down. Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials17Deactivating the MotionNow that you know the model is working properly, you can begin the process of adding a control system to it. The first step is to deactivate the azimuthal motion on the model. When the model is deactivated, the joint .main_olt.azimuth_actuator applies a torque based on values that the Controls system package provides.To deactivate the motion:1 From the Edit menu, select Deactivate.The Database Navigator appears.2 Double-click the model main_olt.A list of parts and motions appears. 3 Scroll down the list and select azimuth_motion_csd.4 Select OK. ADAMS/View deactivates the motion.5 Select the Reset to Start tool to reset the simulation back to its first frame.6 Rerun the simulation. Now that youve deactivated the azimuthal motion, the antenna moves up and down, but it does not move horizontally as it did during the last simulation. Note: You might detect some small movement in the azimuthal direction because the model has no constraints or restoring forces to control its natural movement. You should also notice that the flex to the antenna support beam increases when the azimuthal motion is deactivated. The flexing illustrates that a certain amount of coupling takes place between the elevation and azimuthal movements.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials18Step Two - Creating the ADAMS Plant Inputs and OutputsNow youll identify the inputs and outputs on the ADAMS model by: Identifying the ADAMS Plant Inputs and Outputs, 19 Verifying Input Variables, 20 Verifying Input Functions, 22 Verifying Output Functions, 23 Exporting the ADAMS Plant Files for the Controls Application, 24Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials19Identifying the ADAMS Plant Inputs and OutputsFigure 5 indicates the path of the input and output variables to and from the antenna model and its control system. This diagram shows that when you supply an input control torque to the antenna model, you receive outputs to the controller of azimuth_position and rotor_velocity.The circular path allows you to: Define the input and output variables in ADAMS/View. Read in the plant and the input/output variables with EASY5, MATLAB, or MATRIXX, create an ADAMS plant, and run a simulation. Animate and plot the simulation results in ADAMS/View. Modify the variables and repeat this process as necessary.Figure 5. Terminology for ADAMS Inputs and OutputsOutput = azimuth_position and rotor_velocityInput = control _torque ADAMSmodelControlsystemGetting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials20Verifying Input VariablesADAMS/Controls and controls applications such as EASY5, MATLAB, and MATRIXX communicate by passing state variables back and forth. Therefore, you must define your models input and output variables (and the functions that those inputs and outputs reference) with a set of state variables. This step has already been done for you in the antenna model that you imported. When you create a new model, you will have to define the state variables for your input and output variables to the ADAMS model. For this tutorial, you will only verify that the state variables on the antenna model and control system correspond to the correct input and output variables. For a description of state variables, see Design Variables versus State Variables on page 108.To verify the input variables:1 From the Build menu, point to System Elements, point to State Variable, and then select Modify.The Database Navigator appears.2 Double-click the model main_olt.The list of ADAMS variables appears.Figure 6. List of ADAMS VariablesGetting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials213 Select control_torque.4 Select OK.The Modify State Variable dialog box appears.Figure 7. Modify State Variable Dialog Box5 Look in the F(time, ...)= text box and verify that the run-time function for the input variable, control_torque, is 0.0. Because the control torque will get its value from the control application, the 0.0 will be overwritten during each step of the simulation. 6 Select Cancel to close the Modify State Variable dialog box. Note: After you close the box, click in the background of the screen to clear the selection of the model.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials22Verifying Input FunctionsNow youll verify the function that references the input variable.To verify the function that is referenced to the input variable, control_torque:1 From the Edit menu, select Modify.The Database Navigator appears.2 Double-click main_olt, and then double-click azimuth_actuator (azimuth_actuator is the name of the control torque).The Modify Torque dialog box appears. Figure 8. Modify Torque Dialog Box3 Look in the F(time, ...)= text box and verify that the run-time function for the input variable reads: VARVAL(.main_olt.control_torque).Note: VARVAL (short for variable value) is the ADAMS function that returns the value of the given variable. Notice that the function is defined as the value of the control_torque variable. In other words, the input control torque (azimuth_actuator) gets its value from the input variable.4 Select Cancel to close the Modify Torque dialog box.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials23Verifying Output FunctionsNow youll verify the output functions just as you verified the input functions in the previous section.To verify the output functions:1 From the Build menu, point to System Elements, point to State Variable, and then select Modify.The Variable Selection dialog box appears.2 Double-click the model main_olt.The list of ADAMS variables appears.3 Select azimuth_position.4 Select OK.The Modify State Variable dialog box appears.Figure 9. Modify State Variable Dialog Box5 Look in the F(time, ...)= text box to verify that the run-time function for the output variable is AZ(.main_olt.bearings.MAR70, .main_olt.ground.MAR26). This function returns the angle about the z-axis, the axis about which the given object moves. Therefore, the function assigns the rotating position of the antenna to the output state variable. 6 Select Cancel to close the Modify State Variable dialog box.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials247 From the Build menu, point to System Elements, point to State Variable, and then select Modify.The Variable Selection dialog box appears.8 Double-click the model main_olt.The list of ADAMS variables appears.9 Select rotor_velocity.10 Select OK.The Modify State Variable dialog box appears.11 Look at the F(time, ...)= text box and verify the run-time function for the output variable is WZ(.main_olt.rotor.MAR21, .main_olt.ground.MAR22, .main_olt.ground.MAR22).This function measures the rotational velocity of the given object.Exporting the ADAMS Plant Files for the Controls ApplicationIn this section, you will export the ADAMS linear and nonlinear plant files.To export the nonlinear plant files:1 From the Controls menu, select Plant Export.The ADAMS/Controls Plant Export dialog box appears.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials25Figure 10. ADAMS/Controls Plant Export Dialog Box2 In the File Prefix text box, type ant_test for the filename.This defines the prefix for the .adm, .cmd, .acf, .m, and .inf files created by the Plant Export dialog box.3 Right-click the Plant Input text box, point to Plant Input, and then select Create.The Data Element Create Plant Input dialog box appears.Note: If you want to use an existing plant input, right-click the Plant Input text box, point to Plant Input, and then select Browse. Then, you can select your plant input from the Database Navigator.4 Complete the dialog box as shown below:5 Select OK. Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials266 In the ADAMS/Controls Plant Export dialog box, right-click the Plant Output text box, point to Plant Output, and then select Create.The Data Element Create Plant Output dialog box appears.Note: If you want to use an existing plant output, right-click the Plant Output text box, point to Plant Output, and then select Browse. Then, you can select your plant output from the Database Navigator.7 Complete the dialog box as shown below:8 Select OK. 9 Right-click the Control Package text box, and then select the controls application you are using during this session: Matlab or MATRIXx_and_EASY5.10 Select Apply. ADAMS/Controls saves the input and output information in a .m or .inf file (.m for MATLAB or .inf for MATRIXX and EASY5). It also generates a command file (.cmd) and a dataset file (.adm) that are used during the simulation process.To export the linear plant files:1 Run the static equilibrium again as described in Running a Trial Simulation on page 16.2 From the Controls menu, select Plant Export.In the ADAMS/Controls Plant Export dialog box, change the file prefix from ant_test to ant_test_l.3 Set Type to Linear.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials274 Select OK.ADAMS/Controls generates the linear model of the ADAMS model in four matrices: ADAMS_a, ADAMS_b, ADAMS_c, and ADAMS_d.ADAMS/Controls setup is complete after the plant files have been exported. Now you will go to the specific controls application (EASY5, MATLAB, or MATRIXX) and complete the link between the controls and mechanical systems.Note: You have now finished the introduction to the ADAMS/Controls tutorials. To continue learning the ADAMS/Controls interface, go to the tutorials that follow this section. If you are using: MATLAB, go to Chapter 3, Learning ADAMS/Controls with MATLAB. Control System Import, go to Chapter 4, Learning ADAMS/Controls with Control System Import. EASY5, go to Chapter 5, Learning ADAMS/Controls with EASY5. MATRIXx, go to Chapter 6, Learning ADAMS/Controls with MATRIXx.Getting Started Using ADAMS/ControlsIntroducing and Starting the Tutorials283 Learning ADAMS/Controls with MATLABOverviewThis chapter teaches you how to use ADAMS/Controls with MATLAB. It contains the following sections: About the Tutorial, 30 Step Three - Adding Controls to the ADAMS Block Diagram, 31 Step Four - Simulating the Model, 38Note: Before beginning this tutorial, you should have finished 2, Introducing and Starting the Tutorials.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB30About the TutorialThis chapter provides procedures for using ADAMS/Controls with MATLAB. It teaches you Steps 3 and 4 of the four-step process of adding controls to an ADAMS model. You will learn how to: Add an ADAMS plant to your block diagram in MATLAB simulation. Simulate an ADAMS model with a complex control system. Plot simulation results.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB31Step Three - Adding Controls to the ADAMS Block DiagramYou will add controls to the ADAMS block diagrams by: Starting MATLAB, 31 Creating the ADAMS Block Diagram, 33 Setting Simulation Parameters in the Plant Mask, 36 Constructing the Controls System Block Diagram, 35Starting MATLABA note about your ADAMS license(s): Running an ADAMS/Controls cosimulation will check out an ADAMS/Solver license and possibly an ADAMS/View license (for interactive simulations only). To ensure that you are able to run these products, close your current ADAMS/Controls session.To start using MATLAB:1 Start MATLAB on your system. 2 Change directories to the one in which your ant_test.m file resides (the working directory you specified during your ADAMS/Controls session).You can do this by entering the following: On Windows: cd c:\new_dir, where new_dir is the name of your working directory. On UNIX, cd /new_dir, where new_dir is the name of your working directory.3 At the prompt (>>), type ant_test. MATLAB echoes:%%%INFO:ADAMS plant actuators names:1 control_torque%%%INFO:ADAMS plant sensors names:1 rotor_velocity2 azimuth_position.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB324 At the prompt, type who to get the list of variables defined in the files. MATLAB echoes:ADAMS_exec ADAMS_mode ADAMS_poutput ADAMS_sysdirADAMS_init ADAMS_outputs ADAMS_prefix ADAMS_uy_idsADAMS_inputs ADAMS_pinput ADAMS_staticYou can check any of the above variables by entering them in at the MATLAB prompt. For example, if you enter ADAMS_outputs, MATLAB displays all of the outputs defined for your mechanism: ADAMS_outputs= rotor_velocity!azimuth_position. Note: If you want to import the linearized ADAMS model, use ant_test_l.m instead of ant_test.m. The difference is in the ADAMS_mode variable: In ant_test.m, ADAMS_mode=non_linear. In ant_test_l.m, ADAMS_mode=linear.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB33Creating the ADAMS Block DiagramTo create the ADAMS block diagram:1 At the MATLAB prompt, enter adams_sys. This builds a new model in Simulink named adams_sys.mdl. This model contains the Mechanical Dynamics S-Function block representing your mechanical system.A palette containing the ADAMS blocks appears. These blocks represent your ADAMS model in different ways: The S-Function represents the nonlinear ADAMS model. The adams_sub contains the S-Function, but also creates several useful MATLAB variables. The State-Space block represents a linearized ADAMS model.The adams_sub block is created based on the information from the .m file (either from ant_test.m or ant_test_l.m). If the ADAMS_mode is nonlinear, the S-Function block is used in the adams_sub subsystem. Otherwise, the State_Space block is copied into adams_sub.Figure 11. Simulink PaletteGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB342 From the File menu, point to New, and then select Model. A new palette for building your block diagram appears.3 Drag and drop the adams_sub block from the adams_sys palette onto the new palette.4 Double-click the adams_sub block. All of the elements in the subsystem appear.Figure 12. adams_sub blockNote: The inputs and outputs you defined for the model appear in the sub-block. The input and output names automatically match up with the information read in from the ant_test.m file.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB35Constructing the Controls System Block DiagramThe completed block diagram is in the file, antenna.mdl, in the examples directory. To save time, you can read in our diagram instead of building it. Remember to update the settings in the plant mask if you decide to use this file (see Setting Simulation Parameters in the Plant Mask, on page 36).To construct the controls system block diagram:1 At the MATLAB prompt, type simulink.The Simulink library palettes appear. Use the block icons from the palettes to complete your controls block diagram. Each icon contains a submenu. 2 Double-click each icon to reveal its submenu.Note: Be sure to set the step input block parameters as follows: Step time: 0.001 Initial value: 0 Final value: .3 Sample time: .0013 Look at the controls block diagram in Figure 13. 4 Drag and drop the appropriate blocks from the Simulink library to complete your block diagram as shown below.Figure 13. Controls Block DiagramGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB365 From the File menu, select Save As, and enter a file name for your controls block diagram.Setting Simulation Parameters in the Plant MaskTo set the simulation parameters:1 From the new Simulink palette, double-click the Mechanical Dynamics block. The ADAMS Plant Mask dialog box appears.Figure 14. ADAMS Plant Mask2 In the Output Files Prefix text box, enter mytest. Be sure to enclose the name with single quotation marks. ADAMS/Controls saves your simulation results under this name in the three file types listed in Table 1 on page 37.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB373 Select a simulation parameter for each text box. Set Simulation mode to discrete.This mode specifies that ADAMS solve the mechanical system equations and that the controls application solve the control system equations. See the section, Choosing a Simulation Method, on page 102, for more details about simulation modes. Set Animation mode to interactive.Animation mode allows you to graphically monitor your simulation results in ADAMS/View. See the section, Choosing an Animation Option, on page 105, for more details about animation modes. Select automatic for initialization mode. See the section, Choosing an Initialization Method, on page 106, for more details about initialization modes.4 Select Apply.5 Select Close to close the plant mask.Table 1. File TypesFile name: File type: What the file contains:mytest.res Results ADAMS/Solver analysis data and ADAMS/View graphics datamytest.req Requests ADAMS/Solver analysis datamytest.gra Graphics ADAMS/View graphics dataGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB38Step Four - Simulating the ModelYou will simulate your mechanical model and control system by: Setting the Simulation Parameters, 38 Executing the Simulation, 39 Pausing the Simulation, 39 Plotting from MATLAB, 40 Plotting from ADAMS/View, 42Setting the Simulation ParametersTo set the simulation parameters:1 From the menus on the Simulink palette, select Simulation, and then select Parameters. The Simulation Parameters dialog box appears.2 Enter the following simulation parameters: For Start Time, enter 0.0 seconds. For End Time, enter 0.25 seconds.3 Select the Type text box for the Solver options: Set the first text box to variable step mode. Set the second text box to ode15s. Accept the default values in the remaining text boxes.4 Select OK to close the Simulation Parameters dialog box.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB39Executing the SimulationTo start the simulation: Select Start. A new ADAMS/View window opens and graphically displays the simulation. If youre using Windows, a DOS window appears with the current simulation data. If youre using UNIX, the current simulation data scrolls across the MATLAB window.ADAMS accepts the control inputs from MATLAB and integrates the ADAMS model in response to them. At the same time, ADAMS provides the azimuthal position and rotor velocity information for MATLAB to integrate the Simulink model. This simulation process creates a closed loop in which the control inputs from MATLAB affect the ADAMS simulation, and the ADAMS outputs affect the control input levels. See Figure 5 on page 19 for an illustration of the closed loop simulation process.Pausing the SimulationThe interactive capabilities of ADAMS/Controls let you pause the simulation in MATLAB and monitor the graphic results in ADAMS/View. Since MATLAB controls the simulation, you must pause the simulation from within MATLAB. You can plot simulation results during pause mode.To pause the simulation:1 A time display in the upper left corner of the ADAMS screen tracks the seconds of the simulation. To pause the simulation, move your cursor to the Simulink palette, point to Simulation, and then select Pause. MATLAB suspends the simulation.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB402 Now go back to ADAMS/View. While the simulation is paused, you can change the orientation of the model with the View Orientation tools in the Main toolbox. These tools help you to look at the model from different vantage points.Figure 15. View Orientation Tools3 Once you have finished reorienting the model, resume the simulation by selecting Simulation, and then Start, from the toolbar on the Simulink palette.ADAMS/View closes automatically after the simulation finishes.Plotting from MATLABYou can plot any of the data generated in MATLAB. In this tutorial, you will plot the ADAMS_uout data that is saved in the adams_sub block. This block is shaded in the figure below. Figure 16. adams_sub BlockGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB41To plot from MATLAB: At the MATLAB prompt, type in the following command:>>plot (ADAMS_tout, ADAMS_uout)The plot window opens and shows the time history of input from MATLAB to ADAMS. Figure 17 shows you how the plot should look. Notice that the control torque reaches a peak, and then settles down as the antenna accelerates. As the antenna gets close to its final position, the torque reverses direction to slow down the antenna. The antenna moves past its desired position, and then settles down to the point of zero error. At this point, the torque value is also at zero.To add labels to your plot: At the MATLAB prompt, enter:>>xlabel(time in seconds)>>ylabel(Control Torque Input, N-m)>>title(ADAMS/Controls Torque Input from MATLAB to ADAMS)The labels appear on the plot.Figure 17. Control Torque Input from MATLAB to ADAMSGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB42Plotting from ADAMS/ViewTo plot from ADAMS/View:1 Display ADAMS/View in a new system window and read in the command file, ant_test.cmd.2 From the File menu, select Import.The File Selection dialog box appears.3 In the File Selection dialog box, select the following: For the File Type, select ADAMS Results File. For Files to Read, select Read mytest.res. For Model, select main_olt. Be sure to include the model name when you read in results files. ADAMS/View needs to associate the results data with a specific model.Note: You can plot any data from the simulation and rerun the animation from ADAMS/View.4 From the Review menu, select Postprocessing.ADAMS/View launches ADAMS/PostProcessor, a post-processing tool that lets you view the results of the simulations you performed (see Figure 18 on page 43). ADAMS/PostProcessor has two modes: plotting (default) and animation, as shown in the first option menu on the menu toolbar. Note that the page in the plot/animation viewing area can contain up to six viewports to let you compare plots and animations. Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB43Figure 18. ADAMS/PostProcessor Window5 From the dashboard, set Source to Objects.6 From the Model list, select .main_olt.7 From the Filter list, select constraint.8 From the Object list, select antenna_joint.9 From the Characteristic list, select Element Torque.10 From the Component list, select Y.11 Select Add Curves. ADAMS/PostProcessor generates the curve.Menu barMenu toolbarTreeviewProperty editorStatus toolbarDashboardViewportsPageGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATLAB44To add labels to your plot:1 In the treeview, navigate to the plot and select it.2 In the Property Editor that appears, in the Title text box, enter the name: Antenna Joint Peak Torque, Controlled. The plot title appears above the plot. Figure 19 illustrates how the curve should look. The curve shows the torque in the antenna joint from the azimuth control loop. You can use the information on the plot to help you determine how to modify the control system of the antenna model. For example, you can reduce the load in the antenna joint by decreasing the velocity gain of the azimuth controller at the expense of slowing the overall response of the controller. This is the type of trade-off between the mechanism design and the control design that you can analyze using ADAMS/Controls.Figure 19. ADAMS Antenna Joint Peak Torque, Controlled4 Learning ADAMS/Controls with Control System ImportOverviewThis chapter teaches you how to import the C-code of control systems designed in control programs into ADAMS in terms of GSE (General State Equations). It contains the following sections: Step One Create Control System for Code Generation, 46 Step Two Code Generation of Control System, 48 Step Three Create GSE for the Simulink Model, 53Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import46About the TutorialThis chapter provides the procedures to import control systems designed in MATLAB/Simulink into ADAMS. It depends on MATLAB/Real-Time Workshop to convert the control model to C-code. This tutorial is based on the files output from ADAMS/View in the previous chapter.The antenna model is still used in this chapter. The controller used in last chapter will be modified to represent three different types of controllers: continuous, discrete, and hybrid (continuous/discrete). Those three simulink files (continuous.mdl, discrete.mdl, and hybrid.mdl) are in the example directory. Copy them to the local directory.Step One Create Control System for Code GenerationFirst you will start MATLAB, and then you will create simulink template for control system design. You will use the antenna model files from the last section, plus several additional files.To start MATLAB: 1 Start MATLAB in the same directory as the one the model and Simulink files reside. 2 At the prompt (>>), type ant_test. MATLAB displays:%%%INFO:ADAMS plant actuators names:1 control_torque%%%INFO:ADAMS plant sensors names:1 rotor_velocity2 azimuth_position.3 At the prompt, type who to get the list of variables defined in the files. MATLAB displays:ADAMS_exec ADAMS_mode ADAMS_poutput ADAMS_sysdirADAMS_init ADAMS_outputs ADAMS_prefix ADAMS_uy_idsADAMS_inputs ADAMS_pinput ADAMS_staticGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import47You can check any of the above variables by entering them at the MATLAB prompt. For example, if you enter ADAMS_outputs, MATLAB displays all of the outputs defined for your mechanism. For example,ADAMS_outputs= rotor_velocity!azimuth_position To create the Simulink template for the control system: Enter setio at the MATLAB prompt.MATLAB creates a template model with the inport(s) and outport(s) defined, as shown in the following figure:Figure 20. Simulink TemplateBased on this template, you can design the continuous, discrete, and hybrid control systems. These are the files you already copied into the local directory.In the following context, the hybrid control system will be used as the main example to illustrate the process, whereas the continuous and discrete control systems will be used to a lessor extent. Figure 21 on page 48 shows the hybrid system which can be opened from the hybrid.mdl file. You can also display the Simulink model of continuous and discrete control systems.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import48Figure 21. Hybrid Control SystemStep Two Code Generation of Control SystemFirst you will create code from the Simulink model and then you will create the Simulink model object file.Given a controller designed with the appropriately designated inports and outports, the following steps are required to export the model using RTW.To create code from the Simulink model:1 Copy the RTW template files from the MATLAB installation into the current working directory as follows: From $(MATLAB_ROOT)/rtw/c/grt, copy the makefile template to the directory where the Simulink model resides. On UNIX, the makefile template is grt_unix.tmf. On Windows, the makefile template is grt_vc.tmf. From $(MATLAB_ROOT)/rtw/c/tlc, copy the source code template srtbody.tlc to the directory where the Simulink model resides.For more information on these template files, refer to the Real-Time Workshop Users Guide from Mathworks.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import492 Modify the makefile template as follows: On UNIX, insert the contents of the file /controls/matlab/unix_make, into grt_unix.tmf, immediately after the following line:#--------------------------------- Rules -------------------------------------- On Windows, insert the line adams : $(MODEL).obj into the grt_vc.tmf file, immediately after the following line:#--------------------------------- Rules --------------------------------------3 Modify the source code template as follows:In srtbody.tlc, insert the following two lines:#include "rt_nonfinite.c"#include "wrapper"immediately after the line#include "%_reg.h"4 From the Tools menu, point to Real-Time Workshop, and then select Options. The Simulation Parameters dialog box appears as shown in Figure 22.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import50Figure 22. Simulation Parameters - Real-Time Workshop5 On UNIX, make sure that Generate code only is selected. On Windows, deselect it.6 On UNIX, enter grt_unix.tmf in the Template makefile text box. On Windows, enter grt_vc.tmf.7 Accept all remaining default settings. 8 Select Solver tab.9 The dialog box displays the Solver options as shown in Figure 23 on page 51.On UNIX On WindowsGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import51Figure 23. Simulation Parameters - Solver Options10 Set Solver options Type to Fixed-Step11 Set Mode to SingleTasking. 12 Select a continuous integrator (because the control system has continuous states). For the control system discrete.mdl, you would select a Discrete integrator.13 Select the Real-Time Workshop tab.14 On UNIX, select the Generate code button to begin code generation. On Windows, select Build to proceed.Messages will appear in the MATLAB command window indicating: Successful code generation. Creation of Makefile from the template in the working directory. For MATLAB 6 and later, all the generated files are created in a subdirectory of the working directory, called $(MODEL)_grt_rtw. Otherwise, the code is generated in the working directory.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import52On Windows, a message panel appears indicating a failed build. Since we are only interested in code generation, build failure really does not matter. Instead, the build process will generate a batch file for our use later. Delete all .obj files in $(MODEL)_grt_rtw.To create the Simulink model object:In the directory $(MODEL)_grt_rtw, several files are created. In addition to several *.c and *.h file, there is also a makefile $(MODEL).mk. Next, you will create the object file (and shared library on UNIX) of the Simulink model. Select the proper make command. Refer to Table 2. In this case, $(MODEL) stands for hybrid.Table 2. RTW Make CommandsNote: On UNIX, be sure that the make command is the Gnu Make. On Windows, if the nmake utility does not work, you can use the batch file hybrid.bat. Modify this file and run it.Controller with discrete states:UNIX make -f hybrid.mk USER_INCLUDES="-DDGSE -I/controls/matlab"Windows nmake -f hybrid.mk USER_INCLUDES="-DDGSE -I/controls/matlab"Controller without discrete states:UNIX make -f hybrid.mk USER_INCLUDES="-I/controls/matlab"Windows nmake -f hybrid.mk USER_INCLUDES="-I/controls/matlab"File(s) created:UNIX $(MODEL).o $(MODEL).dllWindows $(MODEL).oGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import53Step Three Create GSE for the Simulink ModelFirst you will start ADAMS/View and import the command file, and then simulate your ADAMS model containing the GSE for the control system.To start ADAMS/View and load the command file:1 Launch ADAMS/View and import the file ant_test.cmd.2 Load the ADAMS/Controls plug-in.3 From the Controls menu, point to Control System, and then select Control System Import.The ADAMS/Controls System Import dialog box displays as shown in Figure 24 on page 53.Figure 24. ADAMS/Controls System Import Dialog Box4 Complete the dialog box and select OK.As shown in the Database Navigator below, ADAMS/Controls creates a GSE and its associated arrays.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import54Figure 25. Database NavigatorGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import55To simulate your model:1 From the Settings menu, point to Solver, and then select Dynamics.The Solver Setting dialog box displays.2 Change Formulation to SI2, if necessary.3 Run a simulation with a step size of .001s and duration of .25s.During the simulation, the antenna motion behaves the same as the one in the co-simulation. 4 Press F8 to open ADAMS/PostProcessor.5 ADAMS/PostProcessor displays the plot of azimuth position versus time, as shown in the figure below.Figure 26. Plot of Azimuth Position vs. TimeA comparison among the results of the above simulation, discrete simulation, and continuous simulation is conducted. In all cases, the output step (sampling time in discrete simulation) is set to .001 second. The control torque versus time from three simulations is plotted in Figure 27 on page 56. As shown, the result from the simulation with imported GSE is almost the same as that from continuous simulation. The control torque from the discrete simulation is slightly larger in magnitude because the one-step delay results in a control-mechanical system with less damping.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with Control System Import56Figure 27. Control Torque vs. Time5 Learning ADAMS/Controls with EASY5OverviewThis chapter teaches you how to use ADAMS/Controls with EASY5. It contains the following sections: About the Tutorial, 58 Step Three - Adding Controls to the ADAMS Block Diagram, 58 Step Four - Simulating the Model, 66Note: Before beginning this tutorial, you should have finished Chapter 2, Introducing and Starting the Tutorials.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY558About the TutorialThis chapter provides you with procedures for using ADAMS/Controls with EASY5. It teaches you Steps Three and Four of the four-step process of adding controls to an ADAMS model. Youll learn how to: Add an ADAMS plant to your block diagram in the EASY5 simulation. Simulate an ADAMS model with a complex control system. Plot simulation results.Step Three - Adding Controls to the ADAMS Block DiagramYou will add controls to the ADAMS block diagrams by: Starting EASY5, 58 Creating the ADAMS Interface Block, 59 Constructing the Controls System Block Diagram, 64Starting EASY5To start EASY5: Start EASY5 on your system from the directory that contains the file with the antenna example. This is the working directory that you created in Step One - Importing the ADAMS Model on page 14.The EASY5 main window appears.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY559Creating the ADAMS Interface BlockYou create the ADAMS interface block by defining its component parts in the Add Components dialog box. After you define the component parts, you place the block in the work space area of the EASY5 main window.To create the ADAMS interface block:1 From the EASY5 toolbar, select Add or type Ctrl+A.The Add Components window appears.Figure 28. Add Components WindowGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5602 Select a category for each of the component fields in the window. Under Opened libraries, select Extensions. Under Extension Groups, select ADAMS/Controls Extension. Under ADAMS/Controls Extension, select ADAMS Nonlinear Block.The information you supply in these fields becomes part of the ADAMS interface block.3 Move the cursor to the center of the EASY5 main window and click.The ADAMS interface block appears. You build the controls block diagram by adding elements to this block. Initializing the ADAMS Interface BlockTo initialize the ADAMS interface block:1 Use the middle mouse button to click the ADAMS interface block (for a two-button mouse, click the right and left buttons simultaneously).The Component Data Table appears.Figure 29. Component Data TableADAMS Nonlinear BlockGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5612 Select Spawn ADAMS Interface on the lower right corner of the Component Data Table.The ADAMS Interface dialog box appears (see Figure 30 on page 61).3 At the prompt, enter the following information: For information file name, enter ant_test.inf, which is the name of the file generated during the Plant Export from ADAMS/Controls, and press Enter. For number of independent states, enter 14, and press Enter. This number initializes the EASY5 integrator to accommodate space for 14 ADAMS states in continuous mode.The ADAMS Interface dialog box appears.Figure 30. ADAMS Interface Dialog BoxThree simulation methods are available: Option 1: Function evaluation mode with no feed-through Option 2: Function evaluation mode with feed-through Option 3: Co-simulation modeNote: Options 1 and 2 are continuous simulation methods and option 3 is a discrete simulation method. For information on choosing a simulation method, see Choosing a Simulation Method on page 102.If youve linearized a nonlinear ADAMS model and represented it as A, B, C, and D matrices and the matrix D is zero at all times, then there is no feed-through from the input variables to the output variables. If the matrix D is not zero at all times, then there is feed-through from the input variables to the output variables.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5624 For this example, enter option 3 to select the co-simulation method.The ADAMS Interface dialog box closes, and the Component Data Table now looks like Figure 31:Figure 31. Component Data Table5 In the Component Data Table, do the following:a Enter a value for the following input modes: For ANI_MOD, enter 1 to define interactive mode as the animation mode. For more details about animation modes, see the section, Choosing an Animation Option on page 105. For OUT_RAT (output rate interval), enter .001.Note: Do not change the USE_ICS flag. This flag determines how to set the initial conditions of the ADAMS model.If the USE_ICS flag is set to 1, the model uses the ADAMS initial conditions, which is the default.If the flag is set to 0, the model relies on EASY5 to provide the initial conditions. For example, if you need to start a simulation from the end of the last run simulation, which is stored on EASY5, set the USE_ICS flag to 0.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY563b Select Info from the lower left corner of the Component Data Table.The Component Information Page appears as shown in Figure 32. This page displays an overview of the ADAMS nonlinear block extension components. c Review the information on this page to ensure that you entered the correct values in the Component Data Table. Select Close to close the Component Information Page.Figure 32. Component Information PageGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5646 Return to the Component Data Table and do the following:a Place the cursor on the input name U1 and click the middle mouse button.The information line at the bottom of the EASY5 main window displays the input name as control_torque.b Click on the other output names, Y1 and Y2, and see that the output names read rotor_velocity and azimuth_position, respectively, and then select OK.The ADAMS block is now initialized for use with the antenna model.Constructing the Controls System Block DiagramThe completed block diagram is in the file, antenna.mf.0, in the examples directory. To save time, you can read in this diagram instead of building it.To construct the controls system block diagram:1 Review the controls block diagram in Figure 33. Begin recreating the diagram with the blocks from the Add Components menu. 2 Place the Step Function Generator block in the diagram first. 3 Click on the Step Function Generator block using the middle mouse button.The Component Data Table appears. 4 Set the step time (TO) to .01 and the step value (STP) to 0.3, and then select OK.Figure 33. Controls Block DiagramGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5655 Connect the input blocks by clicking once on the First Order Lag block and then on the ADAMS Nonlinear Block. EASY5 labels this connection as S2 LA11.6 Connect the output blocks in the diagram by clicking on the ADAMS Nonlinear Block and then on the Summing Junction block. Be sure to connect the azimuth+position output (Y2) to the first Summing Junction block (LA) and the rotor_velocity output (Y1) to the second Summing Junction block (LA11).7 Connect the Strip Chart to the ADAMS Nonlinear Block. Be sure to connect only the Y1 output to the Strip Chart. The Y1 output corresponds to the rotor-velocity signal from the ADAMS Nonlinear Block. 8 Click the Strip Chart using the middle mouse button to display the Component Data Table. Set the sample period TAU to .001, and then select OK.Note: You must edit the connection from the ADAMS Nonlinear Block to the Strip Chart because EASY5 automatically connects the state vector from the ADAMS block to the display variable on the Strip Chart.9 From the File menu, select Save As, and then enter a file name for your controls block diagram. You have now created the controls block diagram.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY566Step Four - Simulating the ModelYoull simulate your mechanical model and controls system by: Building the Executable, 66 Executing the Simulation, 66 Pausing and Stepping Through the Simulation, 70 Plotting from EASY5, 71 Plotting from ADAMS/View, 73Building the ExecutableYou must build an executable for your model before you execute a simulation in EASY5.To build the executable: In EASY5, from the Build menu, select Create Executable.After a few moments, EASY5 displays the message, Executable has been created, at the bottom of the main window.You are now ready to execute the simulation.Executing the SimulationTo execute the simulation from EASY5:1 From the toolbar at the top of the EASY5 main window, point to Analysis, point to Nonlinear, and then select Simulation.The Simulation Data Form window appears.2 For the Plot Results option, select Yes.The Show-Edit Plot Variables button appears.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5673 Select Show-Edit Plot Variables.A Plot Specification Form appears where you define the variables that you want to plot after the simulation.Note: If you are using the completed block diagram from the file, antenna.mf.0, that was provided for you in the examples directory, you may find that the Plot Specification Form opens with information that is unnecessary for this tutorial. To remove the information, select Select All on the bottom of the Plot Specification Form, and then select Delete. The Plot Specification Form should look like the one shown in Figure 34.Figure 34. Plot Specification FormGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5684 Select the variables that you want to plot for the simulation. For this tutorial, you will select three variables: Y1, Y2, and S2 LA11.a Click in the column next to number 1.A box appears. b Select Show Name List.The Pick Dialog box appears. c Select the variable Y1.d Repeat this procedure for a second and third variable. For the second variable, select Y2, and for the third, select S2 LA11 (the input to the ADAMS block as indicated in Figure 33).The finished Plot Specification Form should look like the one in Figure 35.Figure 35. Plot Specification Form Select OK.The Plot Specification Form closes.5 Return to the Simulation Data Form window and specify the following simulation parameters: For Start Time, enter 0.0. For Stop Time, enter .25. For Time Increment, enter .001. For Integration Method, enter BCS Gear.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5696 Select Execute and Close to begin the simulation. For more information about the simulation settings, see the EASY5 manual.A new ADAMS/View window appears and the analysis begins on the model specified in the ADAMS block. ADAMS/View displays the analysis for you.To run an interactive simulation:1 As the simulation begins, arrange the windows so that you have a good vantage point to view the antenna model.Note: The ADAMS model is initialized to the current simulation time in EASY5.2 Start and pause the simulation by selecting Continue and Break on the interactive plot window.ADAMS/View accepts the control inputs from EASY5 and integrates the ADAMS model in response to them. At the same time, ADAMS provides the azimuthal position and rotor velocity information for EASY5 to integrate the Simulink model. The simulation process creates a closed loop in which the control inputs from EASY5 affect the ADAMS simulation, and the ADAMS outputs affect the control input levels. See Figure 5 on page 19 for an illustration of the closed loop simulation process.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY570Pausing and Stepping Through the SimulationThe interactive capabilities of ADAMS/Controls let you pause the simulation in EASY5 and monitor the graphic results in ADAMS/View. You can plot simulation results during pause mode.To pause the simulation:1 Select Break to pause the simulation at the next sample step. You can use the interactive plot window (Figure 36) to pause the simulation, or you can single-step through the simulation. If you select Step, the simulation steps through one sample step (.001 seconds) of the interactive Strip Chart.Figure 36. Interactive Plot Window2 Now go back to ADAMS/View. While the simulation is paused, you can change the orientation of the model with the View Orientation tools in the Main toolbox. These tools help you to observe the model from different vantage points.Figure 37. View Orientation ToolsGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5713 Once you have finished reorienting the model, select Resume to continue the simulation.ADAMS/View closes automatically after the simulation finishes.The EASY5 Plotter window and the Plot Selection Menu appear.Plotting from EASY5EASY5 automatically displays the Plot window after running a simulation. By default, EASY5 displays the plot of the first variable you defined in the Plot Specification Form (see Figure 35 on page 68). You can plot any data generated in EASY5 by selecting a variable from the Plot Selection Menu. In this tutorial, youll plot the curve for control torque.To plot from EASY5: From the Plot Selection menu, point to Displays, and then select the variable, S2 LA11, which is the control torque input to the ADAMS block from EASY5.The EASY5 Plotter window displays the plot for control torque.Figure 38 on page 72 shows how the plot should look. Notice that the control torque reaches a peak, and then settles down as the antenna accelerates. As the antenna gets close to its final position, the torque reverses direction to slow down the antenna. The antenna moves past its desired position, and then settles down to the point of zero error. At this point, the torque value is also zero.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY572To add labels to the plot:1 At the bottom of the Plot Selection Menu, select Edit Display.The Display Specification Form appears.2 Enter the following labels: In the Plot Title text box, enter ADAMS/Controls Torque Input from EASY5 to ADAMS. In the x-axis text box, enter time in seconds. In the y-axis text box, enter Control Torque, N-m.The labels you entered appear on the plot as shown in Figure 38.Figure 38. Plot of Control Torque InputGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY573Plotting from ADAMS/ViewTo plot from ADAMS/View:1 Display ADAMS/View in a new system window and read in the command file, ant_test.cmd.2 From the File menu, select Import.The File Selection dialog box appears.3 Select the following: For File Type, select ADAMS Results File. For Files to Read, select antenna.res. For Model, select main_olt. When you read in results files, be sure to include the model name because ADAMS/View needs to associate the results data with a specific model.Note: You can plot any data from the simulation and rerun the animation from ADAMS/View.4 From the Review menu, select Postprocessing.ADAMS/View launches ADAMS/PostProcessor, a post-processing tool that lets you view the results of the simulations you performed. Take a minute to familiarize yourself with ADAMS/PostProcessor.Figure 39 on page 74 shows the ADAMS/PostProcessor window. Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY574Figure 39. ADAMS/PostProcessor Window5 From the dashboard, set Source to Objects.6 From the Model list, select .main_olt.7 From the Filter list, select constraint.8 From the Object list, select antenna_joint.9 From the Characteristic list, select Element Torque.10 From the Component list, select Y.11 Select Add Curves. ADAMS/PostProcessor generates the curve.Menu barMenu toolbarTreeviewProperty editorStatus toolbarDashboardViewportsPageGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY575To add labels to the plot:1 In the treeview, navigate to the plot and select it.2 In the Property Editor, in the Title text box, enter the name: Antenna Joint Peak Torque, Controlled. The plot title appears above the plot. Figure 40 illustrates how the curve should look. The curve shows the torque in the antenna joint from the azimuth control loop. You can use the information on the plot to help you determine how to modify the control system of the antenna model. For example, you can reduce the load in the antenna joint by decreasing the velocity gain of the azimuth controller at the expense of slowing the overall response of the controller. This is the type of trade-off between the mechanism design and the control design that you can analyze using ADAMS/Controls.Figure 40. ADAMS Antenna Joint Peak Torque, ControlledGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with EASY5766 Learning ADAMS/Controls with MATRIXxOverviewThis chapter teaches you how to use ADAMS/Controls with MATRIXX. It contains the following sections: About the Tutorial, 78 Step Three - Adding Controls to the ADAMS Block Diagram, 78 Step Four - Simulating the Model, 88Note: Before beginning this tutorial, you should have finished Introducing and Starting the Tutorials on page 11.This tutorial is designed for MATRIXX version 62.2. You can use it with other versions of MATRIXX, but, the interface might be different.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx78About the TutorialThis chapter provides procedures for using ADAMS/Controls with MATRIXX. It teaches you Steps Three and Four of the four-step process of adding controls to an ADAMS model. You will learn how to: Add an ADAMS plant to your block diagram in the MATRIXX simulation. Simulate an ADAMS model with a complex control system. Plot simulation results.Step Three - Adding Controls to the ADAMS Block DiagramYou will add controls to the ADAMS block diagram by: Setting up the MATRIXX Interface, 79 Starting MATRIXX, 80 Defining SuperBlock Attributes, 81 Defining ADAMS Block Parameters, 83 Creating the ADAMS Block, 84 Constructing the Controls System Block Diagram, 86Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx79Setting up the MATRIXX InterfaceIn this section you will set up the ADAMS/Controls MATRIXX interface. You must perform these steps before starting MATRIXX. Be sure to visit the MDI knowledge base at http://support.adams.com/kb/ for the latest information.To run the ADAMS/Controls MATRIXX interface:1 Copy the following two files from the /install_dir/controls/matrixx/ directory to your local directory, where install_dir is the directory where ADAMS/Controls is installed:makefile.{system_type} to ./makefileadams_matrixx.cFor example, if you are running on a Sun Ultra with ADAMS/Controls installed in /usr/local/adams, you enter:cp /usr/local/adams/controls/matrixx/makefile.ultra ./makefilecp /usr/local/adams/controls/matrixx/adams_matrixx.c .2 Do one of the following: Copy the following three files from the /install_dir/controls/matrixx/ directory to your local directory:build_adams.mscupdate_adams.msfBuild_adams In your startup.ms file, add the line:path /install_dir/controls/matrixx/For example, on a Sun system, you include:path /usr/local/adams/controls/matrixx/3 Set the environment variable SYSBLD_ADAMS to /install_dir/controls/.For example, on a Sun system, enter:setenv SYSBLD_ADAMS /usr/local/adams/controls/You can add the above to your .cshrc file.http://support.adams.com/kbGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx80Starting MATRIXXEnsure that youve set up MATRIXX so that you can run cosimulations from the directory containing the antenna example. See Setting up the MATRIXX Interface on page 79.To start using MATRIXX: Start up MATRIXX from the directory that contains the file with the antenna example. The Xmath main window appears.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx81Defining SuperBlock AttributesIn this section, you will create a file called SuperBlock in MATRIXX that contains the controls block diagram for the antenna model.To define the SuperBlock attributes:1 In the command window, enter Build. The command window is the blank area attached to the bottom of the main window.The SystemBuild Editor appears.2 In the SystemBuild Editor, from the File menu, select New, and then select SuperBlock. The SuperBlock Properties dialog box appears.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx82Figure 41. SystemBuild Editor Window3 In the SuperBlock Properties dialog box, in the Name text box, enter antenna_system as the block name.4 In the Outputs text box, enter 3 to define the number of outputs required for the combined antenna model and controls system.5 Set Type to Continuous to define the simulation type. 6 Select OK to exit the SuperBlock Properties dialog box.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx83Defining ADAMS Block ParametersIn this section, you will supply the control system parameters for the ADAMS block.To define the parameters for the ADAMS block:1 In the Xmath command initial window, enter the simulation time as a column vector:t=[0:0.001:0.25];where: The first parameter (0) is the start time The second parameter (0.001) is the step size The third parameter (0.25) is the simulation end type2 Enter the following controller parameters as Xmath variables:PGain = 1040VGain = 950Den = [1e-3,1];where PGain and VGain are the numerators and Den is the denominator of the controller transfer functions.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx84Creating the ADAMS BlockTo create the ADAMS block:1 Ensure that youve either copied the two build_adams* files to your working directory, or have added a proper path line to your startup.ms file (see Setting up the MATRIXX Interface on page 79 for more information).2 In the Xmath command window, enter build_adams.The Build_adams Input dialog box appears.3 Select ADAMS Information File. A file browser appears.4 Select ant_test.inf, and then select OK.5 In the ADAMS block name text box, enter a name for the SuperBlock you are creating, such as antenna, and press Enter.6 Select Interactive for the ADAMS Animation Mode option. Animation mode lets you graphically monitor your simulation results in ADAMS/View. See the section, Choosing an Initialization Method on page 106, for more details about animation modes.7 Select Discrete as the Simulation Mode option.For more details about simulation options, see Choosing a Simulation Method on page 102.8 In the Sample/Output Interval text box, enter 0.001 as the sample interval, and then press Enter.9 Select Build ADAMS Block.The Build_adams Input dialog box should now look like the one in Figure 42.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx85Figure 42. Completed Build_adams Input Dialog Box10 Select OK.The ADAMS block, antenna_system, is now created in the Superblock. The ADAMS block appears in the SystemBuild Editor as shown in Figure 43 on page 86. You can reposition the block by dragging and dropping it to a new location on the screen.Note: The ADAMS block, antenna_system, automatically receives the correct number of inputs and outputs as well as the names specified in the ADAMS antenna model.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx86Figure 43. ADAMS SuperBlockConstructing the Controls System Block DiagramThe completed block diagram is in the file, antenna.xmd, in the examples directory. To save time, you can read in that diagram instead of building it.To construct the controls system block diagram:1 Double-click a blank area of the SystemBuild Editor.The Palette Browser appears. Navigate the control categories using the treeview; click and drag components on to the SystemBuild editor window with the middle mouse button. To set parameters, select the block in the SystemBuild editor window, select Edit, and then select Block Properties.2 Select the appropriate submenu, then click on the block you want to place in your diagram. A Step Block dialog box appears for you to modify parameters on the block. Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx873 Modify the parameters, and then select Done to place the block in the SystemBuild Editor.4 Review the completed controls block diagram shown in Figure 44. Recreate the same diagram for your antenna model using the procedures in the following section.Figure 44. Controls System Block DiagramTo add and connect blocks in the controls system block diagram:1 Start building the diagram by placing a reference slider in the SystemBuild Editor.Note: The reference slider is limited to generating a position between -0.3 and 0.3.2 Place two dynamic NumDen blocks in the diagram, and then define a numerator and denominator for each block as follows: At the Numerator prompt of the blocks, enter %PGain and %VGain, respectively. At the Denominator prompt of each block, enter the variable name, Den.The NumDen blocks should look like the ones in Figure 45.Figure 45. Completed NumDen blocksGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx883 Connect the blocks in your controls system diagram. Make sure that both the input and outputs of the ADAMS block are connected as external outputs in the SystemBuild model.4 From the File menu in the Xmath window, select Save All, and then enter a file name for your completed controls block diagram.Xmath saves the file with the extension .xmd. The file includes both the SystemBuild models and Xmath variables used in the current session.Step Four - Simulating the ModelYou will simulate your mechanical model and control system by: Modifying Simulation Parameters, 88 Executing the Simulation, 90 Pausing and Stepping the Simulation, 94 Plotting from MATRIXX, 95 Plotting from ADAMS/View, 96Modifying Simulation ParametersYou can modify the simulation parameters for your model through the Build_adams dialog box that you invoke using the build_adams script, or you can modify them directly from the command window using the update_adams script. The next two procedures explain how to modify the parameters using the two scripts. Follow either procedure depending on how you want to modify the parameters.Note: You can get additional help on build_adams and update_adams scripts by entering help in the Xmath command window.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx89To modify the simulation parameters using the build_adams script:1 In the Xmath command window, enter build_adams.The Build_adams input dialog box appears. The name, antenna, appears in the ADAMS block name text box.2 To modify the block name, click the text box, enter Telescope in place of antenna, and then press Enter.3 Select the Update ADAMS block option, and select OK.The ADAMS SuperBlock is now named Telescope.Note: You can use the build_adams script to modify all of the simulation settings in the Build_adams Input dialog box. The current settings are stored in the Xmath variables. To view the variables: 1 From the Xmath main window, select Windows, and then select Variables.The Xmath Variables window appears.2 Select Partition, and then select ADAMS. You should modify these variables only through the build_adams or update_adams scripts.To modify the simulation parameters using the update_adams script:1 In the Xmath command window, enter update_adams (Telescope,{NewSampleP=0.005}) to change the sample interval in the SuperBlock, and then press Enter.The sample interval in the ADAMS SuperBlock changes from 0.001s to .005s.2 Using the build_adams script once more, change the sample interval back to its original value.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx90Executing the SimulationThis section shows you how to execute an interactive simulation from MATRIXX.To execute the simulation:1 From the SystemBuild Editor menu, select Tools, and then select Simulate.The SystemBuild Simulation Parameters dialog box appears.Figure 46. SystemBuild Simulation Parameters Dialog Box2 Set the following parameters: Select Outputs, and select the Use Extended Time Vector option. When this option is used with the discrete simulation mode, ADAMS/Controls saves two values for each simulation step. Select Parameters, and enter the variable name ADAMS_out in the Output Variable text box. In Time Vector/Variable text box, enter t to define the simulation time vector. The t references the time vector [0:0.001:0.25] that you defined in Step Four of Starting MATRIXX on page 80. Select the Interactive option.The SystemBuild simulation mode is set to interactive.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx913 Select OK. The Interactive Simulator window appears.Figure 47. Interactive Simulator Window4 Use the control buttons to pause and resume the simulation and to modify the Xmath variables.After you select OK, MATRIXX begins to initialize the simulation data. A new ADAMS/View window opens and the simulation initialization begins. The simulation data appears in the terminal window where you launched MATRIXX, and the ISIM (interactive simulator) appears.5 After initialization, review the information in the terminal window. If it is correct, go to the ISIM and select Resume to execute the simulation.The model simulates in the ADAMS/View window. If the simulation does not begin, press Rerun.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx92Running a Simulation from the Xmath Command WindowYou can also execute the simulation from the Xmath command window, where you can create scripts that run a number of simulations with varied settings.To run the simulation from the Xmath command window:1 In the Xmath command window, enter the following command:ADAMS_out=sim(antenna_system,t,{extend, interact}); 2 Press Enter to start the simulation. A new ADAMS/View window opens and the simulation begins.Note: The ADAMS model is initialized to the simulation time defined in the SystemBuild Editor.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx93Running the Simulation InteractivelyYou can interrupt the simulation to modify the controller variables or to change the visual aspect of the model. To run the simulation interactively:1 Arrange the windows so that you have a good view of the model. Close the SystemBuild Editor to help unclutter the screen.2 When a new ADAMS/View window opens and the simulation begins, start and pause the simulation by selecting Resume and Pause respectively. While in pause mode, experiment with making modifications to the control system: Modify the reference signal for azimuthal position by moving the slider in the Interactive ISIM window. Modify the control variables, PGain and VGain, by selecting RVE, selecting each variable, and then selecting Open. The Matrix Editor appears. Modify the selected variable and close the window.ADAMS/View accepts the control inputs from MATRIXX and the model moves in response to them. ADAMS/View then provides the azimuthal position and rotor velocity information to MATRIXX. This simulation process creates a closed loop in which the control inputs from MATRIXX affect the ADAMS/View simulation, and the ADAMS/View outputs affect the control input levels. For an illustration of the closed loop simulation process, see Figure 5 on page 19.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx94Pausing and Stepping the SimulationThe interactive capabilities of ADAMS/Controls let you pause the simulation and perform time and block steps in MATRIXX while monitoring the graphic results in ADAMS/View. You can also plot simulation results during pause mode.To pause the simulation:1 Select Pause in the ISIM Control Panel. MATRIXX suspends the simulation. Pause changes to Resume after you select it so you can toggle between Simulation and Pause mode.2 Go back to ADAMS/View. While the simulation is paused, you can change the orientation of the model using the View Orientation tools in the Main Toolbox. These tools help you to observe the model from different vantage points.Figure 48. View Orientation Tools3 Once you have finished reorienting the model, you can continue the simulation by selecting Resume.ADAMS/View closes automatically after the simulation finishes.4 Advance the SystemBuild model one sample interval at a time by selecting TimeStep. Notice how the ADAMS model is updated during each time step.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx955 Select Block Step to execute one block at a time in the SystemBuild model. You can monitor how the signals are updated by switching the view mode of the blocks. To switch the view mode, point on a block and type v.6 When the simulation is completed, close the ISIM window by selecting the File menu, then selecting Exit.Plotting from MATRIXXYou can plot any of the data generated in MATRIXX. In this tutorial, you will plot the ADAMS_out data that is saved in the Xmath environment. To plot from MATRIXX:1 In the Xmath command window, enter:plot (ADAMS_out(1,:), {title=ADAMS/Controls Torque Input from MATRIXx to ADAMS, xlab=time in seconds, ylab=Control Torque input, N-m})The plot window opens and shows the time history of input from MATRIXX to ADAMS/View and includes the specified plot labels. Figure 49 on page 96 shows you how the plot should look. Notice that the control torque reaches a peak, and then settles down as the antenna accelerates. As the antenna gets close to its final position, the torque reverses direction to slow down the antenna. The antenna moves past its desired position, and then settles down to the point of zero error. At this point, the torque value is also at zero.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx962 To plot the other external outputs, enter: ADAMS_out(2,:) for rotor_velocity and ADAMS_out(3,:) for azimuth_position.Figure 49. Controls Torque Input from MATRIXX to ADAMSPlotting from ADAMS/View1 Display ADAMS/View in a new system window and read in the command file, ant_test.cmd.2 From the File menu, select Import.The File Selection dialog box appears.3 Select the following: For File Type, select ADAMS Results File. For Files to Read, select antenna.res. For Model, select main_olt. Be sure to include the model name when you read in results files. ADAMS/View needs to associate the results data with a specific model.Note: You can plot any data from the simulation and rerun the animation from ADAMS/View.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx974 From the Review menu, select Postprocessing.ADAMS/View launches ADAMS/PostProcessor, a post-processing tool that lets you view the results of the simulations you performed. Take a minute to familiarize yourself with ADAMS/PostProcessor.Figure 50 on page 97 shows the ADAMS/PostProcessor window.Figure 50. ADAMS/PostProcessor Window5 From the dashboard, set Source to Objects.Menu barMenu toolbarTreeviewProperty editorStatus toolbarDashboardViewportsPageGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx986 From the Model list, select .main_olt.7 From the Filter list, select constraint.8 From the Object list, select antenna_joint.9 From the Characteristic list, select Element Torque.10 From the Component list, select Y.11 Select Add Curves. ADAMS/PostProcessor generates the curve.To add labels to your plot:1 In the treeview, navigate to the plot and select it.2 In the Property Editor, in the Title text box, enter the name: Antenna Joint Peak Torque, Controlled. The plot title appears above the plot. Figure 51 illustrates how the curve should look. The curve shows the stress in the antenna joint from the azimuth control loop. You can use the information on the plot to help you determine how to modify the control system of the antenna model. For example, you can reduce the load in the antenna joint by decreasing the velocity gain of the azimuth controller at the expense of slowing the overall response of the controller. This is the type of trade-off between the mechanism design and the control design that you can analyze using ADAMS/Controls.Getting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx99Figure 51. ADAMS Antenna Joint Peak Torque, ControlledGetting Started Using ADAMS/ControlsLearning ADAMS/Controls with MATRIXx1007 Setting Simulation ParametersOverviewADAMS/Controls provides a variety of options for simulating and animating your integrated model and controller. This chapter introduces you to these options and the advantages they offer. This chapter contains the following sections: Choosing a Simulation Method, 102 Choosing an Animation Option, 105 Choosing an Initialization Method, 106Getting Started Using ADAMS/ControlsSetting Simulation Parameters102Choosing a Simulation MethodADAMS/Controls offers you three methods with which you can simulate your integrated model and controller: Discrete mode: Specifies that ADAMS solve the mechanical system equations and the control application solve the control system equations. Continuous mode: Specifies that the control application solve both the mechanical and control system equations. C-code import into ADAMS: Specifies that ADAMS solve the mechanical system and control system equations (only available with MATLAB).These methods allow you to use different methods to integrate your ADAMS and controls models (EASY5, MATLAB, or MATRIXX). See Table 3 on page 103 for an overview of suitable controller/simulation method options.Getting Started Using ADAMS/ControlsSetting Simulation Parameters103Table 3. Suitable Controller/Simulation Method OptionsDiscrete ModeFor most analyses, the discrete mode is generally the more efficient simulation method. It is faster and can handle complex models better than continuous mode. You should use continuous mode when equations solved in the control system would cause a large coupling effect on the ADAMS data. For example, you might prefer to use the continuous mode if your analysis requires a very small time step.To preserve the proper dynamics for a mechanical system, discrete mode should sample the mechanical system at least five times greater than the highest frequency of interest. If the time step is too small to sample at five times the highest frequency, then you should use continuous mode.Simulation MethodController type:Discrete mode:Continuous mode:C-code import:Continuous Yes Yes YesContinuous sampled controller Yes Yes YesController with discrete and continuous statesYes Yes YesDiscrete controller with synchronous sampling ratesYes Yes YesDiscrete controller with asynchronous multi-sampling ratesNo Yes YesLogic-based controller No Yes NoGetting Started Using ADAMS/ControlsSetting Simulation Parameters104Note: You can find the highest frequency of your mechanical system by performing a linear analysis with the ADAMS add-on module, ADAMS/Linear. For information about ADAMS/Linear, see the guide, Using ADAMS/Solver.Continuous modeContinuous mode lets MATLAB integrate a system of equations that includes the mechanical and controls subsystem equation. ADAMS acts as a function evaluator.ADAMS evaluates differential equations describing the mechanical system, and the values are sent to the controls package to populate the equations integrated solely by the controls package. Viewed from the control side, ADAMS is no different from a nonlinear block. At each integration step, ADAMS provides the necessary information, such as inputs and time derivatives of states, to the controls packages.Because the function-evaluation mode creates a system of equations presenting both the control scheme and the mechanical system at once, any integrator dealing with this sees an effectively continuous system. While the combined system representation is accurate, the control software integrator may not be robust enough to effectively handle high-frequency and highly nonlinear effects in the mechanical subsystem.For more information, see Jacobian Matrix and System Refactorization, on page 108.C-Code import into ADAMS (MATLAB only)In this mode, you can import into ADAMS a C-code representation of the control system build in MATLAB. To do this, you have to first export a C language representation of the control system using Real-Time Workshop. ADAMS/Controls then allows you to create, in an automated manner, a general state equation (GSE) element in your ADAMS model and an object library from this C code. After this is done, you can simulate your combined model in ADAMS.Getting Started Using ADAMS/ControlsSetting Simulation Parameters105Choosing an Animation OptionADAMS/Controls lets you choose one of two animation modes: interactive or batch. Both methods allow you to save results to ADAMS files for review at a later date.Table 4. Animation OptionsMethod: Its purpose:Interactive mode Specifies the simulation to run in ADAMS/View. Provides a dynamic, graphic display of the simulation results. Allows you to pause during a simulation to review any animation or plotting results. Allows you to verify the initial design of your control law for proper signal phase and magnitude.Batch modeSpecifies that the simulation run in ADAMS/Solver. This is the preferred method if a graphic display of the analysis results is unnecessary, since it provides a much faster solve time.Getting Started Using ADAMS/ControlsSetting Simulation Parameters106Choosing an Initialization MethodADAMS/Controls lets you choose one of two initialization modes: automatic or manual. Both methods allow you to issue ADAMS/View or ADAMS/Solver commands before simulating your combined model and controller. Initialization commands are ADAMS commands which are executed before the controls package starts the co-simulation. If you run an animation in interactive mode, you must use ADAMS/View commands to initialize your model. If youre in batch mode, use ADAMS/Solver commands.Table 5. Initialization OptionsMethod: Its purpose:Automatic modeAllows you to issue any command in the Initialization command field of the ADAMS plant mask before running a simulation. You can specify a command in two ways. For example, if you want to change the color of the antenna model, you can issue one of the following commands: At the MATLAB prompt, enter:ADAMS_Init=geometry attributes geometry_name=.main_olt.antenna.REV15 color=RED Within the ADAMS mask, the Initialization command field reads: ADAMS_Init. Alternatively, inside the Initialization command field, you can enter the complete command string enclosed in single quotes and square brackets as follows:[geometry attributes geometry_name=.main_olt.antenna.REV15 color=RED]Manual modeAllows you to issue ADAMS commands directly from MATLAB. After you enter a command at the MATLAB prompt, MATLAB sends it to ADAMS for immediate execution. After ADAMS executes the command, MATLAB prompts you for an additional command or direction to continue.8 Advanced TopicsOverviewThis chapter contains important information that will be helpful to you when using ADAMS/Controls. It includes the following sections: Design Variables versus State Variables, 108 Jacobian Matrix and System Refactorization, 108 User Libraries, 110 Plant Communication Error, 111 Integration with Vertical Products, 111Getting Started Using ADAMS/ControlsAdvanced Topics108Design Variables versus State VariablesIn ADAMS/Controls you can use two types of variables: design variables and state variables.A design variable is only a preprocessing entity. It is a placeholder for element parameter values. When writing an .adm file, these entities are evaluated and entered in the Solver dataset as numerical values. The design variable value can be any expression created in the ADAMS Expression Builder. Design variables are also known as ADAMS/View variables and simply as variable (in the ADAMS/View Database Navigator).A state variable is a variable whose value is calculated at every simulation step. The value can be any function created in the ADAMS Function Builder. State variables are also known as ADAMS/Solver variables, ADAMS/Variable (in ADAMS/View database navigator), and VARIABLE (statement in ADAMS/Solver dataset).For more information, see the guide, Using the ADAMS/View Function Builder.Jacobian Matrix and System RefactorizationA continuous mode simulation in ADAMS/Controls may cause erroneous results due to a changing Jacobian. At the start of every simulation, ADAMS creates a Jacobian matrix and factorizes it. The elements of this special matrix represent the partial differentials of each equation of motion with respect to each state variable in your system. Some elements could be very large, others could be very small, and many are typically zero. To solve the equations of motion, ADAMS must invert the Jacobian matrix. It inverts the matrix using LU decomposition, Gaussian elimination, and backward substitution methods, among others. To make these solution techniques more efficient, ADAMS performs symbolic factorization in an attempt to position the largest values on the diagonals to act as better pivots during the matrix inversion process. (The factorization process rearranges rows and columns of the matrix and is said to be symbolic because it uses pointers to particular matrix elements, rather than actually moving their computer addresses.)Getting Started Using ADAMS/ControlsAdvanced Topics109Unfortunately, it is quite common that as parts move and forces change during the course of a mechanical systems natural movement, some of the matrix pivots (that is, elements on the diagonal) radically change in magnitude. To avoid zero or near-zero pivots in the resulting Jacobian matrix, at certain points in time, ADAMS will attempt to re-factorize the matrix to again place the largest values on the diagonal. A common example of a situation that requires refactorization is when intermittent contact is modeled using a force element with the IMPACT function in ADAMS and a derivative of this force equation is used as a pivot. When the bodies are in contact, the force is typically very large and thus the pivot works well. But when the bodies are not in contact, the force goes to zero and the zero pivot will cause a singularity during the matrix-inversion process, so refactorization is required.Discontinuous function expressions for user-defined equations, such as with forces or motions, can also cause matrix singularities. This is why we recommend the use of the continuous STEP, STEP5, or TANH functions in ADAMS, instead of the possibly discontinuous IF function. So, you could receive a message that ADAMS is symbolically refactorizing the Jacobian matrix for various reasons: A new analysis type has been initiated (for example, assembly or initial conditions, statics, dynamics, and so on). ADAMS must always perform an initial factorization of the Jacobian matrix at the start of a new simulation. Pivot has become sufficiently close to zero so as to make the Jacobian matrix nearly singular and non-invertible. This is usually due to abrupt changes occurring in your system.A refactorization message is a sign that something has changed in your system at a particular point in time. Although it is not necessarily a sign of problems in the definition of your system or in the solution, it could be, and so is worth investigating. Fortunately, ADAMS automatically refactorizes when necessary. However, you can also use your animation and plotting tools or your debugging tools to check what happens immediately before and after these times to search for causes.Getting Started Using ADAMS/ControlsAdvanced Topics110User LibrariesUnlike previous versions of ADAMS, with ADAMS 12.0, you no longer need to create an entire executable for ADAMS when you want to link in a user subroutine. Instead, you create a library and simply select it when you need the subroutine(s) within the library. For more information on this change, see http://support.adams.com/kb/faq.asp?ID=kb9317.html.Therefore, instead of creating a controls executable (for example, adams12 controls cr-uscontrols), you simply create a standard user executable (for example, adams12 cr-user).To create a user library:1 Perform one of the following: On UNIX: enter mdi -c cr-user On Windows: From the Start menu, point to Programs, point to ADAMS 12.0, point to ASolver, and then select Create Custom Solver. (Or, type mdi cr-user in the DOS prompt.)2 Specify if you want to link in debug mode, and provide the list of your user subroutines.3 Provide a name for the library, such as my_sub.dll.4 Within ADAMS/View, when you use the Controls Plant Export dialog box to save out your input and output data, include the name of the user library you just created in the appropriate text box.The user executable name is now automatically written out to the MATLAB .m file or the MATRIXx/EASY5 information file and automatically picked up by the controls program as the proper executable. Alternatively, you can enter this explicitly in the file. For example, in MATLAB, enter ADAMS_exec = $my_path/my_sub.dll; (where $my_path is the path to your library).Note that there is no longer a difference between a custom ADAMS/Solver library and a custom ADAMS/View library if the library is used by ADAMS/Solver. In other words, you create a library for ADAMS/Solver, which can be used by either the ADAMS/View http://support.adams.com/kb/faq.asp?ID=kb9317.htmlhttp://support.adams.com/kb/faq.asp?ID=kb9317.htmlGetting Started Using ADAMS/ControlsAdvanced Topics111interface or ADAMS/Solver when simulating. An ADAMS/View library can only be in ADAMS/View as in design-time; it makes no sense to use this with ADAMS/Solver, and obviously cannot be used in ADAMS/Solver.For more information, see the guides, Running and Configuring ADAMS on UNIX and Running ADAMS on Windows.Plant Communication ErrorThe ADAMS plant communication error is a generic message that could unfortunately mean anything from you dont have a license available, to youve referenced a variable incorrectly in MATLAB. If youre trying to make your own model work and havent tried one of the example problems found in your ADAMS installation at /ADAMS_install/controls/examples/, then run an example. Its important to ensure that you can run an example, as your own model can potentially have incorrect feedback values, crossed lines, and so on. You should verify that you can run an example model, which has been setup to work properly, before you start with your own model.If you generate an ADAMS plant communication error at some point in an ADAMS/Controls cosimulation (due to too rapid feedback, improper variable specification in MATLAB, and so on), fix the source of your error, but now get the plant communication error as soon as you select Simulate, you may need to clean up your workspace. To clear things in the MATLAB environment, use the clear mex command on the command line in MATLAB. This removes extraneous items from past failures and will allow you to perform subsequent simulations. Integration with Vertical ProductsFor the latest information on integrating ADAMS/Controls with ADAMS/Car, ADAMS/Chassis, and ADAMS/Rail, refer to the MDI Knowledge Base at http://support.adams.com/kb.http://support.adams.com/kbGetting Started Using ADAMS/ControlsAdvanced Topics112Getting Started Using ADAMS/ControlsIndex113 - B - V - Z - D - F - HI - J - L - T - R - P - NAUWCEGKSQOMIndexA - BADAMSblock, creating in EASY5 59block, creating in MATRIXx 84block, initializing interface in EASY5 60ADAMS/Controlsabout 3basics 5benefits of 6design process with 6four-step process, about 9how to learn 10initialization methods in 106starting from UNIX or Windows 13using 8ADAMS/Solver variable 108ADAMS/View variable 108Animation optionsbatch 105interactive 105Antenna model, components of 16Automatic initialization mode 106Batch animation mode 105Block diagramADAMS, creating in EASY5 59ADAMS, creating in MATRIXx 84controls system, constructing in EASY5 64controls system, constructing in MATLAB 35controls system, constructing in MATRIXx 86creating ADAMS in MATLAB 33sub-block of ADAMS in MATLAB 34Getting Started Using ADAMS/ControlsIndex114 - B - V - Z - D - F - HI - J - L - T - R - P - NAUWCEGKSQOMC - DComponentdata table in EASY5 60information page in EASY5 63Continuous simulation mode 102Control system import 45Controlsadding to ADAMS block using EASY5 58adding to ADAMS block using MATLAB 31adding to ADAMS block using MATRIXx 78how to improve design process of 6Createblock diagram in MATLAB 33CreatingSimulink template 47user libraries 110Deactivating azimuth motion in model 17Design process with ADAMS/Controls 6Design variables 108Discontinuous function expressions 109Discrete control systems 47Discrete simulation mode 102Getting Started Using ADAMS/ControlsIndex115 - B - V - Z - D - F - HI - J - L - T - R - P - NAUWCEGKSQOME - FEASY5adding controls to ADAMS block 58component data table in 60component information page in 63constructing controls system diagram in 64creating ADAMS block in 59executing a simulation in 66initializing ADAMS interface block in 60pausing and stepping simulation in 70plotting from 71plotting from ADAMS/View 73simulating interactively in 69starting 58Error, plant communication 111Executingsimulation in EASY5 66simulation in MATLAB 39simulation in MATRIXx 88Exporting plant files 24File types 37Four-step process in ADAMS/Controls 9Functionsoutput 23VARVAL 22G - HHow youll learn ADAMS/Controls 12Hybrid control systems 47Getting Started Using ADAMS/ControlsIndex116 - B - V - Z - D - F - HI - J - L - T - R - P - NAUWCEGKSQOMI - JIMPACT function 109Importing the model 14Initialization methodautomatic 106manual 106Initializing ADAMS block in EASY5 60Inputfunctions, verifying 22identifying path for 19verifying variables for 20Interactive animation mode 105Jacobian matrix 108K - LLearningADAMS/Controls 10ADAMS/Controls with Control System Import 45ADAMS/Controls with EASY5 45, 57ADAMS/Controls with MATLAB 29ADAMS/Controls with MATRIXx 77Libraries, user 110Loading ADAMS/Controls 15Getting Started Using ADAMS/ControlsIndex117 - B - V - Z - D - F - HI - J - L - T - R - P - NAUWCEGKSQOMM - NManual initialization mode 106MATLAB 38adding controls to ADAMS block 31constructing controls system diagram in 35creating block diagram in 33executing simulation in 39pausing simulation in 39plotting from 40plotting from ADAMS/View 42setting parameters in plant mask 36setting simulation parameters in 38simulating interactively in 37Simulink palette in 33starting 31MATRIXxadding controls to ADAMS block 78adding NumDen blocks to controls diagram 87constructing controls system diagram in 86creating ADAMS block 84defining attributes in SuperBlock 81executing a simulation in 88modifying simulation parameters in 88pausing and stepping simulation in 94plotting from 95plotting from ADAMS/View 96simulating interactively in 93starting 80Model, importing 14Motion, deactivating in ADAMS/View 17NumDen blocks, using in MATRIXx 87Getting Started Using ADAMS/ControlsIndex118 - B - V - Z - D - F - HI - J - L - T - R - P - NAUWCEGKSQOMO - POutputfunctions, verifying 23identifying path for 19Parameters, setting in MATLAB plant mask 36Pausingsimulation in EASY5 70simulation in MATLAB 39simulation in MATRIXx 94Plant communication error 111Plant files, exporting 24Plant mask, setting parameters in MATLAB 36PlottingEASY5 results in ADAMS/View 73from CSI 55from EASY5 71from MATLAB 40from MATRIXx 95MATLAB results in ADAMS/View 42MATRIXx results in ADAMS/View 96Plug-in, loading 15Q - RReal-time workshop options 49Refactorization, system 108Running a trial simulation in ADAMS/View 16Getting Started Using ADAMS/ControlsIndex119 - B - V - Z - D - F - HI - J - L - T - R - P - NAUWCEGKSQOMS - TSettingplant mask parameters in MATLAB 36simulation parameters in ADAMS/Controls 101, 107simulation parameters in EASY5 68simulation parameters in MATLAB 38simulation parameters in MATRIXx 88Simulationanimation options for 105choosing a method for 102continuous, choosing 102discrete 102executing in EASY5 66executing in MATLAB 39executing in MATRIXx 88in step 4 using EASY5 66in step 4 using MATLAB 38in step four using MATRIXx 88initialization options for 106modifying parameters in MATRIXx 88parameters, setting in ADAMS/Controls 101, 107pausing and stepping in EASY5 70pausing and stepping in MATRIXx 94pausing in MATLAB 39running a trial without controls 16running interactively in EASY5 69running interactively in MATRIXx 93Simulink palette in MATLAB 33Simulink, creating template 47Solver options 51StartingEASY5 58MATLAB 31MATRIXx 80Getting Started Using ADAMS/ControlsIndex120 - B - V - Z - D - F - HI - J - L - T - R - P - NAUWCEGKSQOMState variables 108SuperBlockdefining attributes in MATRIXx 81file in MATRIXx 81System refactorization 108Tutorialabout 12for ADAMS/Controls with CSI 46for ADAMS/Controls with EASY5 45, 57for ADAMS/Controls with MATLAB 29for ADAMS/Controls with MATRIXx 77introducing and starting the 12U - VUser libraries 110Variablesdesign 108output function for 23state 108verifying input for 20VARVAL function 22Verifyinginput variables 20output functions 23W - ZWays to use ADAMS/Controls 8Help on HelpGetting Started Using ADAMS/ControlsAbout this GuideLearning the BasicsIntroducing and Starting the TutorialsLearning ADAMS/Controls with MATLABLearning ADAMS/Controls with Control System ImportLearning ADAMS/Controls with EASY5Learning ADAMS/Controls with MATRIXxSetting Simulation ParametersAdvanced TopicsIndex