How to assign a signal to the block parameter of simscape electric block(resistor)?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, there! I would like to pass the output signal of a subsystem as the block parameter to the resistor block of simscape electric. I did some googling about this topic and it is said that this can be realized for block other than those in Simscape electric/mechanic so on and so forth. Can someone help confirm this or in the best case scenario, come up with a feasible solution for my purpose. Or if this is not possible, I would be interested in how to realize this, say for a simple block. Thanks in advance!
댓글 수: 0
채택된 답변
ADragon
2018년 8월 15일
Hi Bohan, I think you will want to look at creating custom Simscape blocks using the Simscape programming language. If you have not done this before, you will need to spend some time in the Matlab help and try some examples. For your specific question, you can create a custom block that has and input. I attached an inertia block (2015a) which has inertia as an input. The original library inertia block had the inertia value as a block parameter. I think you can adapt this solution quite easily to the resistor. Check out "Model Linear Resistor in Simscape Language" in the Matlab help.
Sorry, can't attach *.ssc files. Here it is below.
AD
component inertia_custom
% Inertia_Custom
% The block represents an ideal mechanical rotational inertia.
%
% The block has one mechanical rotational conserving port.
% The block positive direction is from its port to the reference point.
% This means that the inertia torque is positive if the inertia is
% accelerated in the positive direction.
inputs
inertia = { 0.01, 'kg*m^2' }; % :bottom
end
nodes
I = foundation.mechanical.rotational.rotational; % :top
end
parameters
initial_velocity = { 0, 'rad/s' }; % Initial velocity
end
variables
t = { 0, 'N*m' };
end
function setup
through( t, I.t, [] );
% if inertia <= 0
% pm_error('simscape:GreaterThanZero','Inertia' )
% end
I.w = initial_velocity;
end
equations
t == inertia * I.w.der;
end
end
Copyright 2005-2008 The MathWorks, Inc.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Simscape Electrical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!