Skip to content

Commit

Permalink
Initial commit R2020a.
Browse files Browse the repository at this point in the history
  • Loading branch information
smiller01985 committed Apr 8, 2022
0 parents commit 8b6edbf
Show file tree
Hide file tree
Showing 114 changed files with 63,796 additions and 0 deletions.
63,395 changes: 63,395 additions & 0 deletions CAD/Geometry/Steering_Wheel.STEP

Large diffs are not rendered by default.

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 added Models/Bouncing_Ball/sm_contact_ball.slx
Binary file not shown.
74 changes: 74 additions & 0 deletions Models/Bouncing_Ball/sm_contact_ball_plot1time.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
% Code to plot simulation results from sm_contact_ball
%% Plot Description:
%
% <enter plot description here if desired>
%
% Copyright 2016 The MathWorks, Inc.

% Reuse figure if it exists, else create new figure
if ~exist('h1_sm_contact_ball', 'var') || ...
~isgraphics(h1_sm_contact_ball, 'figure')
h1_sm_contact_ball = figure('Name', 'sm_contact_ball');
end
figure(h1_sm_contact_ball)
clf(h1_sm_contact_ball)

temp_colororder = get(gca,'defaultAxesColorOrder');

mdl = 'sm_contact_ball';
% Get simulation results, ZCs on
set_param([mdl '/Spatial Contact Force 1'],'ZeroCrossDetectContactStartAndEnd','on');
set_param([mdl '/Brick Solid Floor 1'],'BrickDimensions','[0.5 0.5 1]');

sim(mdl);
simlog_zcOn_t = simlog_sm_contact_ball.x6_DOF_Joint_Spherical_Solid.Pz.p.series.time;
simlog_zcOn_pz = simlog_sm_contact_ball.x6_DOF_Joint_Spherical_Solid.Pz.p.series.values('m');

% Get simulation results, ZCs off
set_param([mdl '/Spatial Contact Force 1'],'ZeroCrossDetectContactStartAndEnd','off');
sim(mdl);
simlog_zcOff_t = simlog_sm_contact_ball.x6_DOF_Joint_Spherical_Solid.Pz.p.series.time;
simlog_zcOff_pz = simlog_sm_contact_ball.x6_DOF_Joint_Spherical_Solid.Pz.p.series.values('m');

% Turn ZCs back on
set_param([mdl '/Spatial Contact Force 1'],'ZeroCrossDetectContactStartAndEnd','on');

%% Plot results
simlog_handles(1) = subplot(2, 1, 1);
t_interp = 0:0.01:simlog_zcOn_t(end);

% data interpolation with pchip
simlog_zcOn_pz_int = interp1(simlog_zcOn_t,simlog_zcOn_pz,t_interp,'makima');
simlog_zcOff_pz_int = interp1(simlog_zcOff_t,simlog_zcOff_pz,t_interp,'makima');

plot(t_interp, simlog_zcOn_pz_int,...
'LineWidth', 0.5,'Color',temp_colororder(1,:))
hold on
plot(simlog_zcOn_t, simlog_zcOn_pz,...
'x','Color',temp_colororder(1,:))
plot(t_interp, simlog_zcOff_pz_int,...
'LineWidth', 0.5,'Color',temp_colororder(2,:))
hold on
plot(simlog_zcOff_t, simlog_zcOff_pz,...
'o','Color',temp_colororder(2,:))
hold off
grid on
title('Ball Height')
ylabel('Height (m)')

simlog_handles(2) = subplot(2, 1, 2);
semilogy(simlog_zcOn_t(1:end-1), diff(simlog_zcOn_t), '-x')
hold on
semilogy(simlog_zcOff_t(1:end-1), diff(simlog_zcOff_t), '-o')
%grid on
title('Step Size')
ylabel('Step Size (s)')
xlabel('Time (s)')
legend({['ZCs On: ' num2str(length(simlog_zcOn_t)) ' Steps'],...
['ZCs Off: ' num2str(length(simlog_zcOff_t)) ' Steps']},'Location','Best');

linkaxes(simlog_handles, 'x')

% Remove temporary variables
clear simlog_t simlog_handles temp_colororder

Binary file added Models/Contact_Pairs/sm_contact_pairs.slx
Binary file not shown.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# **Spatial Contact Force Block Examples in Simscape Multibody&trade;**
Copyright 2020 The MathWorks, Inc.

