Why do I get the error "Unbalanced or unexpected parenthesis or bracket?"
2 views (last 30 days)
Show older comments
I wrote an electrical capacitor code for importing to the simscape component from the simulink and proceeded with the compile, and an error such as "Unbalanced or unexpected parenthesis or bracket."
The following is a rough structure of the code I used.
component mycapacitor < foundation.electrical.electrical
parameters
A[7] = {560 , 320, 6690,9400,3400,9600,6700} ;
B[7] = {1.09, 1.14, 1.57, 4.75, 2.02, 1.041, 6.00};
end
variables
vc = {value = { 0, 'V' }, priority = priority.high}; % Capacitor voltage
end
intermediates
power_dissipated = r*i^2+g*vc^2;
end
equations
assert(c>0)
assert(g>=0)
assert(isfinite(g))
assert(r>=0)
assert(isfinite(r))
for i = 1:m
v == i*A[i] + vc*B[i];
i == c*vc.der + g*vc;
end
end
[SL: Formatted code as code.]
An error occurred in A[7] and B[7] of the above code. The language is known based on the modelica code. I used most of the array methods in the modelica code, but I got the same error. What's the problem??
2 Comments
Luca Ferro
on 1 May 2023
Edited: Luca Ferro
on 1 May 2023
I don't understand if you want help on modelica code or to convert it in matlab code
Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!