フィルターのクリア

How to assign a signal to the block parameter of simscape electric block(resistor)?

3 ビュー (過去 30 日間)
Bohan Liu
Bohan Liu 2018 年 8 月 15 日
コメント済み: ADragon 2018 年 8 月 17 日
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!

採用された回答

ADragon
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.
  2 件のコメント
Bohan Liu
Bohan Liu 2018 年 8 月 17 日
Thanks a lot man! Really appreciate it that you pointed out the ssc file stuff!
ADragon
ADragon 2018 年 8 月 17 日
You are welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimscape Electrical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by