WORKSHOP 3 GSE IMPORT.

Slides:



Advertisements
Similar presentations
1 Application Software Course Simulink By: Mahdi Akbari 2010.
Advertisements

1 1 Mechanical Design and Production Dept, Faculty of Engineering, Zagazig University, Egypt. Mechanical Design and Production Dept, Faculty of Engineering,
WS6-1 ADM730, Workshop 6, September 2005 Copyright  2005 MSC.Software Corporation WORKSHOP 6 USING THE ASCII CONDUIT.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
SIMULINK Dr. Samir Al-Amer. SIMULINK SIMULINK is a power simulation program that comes with MATLAB Used to simulate wide range of dynamical systems To.
Simulink ® From Simulink® 7 Getting Started Guide.
1 Chapter Overview Creating User and Computer Objects Maintaining User Accounts Creating User Profiles.
Simulink ® Interface Course 13 Active-HDL Interfaces.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Simulink SubSystems and Masking April 22, Copyright , Andy Packard. This work is licensed under the.
Tot 15 LTPDA Graphic User Interface summary and status N. Tateo 26/06/2007.
Active-HDL Interfaces Debugging C Code Course 10.
WS6-1 ADM703, Workshop 6, August 2005 Copyright  2005 MSC.Software Corporation WORKSHOP 6 OVER-RUNNING PULLEY.
ECEN/MAE 3723 – Systems I MATLAB Lecture 2. Lecture Overview What is Simulink? How to use Simulink  Getting Start with Simulink  Building a model Example.
ADAMS Assignment 1 ME451:Kinematics and Dynamics of Machine Systems (Fall 2013) Assigned: September 18, 2013 Due: September 25, 2013.
WS1-1 ADM740, Workshop 1, June 2007 Copyright  2007 MSC.Software Corporation WORKSHOP 1 OPEN AND RUN AN ASSEMBLY.
WS13-1 ADM740, Workshop 13, June 2007 Copyright  2007 MSC.Software Corporation WORKSHOP 13 EXPLORING AND COMPLETING TEMPLATES.
SIMULINK-Tutorial 1 Class ECES-304 Presented by : Shubham Bhat.
Modeling of Power Converters using Matlab and Simulink
INTRODUCTION TO SIMULINK by Yasmin Hanum Md Thayoob & Aidil Azwin Zainul Abidin.
S11-1 ADM , Section 11, August 2005 Copyright  2005 MSC.Software Corporation SECTION 11 MACROS: OVERVIEW.
Simulink  ? 1 Simulink  ( Simu lation and Link ) is an extension of Matlab Offers modeling, simulation, and analysis of dynamical systems; i.e., a system.
WS5-1 ADM , Workshop 5, August 2005 Copyright  2005 MSC.Software Corporation WORKSHOP 5 PARAMETERIZING A NEW MODEL.
WS1-1 ADM730, Workshop 1, September 2005 Copyright  2005 MSC.Software Corporation WORKSHOP 1 INTRODUCTION Open Retracted - Bad Retracted - Good.
ADAMS Assignment 1 ME451:Kinematics and Dynamics of Machine Systems (Spring 09)
WS2-1 ADM703, Workshop 2, August 2005 Copyright  2005 MSC.Software Corporation WORKSHOP 2 SPRING-DAMPER SYSTEM.
WS16-1 ADM740, Workshop 16, June 2007 Copyright  2007 MSC.Software Corporation WORKSHOP 16 Using Adams/Linear with Adams/Car.
Getting started with Simulink
Getting started with Simulink An introductory tutorial.
SECTION 3 FUNCTION EVALUATION, CO-SIMULATION PERFORMANCE.
ADM711, Workshop 5, January 2013 Copyright  2013 MSC.Software Corporation WORKSHOP 5 CO-SIMULATION MODIFIERS FOR EASY 5.
WORKSHOP 3 Belt Modeling – Lawn Mower
Workshop 12 atv – lower control arm
WORKSHOP 1 CO-SIMULATION.
Adams/CHASSIS INTERFACE
WORKSHOP 18 HATCHBACK II.
WORKSHOP 12 SUSPENSION SYSTEM II
VAB™ for INFINITY Tutorial
SECTION 4 GSE IMPORT METHOD.
SECTION 4 WASHING MACHINE.
WORKSHOP 5 IMPORTING CAD GEOMETRY
SECTION 1 ADAMS/Solver subroutines overview
WORKSHOP 12 BOUNCING BALL
WORKSHOP 1 CUSTOM TIRE SUBROUTINE
WORKSHOP 14 EXPLORING AND COMPLETING TEMPLATES
WORKSHOP 19 HATCHBACK III
WORKSHOP 2 VALVETRAIN MECHANISM
WORKSHOP 2 VALVETRAIN MECHANISM
WORKSHOP 7 PID TUNING.
WORKSHOP 6 USING THE ASCII CONDUIT
WORKSHOP 9 BRAKE SYSTEM II
INTRODUCING Adams/CHASSIS
SECTION 13 REQUESTS.
WORKSHOP 1 STAMPING MECHANISM
ECEN/MAE 3723 – Systems I MATLAB Lecture 2.
WORKSHOP 13 SUSPENSION-STEERING SYSTEM
ADAMS/VIEW INTERFACE OVERVIEW
ADAMS/VIEW INTERFACE OVERVIEW
WORKSHOP 7 OVER-RUNNING PULLEY.
SECTION 3 MACROS: OVERVIEW.
WORKSHOP 11 SUSPENSION SYSTEM I
WORKSHOP 12 GETTING INFORMATION ABOUT COMMUNICATORS
WORKSHOP 1 INTRODUCTION.
Introduction to Orchestra
LTPDA Graphic User Interface summary and status
Getting Started With Simulink
Electronics II Physics 3620 / 6620
Microsoft PowerPoint 2007 – Unit 2
MECH 3550 : Simulation & Visualization
Presentation transcript:

