Skip to content

Commit

Permalink
Initial commit R2019b. Converted to MATLAB project.
Browse files Browse the repository at this point in the history
  • Loading branch information
smiller01985 committed Oct 31, 2019
1 parent efbdc3e commit 9d5e1b0
Show file tree
Hide file tree
Showing 781 changed files with 4,434 additions and 1,618 deletions.
2 changes: 2 additions & 0 deletions Libraries/CFL_Core/Contact_Forces_Core.prj
@@ -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"/>
Binary file not shown.
Binary file added Libraries/CFL_Core/Libraries/Parts_Lib.slx
Binary file not shown.
File renamed without changes.
@@ -1,15 +1,17 @@
Simscape Multibody Contact Forces Library
Simscape Multibody Contact Forces Library - Core
Copyright 2014-2019 The MathWorks, Inc.

This library contains contact force models for use with Simscape Multibody.
They can be used for intermittent contact (parts bouncing off each other)
and persistent contact (parts resting on each other).
and persistent contact (parts resting on each other). A few test models
are included in this project, more are in the Contact Forces Library project.

You are welcome to use this library in your own projects. If you need to
include the library in your own project, run >> CFL_SaveLibsOnly.m from
the root directory of your local repository. Only the critical files
will be copied to a folder "CFL_Libs", and you can cut-and-paste that
to your own local project. Please cite
** Please note that the Spatial Contact Force block has been added in R2019b.
** You should see if this block meets your needs before using this library.

You are welcome to use this library in your own projects. You can either
reference the project file directly or include it in your top level project
as a Referenced Project.

General approach for using this library:
1. Identify the parts in your system that will hit each other during simulation
Expand Down Expand Up @@ -37,6 +39,8 @@ Recommendations:


######### Release History #########
v 5.0(R2019b) Sep 2019 Move to MATLAB Projects

v 4.1(R2019a) Mar 2019 Updated v4.1 for R2019a
Minor changes to accommodate physical signal units

Expand Down
Expand Up @@ -6,7 +6,7 @@
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><title>Simscape Multibody Contact Forces Library</title><meta name="generator" content="MATLAB 9.6"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2019-03-09"><meta name="DC.source" content="Contact_Forces_Demo_Script.m"><style type="text/css">
--><title>Simscape Multibody Contact Forces Library</title><meta name="generator" content="MATLAB 9.7"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2019-07-25"><meta name="DC.source" content="Contact_Forces_Demo_Script_Library_Only.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}

