symReadSSCParameters
Load parameters from Simscape component
Description
[ returns
cell arrays containing the names, values, and units of all parameters
from the Simscape™ component called names,values,units]
= symReadSSCParameters(componentName)componentName.
Examples
Load the names, values, and units of the parameters of a Simscape component.
Suppose you have the Simscape component friction.ssc in
your current folder.
type('friction.ssc');component friction < foundation.mechanical.rotational.branch
parameters
brkwy_trq = { 25, 'N*m' }; % Breakaway friction torque
Col_trq = { 20, 'N*m' }; % Coulomb friction torque
visc_coef = { 0.001, 'N*m*s/rad' }; % Viscous friction coefficient
trans_coef = { 10, 's/rad' }; % Transition approximation coefficient
vel_thr = { 1e-4, 'rad/s' }; % Linear region velocity threshold
end
parameters (Access=private)
brkwy_trq_th = { 24.995, 'N*m' }; % Breakaway torque at threshold velocity
end
function setup
% Parameter range checking
if brkwy_trq <= 0
pm_error('simscape:GreaterThanZero','Breakaway friction torque' )
end
if Col_trq <= 0
pm_error('simscape:GreaterThanZero','Coulomb friction torque' )
end
if Col_trq > brkwy_trq
pm_error('simscape:LessThanOrEqual','Coulomb friction torque',...
'Breakaway friction torque')
end
if visc_coef < 0
pm_error('simscape:GreaterThanOrEqualToZero','Viscous friction coefficient')
end
if trans_coef <= 0
pm_error('simscape:GreaterThanZero','Transition approximation coefficient')
end
if vel_thr <= 0
pm_error('simscape:GreaterThanZero','Linear region velocity threshold')
end
% Computing breakaway torque at threshold velocity
brkwy_trq_th = visc_coef * vel_thr + Col_trq + (brkwy_trq - Col_trq) * ...
exp(-trans_coef * vel_thr);
end
equations
if (abs(w) <= vel_thr)
% Linear region
t == brkwy_trq_th * w / vel_thr;
elseif w > 0
t == visc_coef * w + Col_trq + ...
(brkwy_trq - Col_trq) * exp(-trans_coef * w);
else
t == visc_coef * w - Col_trq - ...
(brkwy_trq - Col_trq) * exp(-trans_coef * abs(w));
end
end
endLoad the names, values, and units of the parameters of
the component friction.ssc.
[names,values,units] = symReadSSCParameters('friction.ssc');In this example, all elements of the resulting cell arrays are scalars. You can convert the cell arrays to symbolic vectors.
names_sym = cell2sym(names)
names_sym = [ Col_trq, brkwy_trq, brkwy_trq_th, trans_coef, vel_thr, visc_coef]
values_sym = cell2sym(values)
values_sym = [ 20, 25, 4999/200, 10, 1/10000, 1/1000]
Create individual symbolic variables from the elements of the cell array
names in the MATLAB® workspace. This command creates the symbolic variables
Col_trq, brkwy_trq,
brkwy_trq_th, trans_coef,
vel_thr, and visc_coef as
sym objects in the
workspace.
syms(names)
Input Arguments
Simscape component name, specified as a file name enclosed
in single quotes. The file must have the extension .ssc.
If you do not provide the file extension, symReadSSCParameters assumes
it to be .ssc. The component must be on the MATLAB path
or in the current folder.
Example: 'MyComponent.ssc'
Output Arguments
Names of all parameters of a Simscape component, returned as a cell array.
Data Types: cell
Values of all parameters of a Simscape component, returned as a cell array.
Data Types: cell
Units of all parameters of a Simscape component, returned as a cell array.
Data Types: cell
Version History
Introduced in R2016a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)