WORKSHOP 3 GSE IMPORT

Overview MATLAB’s Real Time Workshop package will be used to create a compiled library (.dll) representation of the Simulink model. This .dll file will be integrated with the Adams model using the Control System Import functionality of Adams/Controls. This will create a General State Equation (GSE) in Adams that interacts with the compiled library (.dll) code.

MATLAB Mex Setup The MATLAB external interface compiler (MEX) must be set up properly on the system. To initiate setup: Issue the command: >> mex –setup Let MEX locate the installed compilers on the system. Select the Microsoft Visual C++ compiler choice; other compilers will not work properly with the Adams components.

Adams Model Setup Create new plant export files by: Start Adams/View in the working directory, load the model named ‘spring_start.cmd’. Export the plant into the working directory, using a plant export prefix of ‘rtw_model’ to create a file named rtw_model.m in the working directory. Select Target Software to Matlab This file will be used to set the plant input/output information for the Simulink model.

Adams Files For RTW Creation Adams files needed for the RTW creation process must be copied to the working directory before any compilation in MATLAB. The necessary files are copied to the working directory by first reading in the plant information and then running an Adams/Controls command like so: Read in the previously-created rtw_model.m file. This sets up the proper Adams paths in the MATLAB session. Run the following script to copy necessary files into the MATLAB working directory: >> setup_rtw_for_adams Check the working directory: several .tlc and .tmf files, needed for the RTW compilation process, should now exist.

Modify Simulink Model The Simulink model from the previous workshop will be used, but it must be cleaned up for use with RTW. To do this: Load the matlab_spring.mdl Simulink model from the previous workshop. All interactive blocks in the Simulink model must be removed for use with RTW, so go through and eliminate all ‘scope’ blocks along with any associated elements (i.e. summer blocks, connection lines, etc.).

Modify Simulink Model (Cont.) The Simulink model should then appear as:

Modify Simulink Model (Cont.) The ‘adams_sub’ block is not used for RTW creation, instead proper input and output elements (inport/outport) must be created to replace the adams_sub block. To create the needed inports/outports and fix up the model: Issue the following command on the MATLAB command line: >> setio Delete the adams_sub block. Hook up the inports and outports to the existing model. Use Terminator blocks to ‘ground’ the two unused outputs from Adams.

