forked from WPT-Lab124/Modified-Diode-Model
-
Notifications
You must be signed in to change notification settings - Fork 2
/
single_dataset_fitting.m
40 lines (31 loc) · 1.4 KB
/
single_dataset_fitting.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
%% Script for applying the MDB model to one set of simulated JV data
% -------------------------------------------------------------------------
% The JV data used in this script are simulated by SCAPS-1D. You can use
% this script to reproduce the results in Fig. 1 of the paper.
%
% @ Author: Minshen Lin
% @ Institution: Zhejiang University
%
% @ LICENSE
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published
% by the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
% -------------------------------------------------------------------------
clear; clc; % Clear workspace
addpath(genpath(pwd)); % Include directories
perov = Device(); % initialize Device object with default constructor
% Load data
irradiance = 50; % specify the dataSet by irradiance level
if irradiance == 1
dataSet = DataLoader('Figure1/1Sun.iv');
elseif irradiance == 50
dataSet = DataLoader('Figure1/50Suns.iv');
end
dataJV = DataPreconditioner(dataSet, perov).dataJV; % Data preconditioning
retrievedParams = fittingMDB(perov, dataJV); % MDB model fitting
calJV = solver(perov, dataJV, retrievedParams); % Numerically solve JV
cost = costFunction(dataJV, calJV); % Evaluate cost function
% Plot
plotJV(dataJV, calJV, retrievedParams);
plotJrecV(dataJV, calJV);