Skip to content

Development

'.insel' files

Here's what an INSEL model looks like when saved as a text file:

B 1 MUL
    5.1
    4.1

B 2 MPP
    4.1
P 2
    0               % Lower limit
    100             % Upper limit
    0.001           % Error tolerance

B 3 PLOT
    5.1
    1.1
P 3
    'advanced_plot.gnu' % Gnuplot file name

B 4 PVI
    5.1
    6.1
    7.1
P 4
    0               % Module temperature is
    96              % Number of cells in series per module
    1               % Number of cells in parallel per module
    1               % Number of modules in series
    1               % Number of modules in parallel
    0.0170          % Single cell area
    1.631           % Single module area
    1.12            % Band gap
    0.3313          % Coefficient of short-circuit current density
    0.101E-03       % Temperature coefficient of short-circuit current
    0.164254E+04    % Coefficient of saturation current density (Shockley diode)
    0               % Coefficient of saturation current density (Recombination diode)
    0.00005699      % Series resistance
    0.70997053      % Parallel resistance
    1.0483732       % Diode ideality factor alpha
    2               % Diode ideality factor beta
    0               % Bishop parameter a
    0               % Bishop parameter M
    0               % Bishop parameter Vbr
    3.0             % Module tolerance plus
    -3.0            % Module tolerance minus
    1.559           % Characteristic module length
    20.000          % Module weight
    0.70            % Absorption coefficient
    0.85            % Emission factor
    900.0           % Specific heat of a module
    45.0            % Nominal operating cell temperature
    25              % Initial cell temperature
    1E-5            % Single cell voltage error tolerance
    100             % Maximum number of iterations
    '008825'        % Product ID

B 5 TOL
    2.1

B 6 CONST
P 6
    1000            % Constant value

B 7 CONST
P 7
    25              % Constant value

INSEL Templates

INSEL templates can be defined as text:

% a_times_b.insel
% Calculates a*b

s 1 MUL  3.1 2.1
s 2 CONST
p 2
           $a || 3$
s 3 CONST
p 3
           $b || 3$
s 4 SCREEN  1.1
p 4
    '*'
and executed from Python:

>>> insel.template('a_times_b')
9.0
>>> insel.template('a_times_b', a=5)
15.0
>>> insel.template('a_times_b', b=6)
18.0
>>> insel.template('a_times_b', a=2, b=4)
8.0

GUI Templates

Insel graphical models (Vseit) are valid templates. Constants defined by Define global constant block can be modified in Python.

GUI INSEL Template

If no value is specified in Python, the value defined in the block will be used by default.

>>> insel.template('constants/x_plus_y.vseit')
3.0
>>> insel.template('constants/x_plus_y.vseit', x=5)
7.0
>>> insel.template('constants/x_plus_y.vseit', x=5, y=5)
10.0

If the Vseit model contains a PLOT block, it will be deactivated by default. In order to launch gnuplot anyway, insel.template('model.vseit', gnuplot=True) can be used.

Testing models

import unittest
import math
import insel


class TestBlock(unittest.TestCase):
    def test_pi(self):
        self.assertAlmostEqual(insel.block("pi"), math.pi, places=6)

    def test_sum(self):
        self.assertAlmostEqual(insel.block("sum", 2), 2, places=8)
        self.assertAlmostEqual(insel.block("sum", 2, 4), 6, places=8)
        self.assertAlmostEqual(insel.block("sum", 2, 4, 5), 11, places=8)

    def test_do(self):
        self.assertEqual(len(insel.block("do", parameters=[1, 10, 1])), 10)


class TestTemplate(unittest.TestCase):
    def test_a_times_b(self):
        self.assertAlmostEqual(insel.template("a_times_b"), 9, places=6)
        self.assertAlmostEqual(insel.template("a_times_b", a=4), 12, places=6)
        self.assertAlmostEqual(insel.template("a_times_b", a=4, b=5), 20, places=6)


if __name__ == "__main__":
    unittest.main()

Future plans

INSEL might become open-source in the future. Source code should be cleaned up first.

Contact

Please feel free to contact Eric Duminil (contact) if you have any question.

Privacy policy

https://www.hft-stuttgart.com/privacy

Imprint

https://www.hft-stuttgart.com/imprint