How to input power load data from spreadsheet to simulate PV system

2 views (last 30 days)
I'm trying to simulate a PV grid using simulink. I have time series irradiance and temperature data, as well as time serires load data, both in spreadsheets. I have designed the system using a combination of pre-defined simulink blocks and custom subsystem blocks to fit the component specs as best as possible. I am wondering how I can feed in load data (there are three loads, aka three columns in spreadsheet that correspond to utility loads) and temp/irradiance data to simulate the PV system for every moment in time. I tried using the 'Dynamic Load' simulink block in combination with the for load data, but it only accepts a physical signal as input. Similarly for temperature/irradiance inputs to the 'PV Array' block in the system, I would like to feed in data from the spreadsheet for every moment in time, but I have resorted to a single instance as a constant for now. So my main question is how to feed in time series load (expressed in units of Watts) data from spreadhseets to my simulink system, specifically what blocks should I use and how should I run the simulation so that I get grid data for every time step. I am also wondering how to do the same for time series irradiance/temperature data. I've attached a diagram of my attempt modelling the system in simulink, and have also included the file itself. If there is more information I can include to clarify the question please let me know.

Answers (1)

Tushar Behera
Tushar Behera on 7 Oct 2022
Hello Charles Van Eijk,
I understand that you are trying to implement a variable load by importing data from a spread sheet. Also, you want to import data from excel sheet for giving input to PV arrays.
There are several ways in which you can import excel data and use it in Simulink:
  • Use the From Spreadsheet block in Simulink to read data from Microsoft® Excel® and outputs the data as a signal. Here is a Blog post giving further details on Importing Data from Excel into a simulation using the From Spreadsheet Block. This blog post is also helpful in dealing with time series data.
  • Here are some links to help you with that,
Or, alternatively, you can import Excel data into MATLAB workspace and then use those MATLAB variables as inputs to Simulink:
  • Use the importdata function in MATLAB and create an array (say ‘A’) of all the values imported and then change the variable name in each block to A(1), A(2),…….A(100).
  • Documentation link for the importdata function,
  • Or similarly, use the Import Tool to import data from a spreadsheet into the MATLAB workspace.
  • Documentation link for Import Tool,
Also, if you want to use blocks which take physical signals such as “Dynamic Load” block for input you can use Simulink-Ps Converter block as an intermediate block.
Here is the documentation link for that block,
Thanks and regards,
Tushar Behera


Find more on General Applications in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by