stewart-simscape/org/simulink-project.org

3.7 KiB

Simulink Project for the Stewart Simscape folder

A Simulink Project is used for the study of Stewart platforms using Simscape.

From the Simulink project mathworks page:

Simulink® and Simulink Projects provide a collaborative, scalable environment that enables teams to manage their files and data in one place.

With Simulink Projects, you can:

  • Collaborate: Enforce companywide standards such as company tools, libraries, and standard startup and shutdown scripts. Share your work with rich sharing options including MATLAB® toolboxes, email, and archives.
  • Automate: Set up your project environment correctly every time by automating steps such as loading the data, managing the path, and opening the models.
  • Integrate with source control: Enable easy integration with source control and configuration management tools.

The project can be opened using the simulinkproject function:

  simulinkproject('./');

When the project opens, a startup script is ran. The startup script is defined below and is exported to the project_startup.m script.

  project = simulinkproject;
  projectRoot = project.RootFolder;

  myCacheFolder = fullfile(projectRoot, '.SimulinkCache');
  myCodeFolder = fullfile(projectRoot, '.SimulinkCode');

  Simulink.fileGenControl('set',...
      'CacheFolder', myCacheFolder,...
      'CodeGenFolder', myCodeFolder,...
      'createDir', true);

  %% Load the Simscape Configuration
  load('mat/conf_simscape.mat');

When the project closes, it runs the project_shutdown.m script defined below.

  Simulink.fileGenControl('reset');

The project also permits to automatically add defined folder to the path when the project is opened.