stewart-simscape/org/simulink-project.org

79 lines
3.3 KiB
Org Mode
Raw Normal View History

2020-01-22 15:32:32 +01:00
#+TITLE: Simulink Project for the Stewart Simscape folder
:DRAWER:
#+STARTUP: overview
#+LANGUAGE: en
#+EMAIL: dehaeze.thomas@gmail.com
#+AUTHOR: Dehaeze Thomas
#+HTML_LINK_HOME: ./index.html
#+HTML_LINK_UP: ./index.html
2021-01-08 15:34:53 +01:00
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="https://research.tdehaeze.xyz/css/style.css"/>
#+HTML_HEAD: <script type="text/javascript" src="https://research.tdehaeze.xyz/js/script.js"></script>
2020-01-22 15:32:32 +01:00
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :exports both
2020-02-11 15:50:52 +01:00
#+PROPERTY: header-args:matlab+ :results none
2020-01-22 15:32:32 +01:00
#+PROPERTY: header-args:matlab+ :eval no-export
2020-02-11 15:50:52 +01:00
#+PROPERTY: header-args:matlab+ :noweb yes
2020-01-22 15:32:32 +01:00
#+PROPERTY: header-args:matlab+ :mkdirp yes
2020-02-11 15:50:52 +01:00
#+PROPERTY: header-args:matlab+ :output-dir figs
2020-01-22 15:32:32 +01:00
2020-08-05 13:26:06 +02:00
#+PROPERTY: header-args:latex :headers '("\\usepackage{tikz}" "\\usepackage{import}" "\\import{$HOME/Cloud/tikz/org/}{config.tex}")
2020-01-22 15:32:32 +01:00
#+PROPERTY: header-args:latex+ :imagemagick t :fit yes
#+PROPERTY: header-args:latex+ :iminoptions -scale 100% -density 150
#+PROPERTY: header-args:latex+ :imoutoptions -quality 100
2020-02-11 15:50:52 +01:00
#+PROPERTY: header-args:latex+ :results file raw replace
#+PROPERTY: header-args:latex+ :buffer no
2020-01-22 15:32:32 +01:00
#+PROPERTY: header-args:latex+ :eval no-export
2020-02-11 15:50:52 +01:00
#+PROPERTY: header-args:latex+ :exports results
2020-01-22 15:32:32 +01:00
#+PROPERTY: header-args:latex+ :mkdirp yes
#+PROPERTY: header-args:latex+ :output-dir figs
2020-02-11 15:50:52 +01:00
#+PROPERTY: header-args:latex+ :post pdf2svg(file=*this*, ext="png")
2020-01-22 15:32:32 +01:00
:END:
2020-01-28 13:42:39 +01:00
A Simulink Project is used for the study of Stewart platforms using Simscape.
2020-01-22 15:32:32 +01:00
From the [[https://mathworks.com/products/simulink/projects.html][Simulink project]] mathworks page:
#+begin_quote
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.
#+end_quote
The project can be opened using the =simulinkproject= function:
#+begin_src matlab
2021-01-08 15:54:58 +01:00
simulinkproject('../');
2020-01-22 15:32:32 +01:00
#+end_src
When the project opens, a startup script is ran.
The startup script is defined below and is exported to the =project_startup.m= script.
2020-02-11 18:04:45 +01:00
#+begin_src matlab :eval no :tangle ../src/project_startup.m
2021-01-08 15:54:58 +01:00
project = simulinkproject;
projectRoot = project.RootFolder;
2020-01-22 15:32:32 +01:00
2021-01-08 15:54:58 +01:00
myCacheFolder = fullfile(projectRoot, '.SimulinkCache');
myCodeFolder = fullfile(projectRoot, '.SimulinkCode');
2020-01-22 15:32:32 +01:00
2021-01-08 15:54:58 +01:00
Simulink.fileGenControl('set',...
'CacheFolder', myCacheFolder,...
'CodeGenFolder', myCodeFolder,...
'createDir', true);
2020-01-22 15:32:32 +01:00
2021-01-08 15:54:58 +01:00
%% Load the Simscape Configuration
load('mat/conf_simscape.mat');
2020-01-22 15:32:32 +01:00
#+end_src
When the project closes, it runs the =project_shutdown.m= script defined below.
2020-02-11 18:04:45 +01:00
#+begin_src matlab :eval no :tangle ../src/project_shutdown.m
2021-01-08 15:54:58 +01:00
Simulink.fileGenControl('reset');
2020-01-22 15:32:32 +01:00
#+end_src
The project also permits to automatically add defined folder to the path when the project is opened.