Type mismatch for equation in SIMSCAPE

Error compiling Simscape network for model cardsimscape.
Caused by:
['cardsimscape/V12/int idt']: Type mismatch for equation. The left hand side of the equation is {[1x1 double], '1/s'} and the right hand side of the equation is {[1x1 double], 'A'}. In foundation.signal.linear.integrator (line 24)
x = [1x1 double]
I = {[1x1 double], 'A'}
Source code for PS-integrator (int idt) is below.
component integrator
% PS Integrator :0.75 :fixed
% This block performs continuous-time integration of the input Physical Signal.
% Copyright 2005-2018 The MathWorks, Inc.
inputs
I; % :left
end
outputs
O; % :right
end
parameters
x0 = { 0, 's' }; % Initial condition
end
variables(Access = private)
x = {value = x0.*ones(size(I)), priority = priority.high};
end
equations
x.der == I;
O == x;
end
annotations
x0 : UnitDropdown = common
end
end

 Accepted Answer

Sabin
Sabin on 15 Dec 2022
Hi,
The problem in this model is that a unit mismatch. The integrator is expecting a unitless physical signal while the Current sensor is providing a Current in Amperes. The solution here would be to use a PS-Gain with value 1 and unit 1/A between the Current Sensor and PS-Integrator. This will strip the unit and the model should work fine.
I hope this helps.

More Answers (0)

Categories

Products

Release

R2019b

Community Treasure Hunt

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

Start Hunting!