Read our guide to getting started with the analysis tool


The analysis tool lets you take sensory data, either from the data logger or an external source, and use it to predict the behaviour of an energy harvesting system. Some of the key features of the software are:

  • Aggregate data to 24-hour best case, worst case or average periods.
  • Model a range of thermoelectric and photovoltaic devices.
  • Simulate energy storage and maximum power point trackers.
  • Produce a selection of graphical and tabular outputs.
  • Compare an unlimited number of configuration combinations.

The software is developed in MATLAB, and requires version R2014b or later to run. You also need to install the GUI Layout Toolbox before using any of the UI functions.

Loading Environmental Data

Before Enspect can make any predictions, you need to supply it with environmental data, either from the data logger or another source. Enspect requires a number of equal-sized sample vectors depending on the type of sensor under study (e.g. irradiance for solar cells) as well as a vector containing a datetime specifying the instants each sample was recorded. These variables are then contained inside a DataPackage object stored in the workspace, which can be used in the UI or elsewhere.

Solar Data

For solar data, irradiance (in W/m2) and temperature (in °C) readings are required. Create a SolarDataPackage object. Set the t property to your sample times, the G property to your irradiance data, and T property to your temperature data. You can optionally set a Name for your data package which will appear in the UI.

Thermo Data

For thermoelectric data, only hot-side temperature (in °C) is currently used by the model, and the temperature gradient across the device is taken to be a constant. However, the data package contains two other temperature variables for future expansion. Create a ThermoDataPackage object, and set the t property to your sample times, and T_hot to your hot-side data. T_cold and T_heatsink should be set to any arbitary vector of the same dimension as T_hot.

Tip: Creating Objects

MATLAB objects are instantiated as though calling a function. The example below creates a SolarDataPackage and assigns its values to sample data.

sdp = SolarDataPackage()
sdp.t = datetime(2015,1,1,0,0:60,0)
sdp.G = 1:.1:7
sdp.T = 25 * ones(1, length(sdp.t))

Simulating using the UI

Launching the UI

Once you have created a DataPackage, you can open the relevant UI to define the remainder of the energy harvesting system. From the command line, run

>> main_gui

to open the UI for working with solar cell systems, or

>> thermo_gui

to open the UI for working with thermoelectric generators. The remainder of this section will give an overview of the different sections of the tool.


Every setting in the system is encapsulated in a configuration. This allows you to change the value of any parameter and compare the effects – for example, comparing a configuration with a small battery capacity to one with a large capacity. Use the buttons below the list to add or remove configurations, the checkboxes to hide or show the lines corresponding to the configuration on the graph, and the "Editing" dropdown above the list of configurations to set which one you're currently editing.


Use the choose data packages button to select which packages from your workspace to include in the simulation. You can also change the resolution, which defines the interval between simulation steps. Making the resolution larger will reduce the but speed computation time.

You can also specify how to aggregate the data to a single 24-hour period. You can select to either average the data, take the best 24-hour period, or worst 24-hour period. Where imported data has overlapping regions of time, an average value will be taken.

Solar Cell(s)

In this section you can choose which solar cells to simulate for this configuration. Clicking the button will show you a list of cells which have already been created, and from this page you can then go on to create new cells. Cells are saved in a variable called 'solarCells' in the workspace.

To specify a cell, enter the parameters using values obtained from a manufacturer datasheet or by experiment. The KI and KV parameters describe the variation with temperature and are not always provided on the datasheet – use a value of 0 if this is the case. Use the plot button in the bottom right to view an IV curve of the solar cell, which can be compared to reference material in order to adjust the model.

The two main equivalent circuit parameters, Rs and Rp are calculated for you automatically by default, and it can take some time to determine these. If for whatever reason the parameters are unsuitable, deselect the calculate resistances automatically checkbox and specify your own.

TEG Parameters

If you are simulating thermoelectric generators, this section allows you to characterise them. The model requires the values of open circuit voltage, short circuit current, hot side temperature and temperature gradient across the device at two different hot side temperatures. These may be obtained by experiment or from some manufacturer datasheets.

MPPT Method

