Error compiling Simscape network for model untitled1.Caused by:['untitled1/Op-Amp']: Type mismatch for equation. The left hand side of the equation is {[1x1 double], 'V'} and the right hand side of the equation is 1.v1 = {[1x1 double], 'V'}In foundation.electrical.elements.op_amp (line 33)Component:Simulink | Category:Model error
And the code is as below,
component op_amp% Op-Amp
% Models an ideal Operational Amplifier (Op-Amp). If the voltage at the
% positive pin is denoted by Vp, and the voltage at the negative pin by Vm,
% then an ideal op-amp behavior is defined by Vp = Vm. In other words, the
% op-amp gain is assumed to be infinite. By implication, the current from
% the Vp to the Vm terminal is zero
% Copyright 2005-2013 The MathWorks, Inc.
nodes p = foundation.electrical.electrical; % +:left
n = foundation.electrical.electrical; % -:left
out = foundation.electrical.electrical; % :right
endvariables(Access=private) i1 = { 0, 'A' }; % Input current
v1 = { 0, 'V' }; % Input voltage
endvariables outI = { 0, 'A' }; % Current into output node
endbranches i1 : p.i -> n.i; outI : out.i -> *;endequations v1 == p.v - n.v; v1 == 1; i1 == 0;endend
Best Answer