How to use correctly the "1-D Lookup Table"

Hello,
I'm new to Simulink, and I'm stuck for a few days on the plot of a graph. I think I have to use the "1-D Lookup Table" block but I can't manage to use it correctly. I think I'm making a mistake in the "sample time"/"stop time" or in te use of a clock...
I want to plot a figure as if I was using the "plot" of matlab, I have data of electrical consumption per hour over one year so 8760 values. I have a table containing the 8760 consumption values and a table containing the hours (from 1 to 8760). But when I ask to plot, I only get a very rough graph... How can I do it?
Thank you for your answer.
An example of what I want to get: (but for the whole year)
What I get on Simulink :
My simulink screen:
And when I click on "edit table and breakpoints", I get this. And what I want is the plot on the right.
Thanks! :)

 Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 27 Sep 2022

0 votes

Mostly correct. Just need a few settings
  1. Press Ctrl+E to open the configuration parameters, set the Solver to be fixed step, discrete, set the step size to be 3600 seconds
  2. In the Scope, select menu View, Style, change options for "Line" and "Marker". You will get the smooth line plot, or the data points plot with the marker as "o".

7 commentaires

Armel
Armel le 27 Sep 2022
I tried what you said but it's not working... :/
Fangjun Jiang
Fangjun Jiang le 27 Sep 2022
stop time needs to be 8760*3600
Armel
Armel le 27 Sep 2022
I tried but it doesn't work either, I don't understand the logic behind it...
Fangjun Jiang
Fangjun Jiang le 27 Sep 2022
What is the actual value of "date_jour_double"? Can you show a few data values?
Armel
Armel le 27 Sep 2022
Yes of course.
These are my values :
Fangjun Jiang
Fangjun Jiang le 27 Sep 2022
Then you have a "unit mismatch" problem. This data is in '1' hour. The Clock in Simulink gives '1' second.
The best way is to set the step size to be 1, stop time to be 8760 and re-run the simulation. Keep in mind that in that situation, '1' second in Simulink represents '1' hour in your real world data.
Armel
Armel le 27 Sep 2022
Wooow ! I've been waiting for this for so long! Thank you! :D

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink dans Centre d'aide et File Exchange

Produits

Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by