Setting up and Modifying RADA Simulations: Difference between revisions

From Distributed Autonomous and Networked Control Lab
Jump to navigation Jump to search
Pfuhing (talk | contribs)
No edit summary
Pfuhing (talk | contribs)
No edit summary
Line 1: Line 1:
== Simulink Setup ==
== Simulink Setup ==
In order to use Simulink effectively you need to setup a few things. Iowa State will allow you download MATLAB and use a site license for free as a student. For more information about installing MATLAB using this site license look [http://it.engineering.iastate.edu/how-to/installing-matlab/ here.]  
In order to use Simulink effectively you need to setup a few things. Iowa State will allow you download MATLAB and use a site license for free as a student. For more information about installing MATLAB using this site license look [http://it.engineering.iastate.edu/how-to/installing-matlab/ here.] Simulink comes with MATLAB. You should get MATLAB 2014b or latter to ensure the Simulink files from Paul Uhing's research repository will work with your installation of MATLAB.
 
Once the install is complete and MATLAB is registered you can open MATLAB up. Then change the folder MATLAB will work out of to a directory you will want to work form. It would be best to copy a few files from Paul Uhing's repository to help you get started. Inside of the RADA Research Repository go to ''MATLAB/RADA'' and copy ''modelParams_smallWheels_RADA.m'', ''Hbrigeest.mat'',  ''Kvw_calc.mat'', ''Hmu_r_erisLargeWheels.mat'', ''LQI_recalc.m'', and ''RADA_ctrlSep.m'' from this directory to you new diectroy as these files will allow you to load the model parameters and controller designs used in Paul Uhing's thesis or find the most recent version of these files an copy them instead. It would also be good to copy and of the ''RADA_psiCtrl_v2.slx'' or ''RADA_psiCtrl_LQGsep.slx'' files here to sever as the base RADA simulation in your new directory. Finally, open te ''DataSets'' directory below the ''RADA'' directory can copy one of the ''RADA_LQG_compPID.mat'' files or ''RADA_LQG_sep.mat'' files because it will allow you to have input vector for the copied ''.slx'' Simulink file.
 
=== Setting up the MATLAB Workspace ===
=== Setting up the MATLAB Workspace ===
Now in MATLAB with you working directory set to you new directory for test RADA simulations run ''modelParams_smallWheels_RADA.m'' from the MATLAB command line ten load the RADA  ''.mat'' data file. Now in the Current Folder screen in MATLAB double click on the ''.slx'' and wait for it to open.


=== Settings in Simulink ===
=== Settings in Simulink ===
When running a simulation RADA in simulink always make sure your solver is set to '''ode23t'''! The RADA model is a moderately stiff set of differential equations and ode45 the default solver will take an extremely long time to run simulaitons of RADA.  You can set the run length to any length you want and then run the simulation.


=== Store Data from Simulink ===
=== Store Data from Simulink ===
 
All of the Simulink files in Paul Uhing's Research Repository output simulation data MATLAB structures contain the time and value arrays for important variables. After a simulation finishes these will show up as variables in the MATLAB Workspace. If you want to save any of these values for latter use select them in the MATLAB Workspace and right-click and select save or press ctrl+s to save these varable to a ''.mat'' file.
   
== Understanding and Modifying RADA Simulations ==
== Understanding and Modifying RADA Simulations ==



Revision as of 20:26, 4 August 2016

Simulink Setup

In order to use Simulink effectively you need to setup a few things. Iowa State will allow you download MATLAB and use a site license for free as a student. For more information about installing MATLAB using this site license look here. Simulink comes with MATLAB. You should get MATLAB 2014b or latter to ensure the Simulink files from Paul Uhing's research repository will work with your installation of MATLAB.

Once the install is complete and MATLAB is registered you can open MATLAB up. Then change the folder MATLAB will work out of to a directory you will want to work form. It would be best to copy a few files from Paul Uhing's repository to help you get started. Inside of the RADA Research Repository go to MATLAB/RADA and copy modelParams_smallWheels_RADA.m, Hbrigeest.mat, Kvw_calc.mat, Hmu_r_erisLargeWheels.mat, LQI_recalc.m, and RADA_ctrlSep.m from this directory to you new diectroy as these files will allow you to load the model parameters and controller designs used in Paul Uhing's thesis or find the most recent version of these files an copy them instead. It would also be good to copy and of the RADA_psiCtrl_v2.slx or RADA_psiCtrl_LQGsep.slx files here to sever as the base RADA simulation in your new directory. Finally, open te DataSets directory below the RADA directory can copy one of the RADA_LQG_compPID.mat files or RADA_LQG_sep.mat files because it will allow you to have input vector for the copied .slx Simulink file.

Setting up the MATLAB Workspace

Now in MATLAB with you working directory set to you new directory for test RADA simulations run modelParams_smallWheels_RADA.m from the MATLAB command line ten load the RADA .mat data file. Now in the Current Folder screen in MATLAB double click on the .slx and wait for it to open.

Settings in Simulink

When running a simulation RADA in simulink always make sure your solver is set to ode23t! The RADA model is a moderately stiff set of differential equations and ode45 the default solver will take an extremely long time to run simulaitons of RADA. You can set the run length to any length you want and then run the simulation.

Store Data from Simulink

All of the Simulink files in Paul Uhing's Research Repository output simulation data MATLAB structures contain the time and value arrays for important variables. After a simulation finishes these will show up as variables in the MATLAB Workspace. If you want to save any of these values for latter use select them in the MATLAB Workspace and right-click and select save or press ctrl+s to save these varable to a .mat file.

Understanding and Modifying RADA Simulations

Components of the Model

Body dynamics calculations

Actuator dynamics calculations

System commands

Body velocity calculations

Modifying Simulink

Creating a new simulation

Modifying existing files