MATLAB Answers

How to use a lookup table to feed parameters to a dynamic load ? Or some other way to easily adjust load PQ values? (simulink - simpower)

25 views (last 30 days)
Radu Mihai
Radu Mihai on 28 Jun 2011
Commented: kashish shah on 29 Aug 2018
Hi, I'm a student working on a project for a small microgrid, a powergrid designed to work separately from the national powergrid, in Simulink.
Now, I want to simulate the behaviour of this microgrid by utilizing a dynamic load and I want the active power (P) and reactive power (Q) needs of this one dynamic load to be selected from a lookup table.
Namely I want to put P and Q values in the lookup table and the dynamic load will adjust its power needs according to real time or some other selection parameter - simulating the variation of power consumption throughout the day (from hour to hour).
Basically, I want to put in the lookup table 24 values (a value for each hour in the day) for active power and another column with 24 values for reactive power and have the load, according to the time of day the simulation is run, select its corresponding power consumption values from the lookup table.
Or have the option to input a time of day (from hour 1 to hour 24) and have the load, again, select its own power requirements.
I've tried using a Direct Lookup Table and a three-phase dynamic load, because I can use the option "external control of PQ" on that type of load, but I keep getting input/output size parameter mismatches. I think the settings on the table should be:
2 table dimensions Inputs select: element
I've tried giving the lookup table the values in two columns, but I'm not sure what kind of inputs the lookup table should have or exactly in what format to input the data (matrix, or separate vectors?), should the input be a clock with decimation of 24 (24 samples - 24 elements) or a digital clock and use something else to check what time it is on the computer and select the appropriate value?
It would also be good just to use the table to give the load a single set of PQ values and use that; I just need a way to adjust the load's PQ parameters relatively easily, without the dynamic load utilizing its built-in power requirement adjustment formulas.
I could really use your help, this project is a precursor to a pilot project for a microgrid, a grid that could function within the larger national powergrid with its own power production capability (natural gas engines and a few wind turbines) at a university.
Please help if you can.


kashish shah
kashish shah on 29 Aug 2018
Hi all, For external control of dynamic load block, as it mentions requires 2 vectors signals of P & Q. So use two lookup table blocks with P & Q columns, respectively. Combine both using mux and feed to dynamic load. It'll work as you can verify using scope on each signals & comparing to plotting graph in matlab or ms-excel.

Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 28 Jun 2011
Do this in MATLAB command window:
Drag one "Lookup Table" block, double click it, put "t" in "Vector of input values" and put "P_Value" in "Table data". This will give you the simulated P if you feed the input with the hour of the day (a number between 1 to 24). Of course, you can change the P_Value to reflect your true daily curve.
Drag another "Lookup Table" to generate the Q for you.

  1 Comment

Radu Mihai
Radu Mihai on 28 Jun 2011
Thanks for answering! I tried it and got other errors that are unconnected to this question, it means I'm making progress hehe
Thanks again!

Sign in to comment.

More Answers (2)

Fa Fa
Fa Fa on 25 Jun 2012
Hi All, i like to create lookup tables of 511 local binary pattern, also from 10000000 bis 111111110, can somebody help, Thanks


Sign in to comment.

cr28 on 13 Aug 2012
Hi, I'm doing something similar to what Radu did/tried to do ie external control of PQ using the demand data I have over 24 hours.
Using Fangjun's method (but unlike the formula used)I created workspace variables for time(in sec),P and Q for the 24 hours duration with a resolution of 1 hour. I put them in 2 separate lookup tables. I also used a mux to combine them into a single vector and wired it to the PQ controlled i/p.
The i/p to the 2 lookup tables is the same clock.
What i'm not sure about is if the lookup table is using the appropriate value (either by direct lookup or interpolation/extrapolation) based on the clock time. Note: i'm doing the simulation in phasor mode as this is much quicker than the time mode.
Any opinions???

Sign in to answer this question.