Simscape - transforming a rotational motion into an oscillating transational motion

3 views (last 30 days)
Hi Everyone,
I am currently working for the first time with simscape and I am having difficulties modelling a mechanical crank drive block. http://de.wikipedia.org/wiki/Datei:Kurbeltrieb-animation.gif
I looked in the block library in simscapes driveline library and there is no crank drive block. I decided to make my own block and here is my code for the custom simscape block:
----------------------------------
% Crankdrive block
% Port A is the rotational input, P is the translational output
component crankdrive
nodes
A = foundation.mechanical.rotational.rotational; % A:left
P = foundation.mechanical.translational.translational; % P:right
end
parameters
r = { 0.1, 'm'}; % Wheelradius
l = { 0.1, 'm'}; % Shaft length
Phi0 = { pi, 'rad'}; % initial angle
end
variables
f = { 0, 'N' }; % force through
v = { 0, 'm/s' }; % velocity across
t = { 0, 'N*m' }; % torque through
w = { 0, 'rad/s' }; % angular velocity across
phi = { pi, 'rad' }; % angle
end
function setup
if r <= 0
pm_error('simscape:GreaterThanZero','Wheel radius');
end
across( w, A.w, [] );
through( t, A.t, [] );
across( v, P.v, [] );
through( f, P.f, [] );
phi = Phi0;
end
equations
f == (t/r)*(1/sin(phi))
w == phi.der;
v == r* w * sin(phi)
end
end
-----------------------------------
The equations used for the force f and the velocity v are the simplified form of a crank drive. I used them to get an idea if the concept works at all.
The code compiles, but does not work. I get the error "Initial conditions solve failed to converge" or "Calculation for differential and algebraic state derivatives failed.". I played a little bit wit the solver configuration but with no success.
My questions are:
  1. Item one Is my code clean or did I make mistakes
  2. Item two Is there a way to make it work?
  3. Item three Is there an alternate way to have a model for a crank drive?
Attached you will find the simulink model that I am embedding the block into.
Thank you very much for reading and I hope you can help.
RWD

Answers (1)

Guy Rouleau
Guy Rouleau on 2 Nov 2013
The problem with this system is the singular configurations (theta=0 or 180deg). SimMechanics is better suited to simulate such system. You can then attach driveline blocks to the revolute joints.
If you really want to stay only in Simscape, I would try a combination of the "Variable Ratio Gear", the "Wheel and Axle" and then use the Simscape LUT to to control the ratio based on the translation. The comliance in the variable ratio gear should help the solver.
Another option that might work is to constrain the motion to force the rotational port in your Simscape to rotate only in one direction. Adding an "abs" at the right place in your ssc-file might do it.

Categories

Find more on Creating Custom Components and Libraries in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!