html { min-height:100%; margin-bottom:1px; }
Expand Down Expand Up @@ -69,41 +69,61 @@
</style></head><body><div class="content"><h1>Simscape Multibody Contact Forces Library</h1><p>
<span style="font-family:Arial">
<span style="font-size:10pt">
<tr><b><a href="matlab:web('Contact_Forces_Demo_Script_Library.html');">Library Overview</a></b><br>
<tr><b><u>Library Overview</u></b><br>
<tr>1. <a href="matlab:web('Contact_Forces_Library_Use.html');">Using the Library</a><br>
<tr>2. <a href="matlab:cd(fileparts(which('Contact_Forces_Lib.slx')));Contact_Forces_Lib;">Library</a><br>
<tr>3. Forces: <a href="matlab:web('Force_Laws.html');">Laws</a><br>
<tr>....1. Basic 2D:<br>
<tr>.......a. Circle-to-Circle Force: <a href="matlab:web('Circle_to_Circle_Contact.html');">Description</a><br>
<tr>.......b. Circle-to-Finite Line Force: <a href="matlab:web('Circle_to_Finite_Line_Contact.html');">Description</a><br>
<tr>.......c. Circle-to-Ring Force: <a href="matlab:web('Circle_to_Ring_Contact.html');">Description</a><br>
<tr>....2. Composite 2D:<br>
<tr>.......a. Box-to-Box Force: <a href="matlab:web('Box_to_Box_Contact.html');">Description</a><br>
<tr>.......b. Box-to-Belt Force: <a href="matlab:web('Box_to_Belt_Contact.html');">Description</a><br>
<tr>....3. Basic 3D:<br>
<tr>.......a. Sphere-to-Sphere Force: <a href="matlab:web('Sphere_to_Sphere_Contact.html');">Description</a><br>
<tr>.......b. Sphere-in-Sphere Force: <a href="matlab:web('Sphere_in_Sphere_Contact.html');">Description</a><br>
<tr>.......c. Sphere-to-Plane Force: <a href="matlab:web('Sphere_to_Plane_Contact.html');">Description</a><br>
<tr>.......d. Sphere-to-Tube Force: <a href="matlab:web('Sphere_to_Tube_Contact.html');">Description</a><br>
<tr>.......e. Sphere-to-Cone Force: <a href="matlab:web('Sphere_to_Cone_Contact.html');">Description</a><br>
<tr>4. Friction Force: <a href="matlab:web('Friction_Laws.html');">Laws</a><br>
<br>
<tr><b><a href="matlab:web('Contact_Forces_Demo_Script_2D_Collision.html');">2D Collision Examples (Basic)</a></b><br>
<tr><b><u>Test Models</u></b><br>
<tr>1. Disks in Box (2D): <a href="matlab:cd(fileparts(which('Test2D_Disks_in_Box.slx')));Test2D_Disks_in_Box;">Model</a><br>
<tr>2. Balls in Box (3D): <a href="matlab:cd(fileparts(which('Test3D_Balls_in_Box.slx')));Test3D_Balls_in_Box;">Model</a><br>
<br>
<tr><b><a href="matlab:web('Contact_Forces_Demo_Script_2D_Friction.html');">2D Friction Examples (Basic)</a></b><br>
<br>
<tr><b><a href="matlab:web('Contact_Forces_Demo_Script_2D_Applications.html');">2D Examples (Applications)</a></b><br>
<br>
<tr><b><a href="matlab:web('Contact_Forces_Demo_Script_3D_Collision.html');">3D Collision Examples (Basic)</a></b><br>
<br>
<tr><b><a href="matlab:web('Contact_Forces_Demo_Script_3D_Friction.html');">3D Friction Examples (Basic)</a></b><br>
<br>
<tr><b><a href="matlab:web('Contact_Forces_Demo_Script_3D_Applications.html');">3D Applications</a></b><br>
</style>
</style>
</p><p>Copyright 2014-2019 The MathWorks&#8482;, Inc.</p><p class="footer"><br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2019a</a><br></p></div><!--
</p><p>Copyright 2014-2019 The MathWorks&#8482;, Inc.</p><p class="footer"><br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2019b</a><br></p></div><!--
##### SOURCE BEGIN #####
%% Simscape Multibody Contact Forces Library
%
% <html>
% <span style="font-family:Arial">
% <span style="font-size:10pt">
% <tr><b><a href="matlab:web('Contact_Forces_Demo_Script_Library.html');">Library Overview</a></b><br>
% <br>
% <tr><b><a href="matlab:web('Contact_Forces_Demo_Script_2D_Collision.html');">2D Collision Examples (Basic)</a></b><br>
% <br>
% <tr><b><a href="matlab:web('Contact_Forces_Demo_Script_2D_Friction.html');">2D Friction Examples (Basic)</a></b><br>
% <br>
% <tr><b><a href="matlab:web('Contact_Forces_Demo_Script_2D_Applications.html');">2D Examples (Applications)</a></b><br>
% <br>
% <tr><b><a href="matlab:web('Contact_Forces_Demo_Script_3D_Collision.html');">3D Collision Examples (Basic)</a></b><br>
% <tr><b><u>Library Overview</u></b><br>
% <tr>1. <a href="matlab:web('Contact_Forces_Library_Use.html');">Using the Library</a><br>
% <tr>2. <a href="matlab:cd(fileparts(which('Contact_Forces_Lib.slx')));Contact_Forces_Lib;">Library</a><br>
% <tr>3. Forces: <a href="matlab:web('Force_Laws.html');">Laws</a><br>
% <tr>....1. Basic 2D:<br>
% <tr>.......a. Circle-to-Circle Force: <a href="matlab:web('Circle_to_Circle_Contact.html');">Description</a><br>
% <tr>.......b. Circle-to-Finite Line Force: <a href="matlab:web('Circle_to_Finite_Line_Contact.html');">Description</a><br>
% <tr>.......c. Circle-to-Ring Force: <a href="matlab:web('Circle_to_Ring_Contact.html');">Description</a><br>
% <tr>....2. Composite 2D:<br>
% <tr>.......a. Box-to-Box Force: <a href="matlab:web('Box_to_Box_Contact.html');">Description</a><br>
% <tr>.......b. Box-to-Belt Force: <a href="matlab:web('Box_to_Belt_Contact.html');">Description</a><br>
% <tr>....3. Basic 3D:<br>
% <tr>.......a. Sphere-to-Sphere Force: <a href="matlab:web('Sphere_to_Sphere_Contact.html');">Description</a><br>
% <tr>.......b. Sphere-in-Sphere Force: <a href="matlab:web('Sphere_in_Sphere_Contact.html');">Description</a><br>
% <tr>.......c. Sphere-to-Plane Force: <a href="matlab:web('Sphere_to_Plane_Contact.html');">Description</a><br>
% <tr>.......d. Sphere-to-Tube Force: <a href="matlab:web('Sphere_to_Tube_Contact.html');">Description</a><br>
% <tr>.......e. Sphere-to-Cone Force: <a href="matlab:web('Sphere_to_Cone_Contact.html');">Description</a><br>
% <tr>4. Friction Force: <a href="matlab:web('Friction_Laws.html');">Laws</a><br>
% <br>
% <tr><b><a href="matlab:web('Contact_Forces_Demo_Script_3D_Friction.html');">3D Friction Examples (Basic)</a></b><br>
% <tr><b><u>Test Models</u></b><br>
% <tr>1. Disks in Box (2D): <a href="matlab:cd(fileparts(which('Test2D_Disks_in_Box.slx')));Test2D_Disks_in_Box;">Model</a><br>
% <tr>2. Balls in Box (3D): <a href="matlab:cd(fileparts(which('Test3D_Balls_in_Box.slx')));Test3D_Balls_in_Box;">Model</a><br>
% <br>
% <tr><b><a href="matlab:web('Contact_Forces_Demo_Script_3D_Applications.html');">3D Applications</a></b><br>
% </style>
% </style>
% </html>
Expand Down
@@ -1,25 +1,26 @@
% Startup for Simscape Multibody Contact Force Library
% Copyright 2014-2019 The MathWorks, Inc.
function startup_Contact_Forces_Core

