Skip to content

Commit

Permalink
Initial commit R2020b
Browse files Browse the repository at this point in the history
  • Loading branch information
smiller01985 committed Oct 10, 2020
1 parent bb97307 commit 1fcb2b6
Show file tree
Hide file tree
Showing 43 changed files with 114 additions and 83 deletions.
11 changes: 11 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright (c) 2020, The MathWorks, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. In all cases, the software is, and all modifications and derivatives of the software shall be, licensed to you solely for use in conjunction with MathWorks products and service offerings.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.




Binary file modified Libraries/sm_scissor_lift_lib.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_1_Standard_Geometry.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_2_Custom_Link_2Hole.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_3_Custom_Link_3Hole.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_3a_Custom_Link_3Hole.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_3b_Custom_Link_3Hole.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_4_Parameterized_Link_3Hole.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_5_Parameterized_Mechanism.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_6_Scissor_2_Stage.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_7_Scissor_3_Stage.slx
Binary file not shown.
Binary file modified Models/01_Defining_Bodies/Bodies_8_Lift_Actuation.slx
Binary file not shown.
Binary file modified Models/02_Hydraulic_Act/sh_cyl_single_acting_3pos.slx
Binary file not shown.
Binary file modified Models/03_Assembly/Assembly_scissor_lift_01.slx
Binary file not shown.
Binary file modified Models/03_Assembly/Assembly_scissor_lift_02.slx
Binary file not shown.
7 changes: 3 additions & 4 deletions Overview/html/sm_scissor_lift_testenv.html

Large diffs are not rendered by default.

Binary file modified Overview/html/sm_scissor_lift_testenv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/sm_scissor_lift_testenv_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 35 additions & 35 deletions README.txt → README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
Scissor Lift Model in Simscape Multibody
This file contains a scissor lift model with hydraulic actuation built using
Simscape Multibody and Simscape Fluids. The scissor lift model is assembled
from a library of parameterized component models. Intermediate models are
included to show you the steps of modeling this system. A MATLAB UI is also
included that allows you to interactively change the dimensions of the scissor lift.
Open the project file Scissor_Lift.prj to begin.
This sets up the path and opens a web page with links to models and documentation.
Hyperlinks in the models guide you to options in the model that you can explore.
The contact modeling with the floor currently uses Contact_Forces_Core.prj
as a Reference Project, but could use the Spatial Contact Force block
added in R2019b
Key parts of this submission:
1. The model of the complete scissor lift with variants for actuation and testing
is in the root directory sm_scissor_lift_testenv.slx
2. The parameterized components used to build the scissor lift
are in the file sm_scissor_lift_lib.slx in subdirectory "Libraries".
This includes a crossbar assembly that can be used for the left or right side
of the lift by changing a dialog box parameter.
3. Subdirectory Submodels/01_Defining Bodies contains incremental steps for
building the scissor lift.
4. Subdirectory Submodels/02_Hydraulic_Act contains a standalone model of a
hydraulic actuation architecture similar to what is used in the main model.
5. MATLAB scripts for defining extrusions are in subddirectory Scripts_Data.
(Extr_Data_Box.m, etc.)
Copyright 2012-2020 The MathWorks, Inc.
# **Scissor Lift Model in Simscape Multibody**
Copyright 2012-2020 The MathWorks(TM), Inc.

This file contains a scissor lift model with hydraulic actuation built using
Simscape Multibody and Simscape Fluids. The scissor lift model is assembled
from a library of parameterized component models. Intermediate models are
included to show you the steps of modeling this system. A MATLAB UI is also
included that allows you to interactively change the dimensions of the scissor lift.

Open the project file Scissor_Lift.prj to begin.
This sets up the path and opens a web page with links to models and documentation.
Hyperlinks in the models guide you to options in the model that you can explore.
The contact modeling with the floor currently uses Contact_Forces_Core.prj
as a Reference Project, but could use the Spatial Contact Force block
added in R2019b.

Key parts of this submission:
1. The model of the complete scissor lift with variants for actuation and testing
is in the root directory sm_scissor_lift_testenv.slx

2. The parameterized components used to build the scissor lift
are in the file sm_scissor_lift_lib.slx in subdirectory "Libraries".
This includes a crossbar assembly that can be used for the left or right side
of the lift by changing a dialog box parameter.

3. Subdirectory Submodels/01_Defining Bodies contains incremental steps for
building the scissor lift.

4. Subdirectory Submodels/02_Hydraulic_Act contains a standalone model of a
hydraulic actuation architecture similar to what is used in the main model.

5. MATLAB scripts for defining extrusions are in subddirectory Scripts_Data.
(Extr_Data_Box.m, etc.)


6 changes: 6 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Reporting Security Vulnerabilities