Modify Simulink Model (Cont.) The resulting Simulink model should appear as:

Modify Simulink Model (Cont.) Finally, create variables in MATLAB for reference in the Simulink model. To do this: Create variables on the command line of MATLAB like: K_stiffness = -8.0 C_damping = -0.033 Modify (double-click) the two Gain blocks in the model and substitute these variables for the current values. These variables will be accessed later to tune the model. Save the Simulink model before proceeding further.

RTW Configuration and Build Access the RTW configuration settings using the menu picks in Simulink: Tools -> Real-Time Workshop -> Options. Make the following changes in the appropriate tree view categories: Real-Time Workshop: RTW system target file = rsim.tlc Make command = make_rtw Template makefile = rsim_default_tmf Solver: Stop time = 0.25 Type = Fixed-step Solver = ode1 (Euler)

RTW Configuration and Build (Cont.) Optimization: Inline parameters = true (checked) Select Configure button, then add variables k_stiffness and c_damping to the list of Global (Tunable) Parameters. Ensure that the Storage Class is set to SimulinkGlobal (Auto). Apply all of the above changes, then save the Simulink model to disk. Build the RTW component using the menu picks in Simulink: Tools -> Real-Time Workshop -> Build Model

RTW Configuration and Build (Cont.) The build process should yield the message: ### Successful completion of Real-Time Workshop build procedure for model: rtw_controller Two sub-directories and several output files should be created under the working directory. The file matlab_spring.dll (prefix is the same as the Simulink model) should exist in the working directory. If this file is not created, ensure that: The working directory contains several .tlc and .tmf files. The MEX -setup process was followed and the Microsoft Visual C++ compiler was selected. The .m file from the Adams was properly loaded

Control System Import (Adams/View) Having created the .dll representation of the controller, the system can now be imported into Adams/View as a General State Equation (GSE) element. To import the RTW .dll file as a GSE: Start Adams/View in the working directory that contains the .dll file. Load the .cmd file that was created in the Plant Export process (rtw_model.cmd). Ensure that the Adams/Controls plugin is loaded. Import the Control System via: Controls -> Control System -> Import

Control System Import (Adams/View) (cont.) Use the following settings for the Control System Import dialog box: GSE Name = rtw_force External System Library = rtw_controller.dll Use the ‘Import I/O Signals …’ button and select the existing Controls Plant in the model to fill out the Input/Output lists. Click OK to create the GSE and associated elements in the model. Verify creation using the Database Navigator: Use the menu picks: Tools -> Database Navigator Verify that a General State Equation element named ‘rtw_force’ has been created in the model. Other elements such as ARRAYs, STRINGs and Variables have also been created as supporting elements for the GSE.

Simulate, Compare Results Run a dynamic simulation in Adams/view for 2 seconds, 200 steps. The two masses in the model should oscillate in a similar fashion with respect to one another. Compare the displacement of the two masses by switching to Adams/Postprocessor (F8 key) and plotting the part center-of-mass (cm) displacement in the y-direction. The displacements should match up closely, looking similar to the following:

Test RTW Parametrics Ensure that the parametrics built into the RTW component are functioning as expected by varying the spring stiffness. To do this, modify the Design Variable in the Adams/View session via: Build -> Design Variable -> Modify Select the K_stiffness variable that is a child of the rtw_force element in the model. Alter the spring stiffness for the RTW force from a standard value of “-8” to “-18” and re-run the simulation. Plot the new results in Adams/PostProcessor. Does the variable appear to be functioning as expected? _________________________(yes/no) (i)

Optional Tasks Inspect the .adm file that Adams/View writes out for this model (File > Export > Adams/Solver Dataset) in a text editor. Attempt to locate the STRING element that specifies the name of the .dll file prefix that is used for the RTW code. Do you think that the STRING value must match up exactly with the .dll file prefix? __________________(yes/no) (ii)

Answers Yes, the spring stiffness variable should alter the behavior of the system. Yes, the string value must be the same as the name of the .dll file.