CFR_HomeDir = pwd;
addpath(genpath(pwd));
% Startup for project Contact_Forces_Core.prj
% Copyright 2014-2019 The MathWorks, Inc.

% Load library and display version to Command Window
CFL_libname = 'Contact_Forces_Lib';
load_system(CFL_libname);
CFL_ver = get_param(CFL_libname,'Description');
disp(CFL_ver);
disp(get_param(CFL_libname,'Description'));
which(CFL_libname)

% Check for shadowed versions on the path
tempNumCFLLibs = which(CFL_libname,'-all');
if (length(tempNumCFLLibs)>1)
tempCFLwarnStr = sprintf('Multiple copies of the Simscape Multibody Contact Force Library are on the MATLAB path. It is recommended you only have one copy on your path. Please consider adjusting your MATLAB path so that only one copy is present.\n\nLocations of Simscape Multibody Contact Force Library on your path:\n');
tempCFLLibStr = sprintf('%s\n',tempNumCFLLibs{:});
warning([tempCFLwarnStr tempCFLLibStr])
end
clear tempNumCFLLibs tempCFLwarnStr

if(exist('Cam_Follower.slx')==4)
Cam_Follower
web('Contact_Forces_Demo_Script.html');
% Only open overview if this is the top level project
% Do not open if this is a Reference Projects
curr_proj = simulinkproject;
if(curr_proj.Information.TopLevel)
web('Contact_Forces_Demo_Script_Library_Only.html');
end