This repository contains a set of examples that demonstrate the
[Spatial Contact Force block](https://www.mathworks.com/help/physmod/sm/ref/spatialcontactforce.html).
The examples cover:
* **Solid-to-solid contact** between parameterized solids like bricks, spheres, and cylinders
* **Contact between CAD geometry** including STEP files.

Open the project file Spatial_Contact_Force_Examples.prj to get started.

To learn more about contact modeling with Simscape Multibody, please visit:
* [Modeling Contact Force Between Two Solids](https://www.mathworks.com/help/physmod/sm/ug/modeling-contact-force-between-two-solids.html)
* [Use Contact Proxies to Simulate Contact](https://www.mathworks.com/help/physmod/sm/ug/use-contact-proxies.html)

* Product Capabilities:
* [Simscape&trade;](https://www.mathworks.com/products/simscape.html)
* [Simscape Driveline&trade;](https://www.mathworks.com/products/simscape-driveline.html)
* [Simscape Electrical&trade;](https://www.mathworks.com/products/simscape-electrical.html)
* [Simscape Fluids&trade;](https://www.mathworks.com/products/simscape-fluids.html)
* [Simscape Multibody&trade;](https://www.mathworks.com/products/simscape-multibody.html)
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.
8 changes: 8 additions & 0 deletions Scripts_Data/shutdown_contact_examples_basic.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
% Shutdown script for custom project
% Copyright 2019-2020 The MathWorks, Inc.

%% Code for cleaning Simscape custom library at shutdown
% Change to folder with package directory
curr_proj = simulinkproject;
cd(curr_proj.RootFolder)

23 changes: 23 additions & 0 deletions Scripts_Data/startup_contact_examples_basic.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
% Startup script for project Aileron_Act.prj
% Copyright 2018-2020 The MathWorks, Inc.

%% Code for building Simscape custom library at startup
% Change to folder with package directory
curr_proj = simulinkproject;
cd(curr_proj.RootFolder)

% Change to root folder
cd(curr_proj.RootFolder)

% If running in a parallel pool
% do not open model or demo script
open_start_content = 1;
if(~isempty(ver('parallel')))
if(~isempty(getCurrentTask()))
open_start_content = 0;
end
end

if(open_start_content)
sm_contact_ball
end
2 changes: 2 additions & 0 deletions Spatial_Contact_Force_Examples.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<MATLABProject xmlns="http://www.mathworks.com/MATLABProjectFile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="1" type="DIR_SIGNIFIER" />
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="96c40e67-021b-48a2-9371-288e60f8854b" />
</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="Contact_Pairs" 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="96c40e67-021b-48a2-9371-288e60f8854b" />
</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="Bouncing_Ball" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="1" type="DIR_SIGNIFIER" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="Geometry" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="Scripts_Data" Type="Relative" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="8290916a-74f5-4fab-a235-465f403cbabc" type="Reference" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="CAD/Geometry" Type="Relative" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="470bdace-1ef7-4382-80f8-a3b6e29f870e" type="Reference" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="Models/Contact_Pairs" Type="Relative" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="fe388ed7-a7b2-4ed5-9897-5fa2daf4d497" type="Reference" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="Models/Bouncing_Ball" Type="Relative" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="c63a59e3-f2bb-47ee-861f-5a2fc98eb4ae" type="Reference" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="" Type="Relative" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="f2a01727-2c10-42b2-b01d-521674068045" type="Reference" />
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="96c40e67-021b-48a2-9371-288e60f8854b" />
</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="Steering_Wheel.STEP" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="1" type="DIR_SIGNIFIER" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="StartUp" Visible="0" Icon="" File="Scripts_Data/startup_contact_examples_basic.m" Name="startup_my_project" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="eb2a6db0-b8d2-4dc1-b968-28f9142c41c0" type="EntryPoint" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="Basic" Visible="1" Icon="" File="Overview/html/ssc_main_model.html" Name="Overview" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="025e0304-04d6-4854-b39c-b08300cd5788" type="EntryPoint" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="Shutdown" Visible="0" Icon="" File="Scripts_Data/shutdown_contact_examples_basic.m" Name="shutdown_my_project" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="b8280733-8ed2-4efb-a0a0-60ae294d5dc9" type="EntryPoint" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="Basic" Visible="1" Icon="" File="Models/Bouncing_Ball/sm_contact_ball.slx" Name="Bouncing Ball" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="96019d5f-1f7e-4548-96d9-74e45ec2e016" type="EntryPoint" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="Basic" Visible="1" Icon="" File="Models/Contact_Pairs/sm_contact_pairs.slx" Name="Contact Pairs" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="99f5e276-2454-4184-884f-82dc59f251e5" type="EntryPoint" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Test" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="test" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="WRITABLE" Name="ForUser" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="96c40e67-021b-48a2-9371-288e60f8854b" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Other" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="other" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Convenience" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="convenience" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="None" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="none" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Derived" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="derived" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="WRITABLE" Name="ForDeveloper" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="3939b07b-7b17-42cd-8dff-04b20a51bc50" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Design" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="design" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Artifact" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="artifact" type="Label" />
2 changes: 2 additions & 0 deletions resources/project/Project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info MetadataType="fixedPath" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Name="ForUser" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="b001e324-d197-4d21-ac7d-a1401877b3e8" type="ExportProfile" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="work" Type="Relative" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="SimulinkCodeGenFolder" type="Reference" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="work" Type="Relative" />
Loading

0 comments on commit 8b6edbf

Please sign in to comment.