Skip to content
Snippets Groups Projects
Commit 50af659e authored by simonhasler1994's avatar simonhasler1994
Browse files
parents 629bd346 9eb60ea9
Branches
No related tags found
No related merge requests found
Comment block 1: license, e.g. GPLv3
Comment block 2: author, e.g.
## Author: Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
Comment block 2: help of the function
1. Matlab help style
2. Octave help style, uses texinfo
function [list of output args] = function name ( list of input args )
function code here!
end%function
Comment blocks: Tests (unit tests)
Optional Comment blocks: Demos (example how to use function, with plots if possible)
## Copyright (C) 2017 - Simon Hasler
## Copyright (C) 2017 - Juan Pablo Carbajal
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## Author: Hasler Simon <simon.hasler@hsr.ch>
## -*- texinfo -*-
## @defun {[@var{T} @var{W}] =} maxonRE50_model (@var{V}, @var{I})
## @defunx {[@dots{} @var{Tg} @var{Wg}] =} maxonRE50_model (@var{V}, @var{I}, @var{gear})
## Returns the torque @var{T} and rotational speed @var{W} of the DC-motor Maxon RE50
## based on the aplied voltage @var{V} and current @var{I}.
##
## @var{V} should be in volts and @var{I} in amperes.
## @var{T} is given in Nm and @var{W} in rad/s.
##
## If a gearbox is attached to the motor, the reduction ratio and its efficinecy
## should be given in the structure @var{gear}.
## The reduced speed and torque are returned in @var{Tg} and @var{Wg}.
##
## Reference: @url{https://www.maxonmotor.com/maxon/view/product/370354}
## @end defun
function [T W Tg Wg] = maxonRE50_model (V, I, gear = [])
## Datasheet values
kM = 242; # Torque constant [mNm/A].
kn = 39.5; # Rotational speed constant [rpm/V]
dndM = 0.638; # Speed-Torque gradient [rpm/mNm].
fT = (1/1e3); # conversion factor mNm --> Nm
fW = (2*pi / 1) * (60 / 1); # conversion factor rpm --> rad/s
# Results.
# See: https://www.maxonmotor.ch/medias/sys_master/8802918137886/maxon-Formelsammlung-de.pdf (German)
# http://storkdrives.com/wp-content/uploads/2013/10/1-Formelsamling.pdf (English)
# Section 6.3
T = kM * I; # torque [mNm]
W = kn * V - dndM * T; # speed [rpm]
# Conversion
T *= fT;
W *= fW;
Tg = T; Wg = W;
if !isempty (gear)
Wg /= gear.ratio;
Tg *= gear.ratio * gear.efficiency;
endif
endfunction
%!demo
%! P = 200; # Power in Watts
%! V = linspace (70, 300, 100).';
%! I = P ./ V;
%! [T W] = maxonRE50_model (V, I);
%!
%! figure (1);
%! plot (T * 1e3, W /2/pi/60, '-k','linewidth', 2);
%! grid on
%! axis tight
%! xlabel ("Torque M [mNm]")
%! ylabel ("Ang. speed [rpm]");
%! title ("Torque-Speed curve @ 200W")
%!demo
%! P = 200; # Power in Watts
%! V = linspace (70, 300, 100).';
%! I = P ./ V;
%! gear_GP52 = struct ('ratio', 4.3, 'efficiency', 0.91);
%! [T W Tg Wg] = maxonRE50_model (V, I, gear_GP52);
%! figure (1);
%! plot (Tg * 1e3, Wg /2/pi/60, '-k','linewidth', 2);
%! grid on
%! axis tight
%! xlabel ("Torque M [mNm]")
%! ylabel ("Ang. speed [rpm]");
%! title ("Torque-Speed curve @ 200W with 4.3:1 gear")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment