Add simulink project

This commit is contained in:
Thomas Dehaeze 2020-01-22 15:32:32 +01:00
parent 45471fc497
commit c0de940434
11 changed files with 136 additions and 15 deletions

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<SimulinkProject xmlns="http://www.mathworks.com/SimulinkProjectFile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"/> <MATLABProject xmlns="http://www.mathworks.com/MATLABProjectFile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"/>

View File

@ -31,7 +31,7 @@
#+end_src #+end_src
#+begin_src matlab #+begin_src matlab
addpath('./src/') simulinkproject('./');
#+end_src #+end_src
** Simscape Model ** Simscape Model

View File

@ -43,8 +43,7 @@
#+end_src #+end_src
#+begin_src matlab #+begin_src matlab
addpath('./src/') simulinkproject('./');
addpath('./simulink/')
#+end_src #+end_src
** Control Schematic ** Control Schematic

View File

@ -44,8 +44,7 @@ According to cite:preumont07_six_axis_singl_stage_activ, the cubic configuration
#+end_src #+end_src
#+begin_src matlab :results none :exports none #+begin_src matlab :results none :exports none
addpath('src'); simulinkproject('./');
addpath('library');
#+end_src #+end_src
* Questions we wish to answer with this analysis * Questions we wish to answer with this analysis

View File

@ -31,7 +31,7 @@
#+end_src #+end_src
#+begin_src matlab #+begin_src matlab
addpath('./src/') simulinkproject('./');
#+end_src #+end_src
** Simscape Model ** Simscape Model

View File

@ -22,12 +22,20 @@
:END: :END:
* Identification * Identification
#+begin_src matlab :results none :exports none :noweb yes ** Matlab Init :noexport:ignore:
<<matlab-init>> #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
addpath('src'); <<matlab-dir>>
addpath('library');
#+end_src #+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<<matlab-init>>
#+end_src
#+begin_src matlab :results none :exports none
simulinkproject('./');
#+end_src
** Script
#+begin_src matlab :results none :exports none #+begin_src matlab :results none :exports none
open stewart open stewart
#+end_src #+end_src

View File

@ -21,10 +21,17 @@
#+PROPERTY: header-args:matlab+ :output-dir figs #+PROPERTY: header-args:matlab+ :output-dir figs
:END: :END:
#+begin_src matlab :results none :exports none :noweb yes * Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<<matlab-dir>>
#+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<<matlab-init>> <<matlab-init>>
addpath('src'); #+end_src
addpath('library');
#+begin_src matlab :results none :exports none
simulinkproject('./');
#+end_src #+end_src
* Needed Actuator Stroke * Needed Actuator Stroke

View File

@ -91,7 +91,7 @@ By following this procedure, we obtain a Matlab structure =stewart= that contain
#+end_src #+end_src
#+begin_src matlab #+begin_src matlab
addpath('./src/') simulinkproject('./');
#+end_src #+end_src
** Simscape Model ** Simscape Model

85
simulink-project.org Normal file
View File

@ -0,0 +1,85 @@
#+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
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/zenburn.css"/>
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
#+HTML_MATHJAX: align: center tagside: right font: TeX
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :results none
#+PROPERTY: header-args:matlab+ :exports both
#+PROPERTY: header-args:matlab+ :eval no-export
#+PROPERTY: header-args:matlab+ :output-dir figs
#+PROPERTY: header-args:matlab+ :tangle no
#+PROPERTY: header-args:matlab+ :mkdirp yes
#+PROPERTY: header-args:shell :eval no-export
#+PROPERTY: header-args:latex :headers '("\\usepackage{tikz}" "\\usepackage{import}" "\\import{$HOME/Cloud/thesis/latex/}{config.tex}")
#+PROPERTY: header-args:latex+ :imagemagick t :fit yes
#+PROPERTY: header-args:latex+ :iminoptions -scale 100% -density 150
#+PROPERTY: header-args:latex+ :imoutoptions -quality 100
#+PROPERTY: header-args:latex+ :results raw replace :buffer no
#+PROPERTY: header-args:latex+ :eval no-export
#+PROPERTY: header-args:latex+ :exports both
#+PROPERTY: header-args:latex+ :mkdirp yes
#+PROPERTY: header-args:latex+ :output-dir figs
:END:
Simulink Project is used for the study of the NASS using Simscape.
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
simulinkproject('./');
#+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.
#+begin_src matlab :eval no :tangle ./src/project_startup.m
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');
#+end_src
When the project closes, it runs the =project_shutdown.m= script defined below.
#+begin_src matlab :eval no :tangle ./src/project_shutdown.m
Simulink.fileGenControl('reset');
#+end_src
The project also permits to automatically add defined folder to the path when the project is opened.

5
src/project_shutdown.m Normal file
View File

@ -0,0 +1,5 @@
% When the project closes, it runs the =project_shutdown.m= script defined below.
Simulink.fileGenControl('reset');

18
src/project_startup.m Normal file
View File

@ -0,0 +1,18 @@
% 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');