Binary file not shown.
53 changes: 53 additions & 0 deletions Libraries/CFL_Core/Test_Models/Test2D_Disks_in_Box_plot1diskpos.m
@@ -0,0 +1,53 @@
% Code to plot simulation results from Test2D_Disks_in_Box
%
% Copyright 2015-2019 The MathWorks, Inc.

% Reuse figure if it exists, else create new figure
try
figure(h1_Test2D_Disks_in_Box)
catch
h1_Test2D_Disks_in_Box=figure('Name','Test2D_Disks_in_Box');
end

% Generate simulation results if they don't exist
if(~exist('simlog_Test2D_Disks_in_Box','var'))
sim('Test2D_Disks_in_Box')
end

% Get simulation results
simlog_d1x = simlog_Test2D_Disks_in_Box.Planar_Joint_Disk1.Px.p.series.values;
simlog_d1y = simlog_Test2D_Disks_in_Box.Planar_Joint_Disk1.Py.p.series.values;
simlog_d2x = simlog_Test2D_Disks_in_Box.Planar_Joint_Disk2.Px.p.series.values;
simlog_d2y = simlog_Test2D_Disks_in_Box.Planar_Joint_Disk2.Py.p.series.values;
simlog_d3x = simlog_Test2D_Disks_in_Box.Planar_Joint_Disk3.Px.p.series.values;
simlog_d3y = simlog_Test2D_Disks_in_Box.Planar_Joint_Disk3.Py.p.series.values;

% Plot results
temp_colorOrder = get(gca,'DefaultAxesColorOrder');
plot(simlog_d1y,simlog_d1x,'LineWidth',1);
hold on
plot(simlog_d2y,simlog_d2x,'LineWidth',1);
plot(simlog_d3y,simlog_d3x,'LineWidth',1);
plot([-1 1 1 -1 -1 1]*0.5,[-1 -1 1 1 -1 -1]*0.5,'Color',[0.5 0.5 0.5],'LineWidth',5);
patch(sin(0:0.1:2*pi)*0.05+simlog_d1y(1),cos(0:0.1:2*pi)*0.05+simlog_d1x(1),temp_colorOrder(1,:),'FaceAlpha',0.2)
patch(sin(0:0.1:2*pi)*0.05+simlog_d2y(1),cos(0:0.1:2*pi)*0.05+simlog_d2x(1),temp_colorOrder(2,:),'FaceAlpha',0.2)
patch(sin(0:0.1:2*pi)*0.05+simlog_d3y(1),cos(0:0.1:2*pi)*0.05+simlog_d3x(1),temp_colorOrder(3,:),'FaceAlpha',0.2)

patch(sin(0:0.1:2*pi)*0.05+simlog_d1y(end),cos(0:0.1:2*pi)*0.05+simlog_d1x(end),temp_colorOrder(1,:))
patch(sin(0:0.1:2*pi)*0.05+simlog_d2y(end),cos(0:0.1:2*pi)*0.05+simlog_d2x(end),temp_colorOrder(2,:))
patch(sin(0:0.1:2*pi)*0.05+simlog_d3y(end),cos(0:0.1:2*pi)*0.05+simlog_d3x(end),temp_colorOrder(3,:))

hold off
xlabel('Horizontal Position (m)');
ylabel('Vertical Position (m)');
title('Disk Position (m)');
axis equal
axis square
axis([-1 1 -1 1]*0.6)

