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

1 Ansicht (letzte 30 Tage)
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!

Akzeptierte Antwort

ADragon
ADragon am 15 Aug. 2018
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.

Weitere Antworten (0)

Kategorien

Mehr zu Simscape Electrical finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by