Here can specify that a maximum power point tracker is fitted to the system, or simply assume that a constant voltage is drawn at all times. Simply select the appropriate radio button.

Energy Storage

This section allows you to add a simple energy storage model to your simulation. You can specify the capacity, initial charge, and charging voltages. To simulate inefficency or a charge controller, you can also change the charge efficency parameter to less than 1, or reduce the maximum permitted charging current.

Consuming Function

Here you can specify the consumption profile of the device that is using the power provided by the energy harvesting system. This represents the power in watts required by the device at time t. This can take the form of any MATLAB function, or just a constant value. For example, to model a sleeping device with

  • a square wave profile with an 'on' duty cycle of 10 minutes in every 60,
  • a consumption of 1mA when sleeping, and
  • a consumption of 40mA when active,
you could use the following statement:

max(1E-3, 40E-3*square((2/3600)*pi*t, 100*(1/6)))

If you need to use a more complex function rather than a single statement, use the 'named function' option and specify a name of a function that accepts two parameters: a double t and SolarCell object sc.

Using Simulation Data

When using the UI to run simulations, the configurations it creates are managed by a variable configurations in the workspace. This is loaded when the UI starts and updated when it is closed. Similarly, the last simulation to be run before the UI is closed is exported to a variable called simulation in the workspace. This is a cell array containing a struct for each configuration that was run – this struct holds the resampled data used to run the simulation (e.g. irradiance) as well as all the results (e.g. power output, surplus/defict). You can use the contents of this variable to perform additional computations outside of the UI.

Simulation Outputs

After specifying your system and running the simulation from the UI using the Update button, a range of outputs become available. Use the 'Primary' and 'Secondary' dropdowns to plot a graph of a certain quantity against time. The options available are:

  • Initial Data – allows you to see how the input data (e.g. irradiance) was aggregated or resampled.
  • P_cell/P_teg – the obtainable power output, in Watts, of the energy harvesting device.
  • P_mp – the maximum possible power that could be obtainable if an ideal maximum power point tracker was used on the energy harvesting device.
  • V_mp and I_mp – the voltage and current respectively at which the maximum power point occurs.
  • P_required – the power consumption profile of the powered device.
  • P_consumed – the power that was actually consumed by the device when powered by the harvester. Where the harvester could not power the device, this quantity is zero.
  • P_stored – power flow either in (positive) or out (negative) of the battery or energy storage device.
  • P_surplus – indicates both wasted energy in a system and areas where its energy production was insufficent. Where this quantity is above zero, there is a surplus, meaning power was generated that did not enter the consuming device or battery. Where this quanity is below zero, there was a shortfall in power, and the harvester and battery were not able to power the consuming device. The value of this quantity at a given instant indicates the magnitude of this surplus or deficit.
  • Battery Charge Fraction – the amount, expressed as a fraction between 1 and 0, indicating the remaining charge in the battery or energy storage device.

Further tabular outputs are available by switching to the 'Information' tab, which shows statistics such as the percentage time the consuming device was powered.

Simulating using MATLAB commands/scripts

It is also possible to not use the UI and perform all operations from the command line or scripts. It is reccomended to read through the code of the relevant objects to gain an in-depth understanding. A quick guide to creating a simulation using this method is as follows:

  1. Create a SolarDataPackage or ThermoDataPackage as explained earlier.
  2. Create a SolarConfiguration or ThermoConfiguration object.
  3. If modelling a solar cell, create one or more SolarCell objects. You can use the interactive UI for this by running solar_cell_dialog, optionally providing an existing cell to edit as a parameter. Alternatively, you can set all the object properties manually. Use the method determineParameters to perform the full Rp/Rs calculation process, determineInitialParameters to calculate an initial estimate of Rp, or ivCurve(G, T) to produce an array of currents and voltages used to plot an I/V curve at the specified irradiance and temperature.
  4. Assign the relevant properties of your configuration object. For the MPPTMethod property you can use the builtin ConstantVoltageMPPT or IdealMPPT classes. For the EnergyStore property you can use the provided Battery class. You can also use your own versions of these classes, derrived from MPPTMethod or EnergyStore to simulate other devices.
  5. Call the run method to calculate the results of the entire simulation.