% Remove temporary variables
clear simlog_d1y simlog_d1x temp_colorOrder
clear simlog_d2y simlog_d2x
clear simlog_d3y simlog_d3x


Binary file not shown.
46 changes: 46 additions & 0 deletions Libraries/CFL_Core/Test_Models/Test3D_Balls_in_Box_plot1ballpos.m
@@ -0,0 +1,46 @@
% Code to plot simulation results from Test3D_Balls_in_Box
%
% Copyright 2015-2019 The MathWorks, Inc.

% Reuse figure if it exists, else create new figure
try
figure(h1_Test3D_Balls_in_Box)
catch
h1_Test3D_Balls_in_Box=figure('Name','Test3D_Balls_in_Box');
end

% Generate simulation results if they don't exist
if(~exist('simlog_Test3D_Balls_in_Box','var'))
sim('Test3D_Balls_in_Box')
end

% Get simulation results
temp_b1px = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_1.Px.p.series;
temp_b1py = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_1.Py.p.series;
temp_b1pz = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_1.Pz.p.series;
temp_b2px = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_2.Px.p.series;
temp_b2py = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_2.Py.p.series;
temp_b2pz = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_2.Pz.p.series;
temp_b3px = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_3.Px.p.series;
temp_b3py = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_3.Py.p.series;
temp_b3pz = simlog_Test3D_Balls_in_Box.x6_DOF_Joint_Ball_3.Pz.p.series;

% Plot results
plot3(temp_b1px.values,temp_b1py.values,temp_b1pz.values,'r');
hold on
plot3(temp_b2px.values,temp_b2py.values,temp_b2pz.values,'b');
plot3(temp_b3px.values,temp_b3py.values,temp_b3pz.values,'Color',[168 164 0]/255);
hold off
grid on
box on
axis equal
xlabel('Length (m)');
ylabel('Width (m)');
zlabel('Height (m)');
title('Ball Position in Box (m)');

% Remove temporary variables
clear temp_b1px temp_b1py temp_b1pz
clear temp_b2px temp_b2py temp_b2pz
clear temp_b3px temp_b3py temp_b3pz

2 changes: 2 additions & 0 deletions Libraries/CFL_Core/resources/project/Project.xml
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info MetadataType="distributed" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Name="Contact_Forces_Core" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="1" SingleValued="1" DataType="None" Name="Classification" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="WRITABLE" Name="ForCore" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Artifact" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Convenience" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Derived" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Design" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="WRITABLE" Name="ForDeveloper" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="None" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Other" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Test" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="Basic" Visible="1" Icon="" File="Test_Models/Test3D_Balls_in_Box.slx" Name="Test Model 3D" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="Basic" Visible="1" Icon="" File="Test_Models/Test2D_Disks_in_Box.slx" Name="Test Model 2D" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="Basic" Visible="1" Icon="" File="Scripts_Data/Doc/Contact_Forces_Demo_Script_Library_Only.html" Name="Demo Script" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="StartUp" Visible="0" Icon="" File="Scripts_Data/startup_Contact_Forces_Core.m" Name="startup_Contact_Forces_Core" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Name="ForUser" />
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Data="FileClassCategory" />
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="ad2dea70-790c-4d13-aa0b-381399c1ae7d" />
</Category>
</Info>
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="ad2dea70-790c-4d13-aa0b-381399c1ae7d" />
</Category>
</Info>
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="ad2dea70-790c-4d13-aa0b-381399c1ae7d" />
</Category>
</Info>
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="ad2dea70-790c-4d13-aa0b-381399c1ae7d" />
</Category>
</Info>
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="ad2dea70-790c-4d13-aa0b-381399c1ae7d" />
</Category>
</Info>
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="ad2dea70-790c-4d13-aa0b-381399c1ae7d" />
</Category>
</Info>

0 comments on commit 9d5e1b0

Please sign in to comment.