If you believe you have discovered a security vulnerability, please report it to
[[email protected]](mailto:[email protected]). Please see
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
for additional information.
12 changes: 9 additions & 3 deletions Scripts_Data/sm_scissor_lift_Demo_Script.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><title>Scissor Lift Demo Script</title><meta name="generator" content="MATLAB 9.8"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2020-03-14"><meta name="DC.source" content="sm_scissor_lift_Demo_Script.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
--><title>Scissor Lift Demo Script</title><meta name="generator" content="MATLAB 9.9"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2020-10-06"><meta name="DC.source" content="sm_scissor_lift_Demo_Script.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
Expand Down Expand Up @@ -90,9 +90,12 @@
<tr>9. Hydraulic Actuation: <a href="matlab:open_system('sh_cyl_single_acting_3pos');">Open Model</a>, <a href="matlab:web('sh_cyl_single_acting_3pos.html');">Documentation</a><br>
<tr>10. <a href="matlab:open_system('Bodies_8_Lift_Actuation');">Scissor Lift Actuation</a><br>
<br>
<tr><b><u>HIL Testing</u></b><br>
<tr>11. <a href="matlab:cd(fileparts(which('sm_scissor_lift_SLRT.m')));edit('sm_scissor_lift_SLRT.m');">Configure for Real-Time Simulation</a><br>
<br>
</style>
</style>
</p><p class="footer">Copyright 2016-2020 The MathWorks, Inc.<br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2020a</a><br></p></div><!--
</p><p class="footer">Copyright 2016-2020 The MathWorks, Inc.<br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2020b</a><br></p></div><!--
##### SOURCE BEGIN #####
%% Scissor Lift Demo Script
%
Expand All @@ -119,6 +122,9 @@
% <tr>9. Hydraulic Actuation: <a href="matlab:open_system('sh_cyl_single_acting_3pos');">Open Model</a>, <a href="matlab:web('sh_cyl_single_acting_3pos.html');">Documentation</a><br>
% <tr>10. <a href="matlab:open_system('Bodies_8_Lift_Actuation');">Scissor Lift Actuation</a><br>
% <br>
% <tr><b><u>HIL Testing</u></b><br>
% <tr>11. <a href="matlab:cd(fileparts(which('sm_scissor_lift_SLRT.m')));edit('sm_scissor_lift_SLRT.m');">Configure for Real-Time Simulation</a><br>
% <br>
% </style>
% </style>
% </html>
Expand Down
3 changes: 3 additions & 0 deletions Scripts_Data/sm_scissor_lift_Demo_Script.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
% <tr>9. Hydraulic Actuation: <a href="matlab:open_system('sh_cyl_single_acting_3pos');">Open Model</a>, <a href="matlab:web('sh_cyl_single_acting_3pos.html');">Documentation</a><br>
% <tr>10. <a href="matlab:open_system('Bodies_8_Lift_Actuation');">Scissor Lift Actuation</a><br>
% <br>
% <tr><b><u>HIL Testing</u></b><br>
% <tr>11. <a href="matlab:cd(fileparts(which('sm_scissor_lift_SLRT.m')));edit('sm_scissor_lift_SLRT.m');">Configure for Real-Time Simulation</a><br>
% <br>
% </style>
% </style>
% </html>
Expand Down
8 changes: 0 additions & 8 deletions Workflows/Real_Time/cleanup_rt_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
end
bdclose all
delete('*.mex*')
!rmdir slprj /S/Q

warning off MATLAB:DELETE:FileNotFound

delete([mdl '.slx']);
delete([mdl '.slmx']);
delete([mdl 'ri.m']);
delete([mdl 'xcp.m']);
delete([mdl '.slxc']);

warning on MATLAB:DELETE:FileNotFound
60 changes: 29 additions & 31 deletions Workflows/Real_Time/sm_scissor_lift_SLRT.m
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
%% Open model, save copy
orig_mdl = 'sm_scissor_lift_testenv';
%sm_scissor_lift_testenv_PARAM
open_system(orig_mdl);
mdl = [orig_mdl '_rttest_temp'];

sm_scissor_lift_testenv_config_actuator(orig_mdl,'hydraulic')
save_system(orig_mdl,mdl);
lift_extra_mass = 0; % kg Run-time parameter
sm_scissor_lift_testenv_configRTParams(mdl);
set_param(mdl,'SimscapeLogType','none');
set_param(mdl,'SaveFormat','StructureWithTime');
set_param(mdl,'StopTime','15');
set_param('sm_scissor_lift_testenv_rttest_temp/SLRT Scope','Commented','off');
signalbuilder([mdl '/Input/Input/Signal Builder'], 'activegroup', 3);

%% Get reference results
sm_scissor_lift_testenv_setsolver(mdl,'desktop');
sim(mdl)
t_ref = Ext_Vel_Frc.time;
y_ref = Ext_Vel_Frc.signals(1).values(:,1);
clear tout yout

%% Create plot
figure(1)
Expand All @@ -28,7 +26,6 @@
title('Comparing Simulation Results','FontSize',14,'FontWeight','Bold');
xlabel('Time (s)','FontSize',12);ylabel('Results');
legend({'Reference'},'Location','NorthWest')
%set(gca,'YLim',[-25 25]);

