I am working on a energy engineering project & I have this error (Error compiling Simscape network for model PVh)
how can I solve it Please
Error compiling Simscape network for model PVh.
Caused by:
- ['PVh/Set Optimal Operating Point/PS Lookup Table (2D)']: Function, tablelookup, is wrong. Please check 1) whether input data points have correct sizes; 2) query values are row or column vectors and have identical sizes; 3) query values and table data have the commensurate units; and 4) constants or compile time parameters are passed to interpolation and extrapolation argument. In foundation.signal.lookup_tables.two_dimensional (line 40)
- Argument 1 = [1x10 double]
- Argument 2 = [1x10 double]
- Argument 3 = [10x10 double]
- Argument 4 = [1x1 double]
- Argument 5 = {[1x1 double], 'K'}
- x1 = [1x10 double]
- x2 = [1x10 double]
- f = [10x10 double]
- I1 = [1x1 double]
- I2 = {[1x1 double], 'K'}
- extrap_method = 1
- interp_method = 2
the code is
inputs
I1; % x1:left
I2; % x2:left
end
outputs
O; % f:right
end
parameters
x1 = [1 2 3 4 5]; % Table grid vector 1
x2 = [1 2 3 4 5]; % Table grid vector 2
f = [0 1 2 3 4; 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]; % 2D array of table values
interp_method = simscape.enum.interpolation.linear; % Interpolation method
extrap_method = simscape.enum.extrapolation.linear; % Extrapolation method
end
parameters (Access=private)
x1_min = min(x1); % minimum value of Table grid vector 1
x1_max = max(x1); % maximum value of Table grid vector 1
x2_min = min(x2); % minimum value of Table grid vector 2
x2_max = max(x2); % maximum value of Table grid vector 2
end
equations
O == tablelookup(x1, x2, f, I1, I2, interpolation=interp_method, extrapolation=extrap_method);
if interp_method == simscape.enum.interpolation.linear
assert(length(x1) >= 2)
assert(length(x2) >= 2)
else
assert(length(x1) >= 3)
assert(length(x2) >= 3)
end
assert(all(size(f) == [length(x1), length(x2)]))
assert(all(diff(x1) > 0) || all(diff(x1) < 0))
assert(all(diff(x2) > 0) || all(diff(x2) < 0))
if extrap_method == simscape.enum.extrapolation.error
assert(all(I1(:) >= x1_min))
assert(all(I1(:) <= x1_max))
assert(all(I2(:) >= x2_min))
assert(all(I2(:) <= x2_max))
else
end
end
annotations
[x1, x2, f] : UnitDropdown = common
end
end