Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Problem with tablelookup in Simscape

Subject: Problem with tablelookup in Simscape

From: Francesco

Date: 1 Aug, 2013 07:05:11

Message: 1 of 2


I have a problem when trying to create a custom block using Simscape. When I try to use the function "tablelookup" in the equations section, I get the following error:

??? Error using ==> startup_EngineCooling at 4
Failed to generate 'EngineCoolingComponents_lib'

Caused by:
    Error using ==> TwoPortsCompressible>equations at 38
    Unexpected function or variable 'tablelookup'.

The code I used is the one posted at for the model of the cooling systems of an engine.

At first, I had a problem with an error of the form "Unexpected MATLAB operator" which referred to the "=" symbol in the line

uin == tablelookup(A.TTLU, A.pTLU, A.uTLU, Tin, pin, interpolation = linear, extrapolation = nearest);

So I tried to modify the code in this way:

uin == tablelookup(A.TTLU, A.pTLU, A.uTLU, Tin, pin);

which lead to the error I showed earlier in the post.

Could anyone please help me? I believe it must be a rather basic error, but I do not see where it might be (I am quite a beginner with Simscape, honestly said)

Subject: Problem with tablelookup in Simscape

From: Stephan Studener

Date: 12 Sep, 2013 07:46:09

Message: 2 of 2

I got the same error when I tried to implement a custom look-up table inside a custom component.

I the equation section, I have the following lines

p == tablelookup(phi_crank_table, p_table, phi_crank_bounded); % In-Cylinder pressure provided by the user

I did not provide an interpolation/extrapolation method (to avoid another error).

In the parameters section I have the following lines

p_table = {[1e5 1e5 2e5 1e5], 'Pa'}; % In-cylinder pressure array
phi_crank_table = {[pi 2*pi 3*pi 4*pi], 'rad'}; % Crank angle array

defining the input and output values for the look-up table.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us