%% Get results with real-time solver settings
sv_p = sm_scissor_lift_testenv_setsolver(mdl,'realtime');
Expand All @@ -51,73 +48,74 @@
open_system(get_param(tune_bpth,'Parent'),'force')
set_param(tune_bpth,'Selected','on');

%% Build and download to real-time target
% Set codegen target to slrt.tlc
%% Build application
% Choose target
cs = getActiveConfigSet(mdl);
cs.switchTarget('slrealtime.tlc',[]);

set_param(mdl,'SimMechanicsOpenEditorOnUpdate','off');
slbuild(mdl);

%% Set simulation mode to External
set_param(mdl,'SimulationMode','External');
%% Download to real-time target
tg = slrealtime;
tg.connect;

%% Connect to target and run
set_param(mdl, 'SimulationCommand', 'connect')
set_param(mdl, 'SimulationCommand', 'start')
%% Run application
tg.load(mdl)
tg.start('ReloadOnStop',true,'ExportToBaseWorkspace',true)

open_system(mdl);
disp('Waiting for SLRT to finish...');
pause(1);
disp(get_param(bdroot,'SimulationStatus'));
while(~strcmp(get_param(bdroot,'SimulationStatus'),'stopped'))
while(strcmp(tg.status,'running'))
pause(2);
disp(get_param(bdroot,'SimulationStatus'));
disp(tg.status);
end
pause(2);

t_slrt1 = tg.TimeLog; y_slrt1 = tg.OutputLog;
%% Extract results from logged data in Simulink Data Inspector
y_slrt1 = logsout_sm_scissor_lift_testenv.LiveStreamSignals.get('Actuator.Actuator.Extension');

%% Plot reference and real-time results
figure(1)
hold on
h3=stairs(t_slrt1,y_slrt1,'c:','LineWidth',2.5);
h3=stairs(y_slrt1.Values.Time,y_slrt1.Values.Data(:,1),'c:','LineWidth',2.5);
hold off
legend({'Reference','Fixed-Step','Real-Time'},'Location','NorthWest');

%% Modify mass on platform
liftExtraMass_id = getparamid(tg, '','lift_extra_mass');
disp(['Platform Extra Mass (current) = ' num2str(getparam(tg,liftExtraMass_id))]);
setparam(tg,liftExtraMass_id,50);
disp(['Platform Extra Mass (new) = ' num2str(getparam(tg,liftExtraMass_id))]);
disp(['Platform Extra Mass (current) = ' num2str(getparam(tg,'','lift_extra_mass'))]);
setparam(tg,'','lift_extra_mass',50)
disp(['Platform Extra Mass (new) = ' num2str(getparam(tg,'','lift_extra_mass'))]);

%% Run simulation with new parameter value
start(tg);
tg.start('ReloadOnStop',true,'ExportToBaseWorkspace',true);

disp('Waiting for Simulink Real-Time to finish...');
pause(1);
disp(tg.Status);
while(~strcmp(tg.Status,'stopped'))
while(strcmp(tg.status,'running'))
pause(2);
disp(tg.Status);
disp(tg.status);
end
pause(2);

t_slrt2 = tg.TimeLog; y_slrt2 = tg.OutputLog;
%% Extract results from logged data in Simulink Data Inspector
y_slrt2 = logsout_sm_scissor_lift_testenv.LiveStreamSignals.get('Actuator.Actuator.Extension');

%% Plot results of altered extra mass test
figure(1)
hold on
stairs(t_slrt2,y_slrt2,'Color',temp_colororder(4,:),'LineWidth',2);
stairs(y_slrt2.Values.Time,y_slrt2.Values.Data(:,1),'Color',temp_colororder(4,:),'LineWidth',2);
hold off
legend({'Reference','Fixed-Step','Real-Time','Modified'},'Location','NorthWest');
%}

save(['sm_scissor_lift_testenv_slrt_res_' datestr(now,'yyddmm_HHMM')],'t_slrt1','y_slrt1','t_slrt2','y_slrt2','t_ref','y_ref','t_fs','y_fs');
%save(['sm_scissor_lift_testenv_slrt_res_' datestr(now,'yyddmm_HHMM')],'t_slrt1','y_slrt1','t_slrt2','y_slrt2','t_ref','y_ref','t_fs','y_fs');
% Copyright 2013-2020 The MathWorks(TM), Inc.

%% CLEAN UP DIRECTORY
cleanup_rt_test
%cleanup_rt_test

% Reset runtime parameter
clear lift_extra_mass
lift_extra_mass = 0;
% Copyright 2013-2020 The MathWorks(TM), Inc.

%warning('off','MATLAB:subscripting:noSubscriptsSpecified')
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="README.md" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="2a6b0184-ee95-44fc-bcff-c5223796d66e" />
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="LICENSE.md" type="File" />

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="2a6b0184-ee95-44fc-bcff-c5223796d66e" />
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="SECURITY.md" type="File" />
Binary file modified sm_scissor_lift_testenv.slx
Binary file not shown.

0 comments on commit 1fcb2b6

Please sign in to comment.