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!