top of page

Experimentation tools

Utilities for our PV experiments 1 and 3.

Experimentier Suite Icon.png

The simulation computer for Experiment 1...

draws the mathematically expected performance curves of a PV system, depending on the inclination and orientation of the modules. The basis of the simulation is the perspective reduction in the area of the modules as the sun moves from east to west and from the horizon to its highest point.


The program for Experiment 3...

introduces data fitting as a concept to programmatically obtain a continuous function from the discrete UI data set of the experiment. The fitted function is similar to the Shockley diode equation , i.e. it describes the ensemble of expected effects that occur in the photo effect.

Experiment 1

Experiment 3

Exp1: Simulation of the power curve of a PV system over the day

Modul Körper.png




Exp3: Drawing the MPP curve

When first experimenting at university and in technical drawing, so-called graph paper is often used in order to be able to draw graphs of the measurement data as accurately as possible. The graph paper is a rectangular grid with a box width of one millimeter.

In physics, it is important to "craft" a continuous line from discrete data points in order to be able to draw conclusions with certainty about certain characteristic quantities of the system.

But which line fits best to a data set? Which line

is the best fit line ?

Which fit is best.jpeg

If the data trend is linear, it is clear that the best-fit line must be a straight line that goes through the points. This can be done easily with graph paper. The important parameters of the system are then the slope and the y-intercept, i.e. the parameters of the function


Slope parameters

Y-intercept parameters

But what if the trend is not clear? Non-linear trends and so-called "outliers" in the data complicate the procedure greatly, especially in the case of complicated physical processes.


With the advent of electronically controlled machine logic, its use in data processing and interpretation has proven indispensable. Today, we use software that contains algorithms that allow us to process the data. An algorithm is simply a set of mathematical instructions that a computer can perform. In order to give the computer the instruction, you must be able to speak one of the many languages that it understands.


Many scientists choose the programming language " Python". It is extremely powerful and versatile, but its syntax - that is, the sentence structure and grammar of the language - is kept simple.


The procedure is now as follows:

  1. Which equation from physics theoretically describes the data? This is our mathematical model. We now want to find the parameters of this equation using an algorithm

  2. Define the equation in Python using the 'def'keyword

  3. Create so-called 'lists'in Python that contain all your x-values and all your y-values

  4. Perform the fit by applying the 'curve_fit' algorithmto your lists and the equation. The algorithm assumes that the values your multimeter showed are the most likely to be correct, despite the uncertainty in the measurement. It does this by minimizing the so-called "squared information loss" ( more information ).


The program then draws the best-fit lines, gives you the values of the parameters and even their uncertainty - because everything we measure in experiments has an error.

Try it yourself below!

Example values


Example values


U_liste = [


I_liste = [


Import the plot and the fitting module. Define the mathematical equation used to fit the data.

import plot

from scientific_python import curve_fit 

# das hier ist ein Kommentarbereich. Die Gleichung unten ist eine Version

# der sogenannten Shockley-Gleichung, die die Stromstärke einer Diode, 

# also auch einer Solarzelle beschreibt.

def shockley_gleichung(U, a, b ,c):

    return a*(1-b*(e**(U/c)-1))


P_liste = I_liste * U_liste

In the code above, the purple "e" denotes the so-called Euler's or natural number. The symbol '**' means 'power' and '*' is the multiplication point. The letters 'a', 'b', 'c' are the parameters of the function to be found, similar to the example above with the 'm' and 't' parameters, except that the former do not have a specific name. Translated into mathematics, the equation looks like this:

Because this equation contains "e to the power of...", we speak of a non-linear equation. The Shockley equation gives the current of a PV cell as a function of the total voltage applied. The corresponding equation for an ohmic element is

which you probably know. Now all that's left is to plot the data points and find the best-fit line!

plot(x=U_liste, y=I_liste, marker="Point", color="red")

plot(x=U_liste, y=P_liste, marker="Point", color="blue")

Run Code Button.png

I_ergebnis = curve_fit(shockley_gleichung, U_liste, I_liste)

P_ergebnis I_ergebnis * U_liste

plot(x=U_liste, y=I_ergebnis, marker="line", color="red")

plot(x=U_liste, y=P_ergebnis, marker="line", color="blue")

Run Code Button.png
Clear icon.png
bottom of page