Data Homer Matlab P2

Importing time series to Homer

For our P2 project we are currently working towards a goal of obtaining the most efficient household setup of PV solar, hybrid inverter and storage batteries. This setup is of course connected to the grid.

Using the Homer software to run simulations is very useful in obtaining our main goals in the project, but it also feel pretty useful to have knowledge working with it when returning to work in the industries after receiving our masters.

Anyhow. The timeseries load profile we wanted to use in our project originated from my own personel load profile from a local electricity supplier formerly known as “SE” which know goes by the name “Norlys”. Unfortunately the only way to get one year of hourly usage on your laptop is by manually clicking 3 times each time you download a file, bear in mind that each file only hourly data for one day, so this proces has to be repeated 365 times to download data for a complete year.

Finally with the data downloaded and trying to import it to Homer, it would not work. Homer simply does not recognize the format supplied by Norlys.

I turned to my trusted friend Matlab, and by writing a script suitable for our situation Matlab easily digested through all of the files trimmed and compiled the load data into a single .csv file which then could be easily imported to Homer.

The hardest thing for me was to find out what sort of format Homer would accept. There is little help to find on their website here, but that did not help me all to much, mainly because I don’t know too much about formatting .csv files. (I know it is comma separated ūüôā ) What I did find out eventually was that if I just simply use a one column csv format Homer would recognize it and put all my data in the right spot. So this was what i did, i simply created a single .csv file containing all the hourly load data, and from this data Homer accepted it and added it to the respective dates with no problems whatsoever.

Not sure how well you can use my matlab code for this project, but I will put it up here just in case. I have the script placed in main folder, and “jan”,”feb”…etc. are all subfolders containing the downloaded time series from Norlys. When I refer to the 3rd column, it is simply because this is the place of the load data in the downloaded file, the tweaking must be up to you guys ūüėČ

% Matlab Script
% Creating suitable time series load profile for Homer Pro Grid Software
% Created by Esben Uth
% Energy Department
% Aalborg University Esbjerg
%clean up
%output script start to command line
disp('Conversion started');
%create empty matrix to hold all load data
M = zeros(1,1);
%run through all subfolders
sf = {'jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'};
for k = 1:12
    %define folder
    myDir = sf{k}; %gets directory
    % count number of files in folder
    myFiles = dir(fullfile(myDir,'*.csv')); %gets all csv files in subfolder
    % start the for loop, extracting data from all the files in the folder.
    for i = 1:length(myFiles)
        %construct file name
        baseFileName = myFiles(i).name;
        fullFileName = fullfile(myDir, baseFileName);
        %read file and move data from .csv file to the T variable
        T = readtable(fullFileName, 'Delimiter', ';', 'PreserveVariableNames', true);
        %convert table to cell
        T = T{:,:};
        %read data from the file
        load_data = T(1:24,3);
        date_data = T(1:24,1);
        %trim data before appending them to the matrix
        load_data = strrep(load_data,',', '.');
        load_data = str2double(load_data);
        date_data = strrep(date_data,'-', '/');
        date_data = str2double(date_data);
        %create temporary matrix
        temp_data = [load_data];
        %append new data to the matrix
        M = [M;temp_data];
        %output part done to command line
        disp(fprintf('File %d of %.0f in %s converted.', i, n_files, sf{k}));
%delete first row of matrix
M(1,:) = [];
%write load data into .csv file
%output script end to command line
disp('Conversion complete');
Data Matlab P1 Project

Read data from KeySight 34450A Digital Multimeter

My group just finished off an experiment in which we had to read data from the log of a KeySight 34450A Digital Multimeter.

I tried to read the data using different approaches. The KeySight bundle did not work with the instruments on AAU Esbjerg because apparently they are bought without a license.

I found out that you can connect the instrument to Matlab, and read the data this way. Unfortunately I didn’t get all of the data using this method, so I found another way.

First you have to download and install this piece of software.

Next you start the newly installed “Keysight connection Expert 2019

KeySight Connection Expert 2019 Overview
As you can see in this example my instrument are no longer connected, therefore it is marked with a red X

In here you’ll find a tab on the left side, showing new and former connected instruments. If you have one instrument connected it should have a green mark on it.

Click the instrument and then in the right tab click “Interactive IO“.


A new windows opens where there is a textfield for writing commands. In this field you write the command: “DATA:DATA? NVMEM” and click “Send and read“.

The instrument will now write out all data saved in the log, you can now copy this into a file or program of your choice. Personally I saved the data into a .csv file, since the data the instrument spits out are already comma-seperated for each log-input.

Matlab handles these files pretty well, but this will be a post for another time.