From b3c82fa5d51e6a4be4887be7472c8955f3b1636c Mon Sep 17 00:00:00 2001
From: Oliver <oliver-mx@gmx.de>
Date: Wed, 7 Aug 2024 13:42:37 +0200
Subject: [PATCH] new

---
 Sim_0_data.m |  4 ++--
 Skript.m     | 24 +++++++++++++++---------
 fun_1.m      |  6 +++++-
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/Sim_0_data.m b/Sim_0_data.m
index 01e6d0e..4e8caeb 100644
--- a/Sim_0_data.m
+++ b/Sim_0_data.m
@@ -113,8 +113,8 @@ pe=0.5;                     % electricity price [$/kWh]
 mixer_ERD=1;                % PRO Draw outlet mixer adjustment (only if 2nd ERDs) (mixer_ERD=1 --> all flow to ERD2 no turbine needed)    
 
 %% display figures
-fig=[1,0,0,0,0,0,0,0,1,0,0]; % f(i)=1 --> figure i will be displayed
-%fig=[0,0,0,0,0,0,0,0,0,0,0]; % f(i)=1 --> figure i will be displayed
+%fig=[1,0,0,0,0,0,0,0,1,0,0]; % f(i)=1 --> figure i will be displayed
+fig=[0,0,0,0,0,0,0,0,0,0,0]; % f(i)=1 --> figure i will be displayed
 
 %% model specific changes:
 % co-current
diff --git a/Skript.m b/Skript.m
index dc7d9fe..dd69501 100644
--- a/Skript.m
+++ b/Skript.m
@@ -1,28 +1,34 @@
-%% Matlab file for the Paper 2024:
+%% Matlab skript for the Paper 2024:
+%
 % - reproduce the simulations
 % - reproduce optimisation results
 % - reproduce all figures.png (converted to .eps using LibreOfficeDraw)
 % - test average computation time
+%
 
 %% Numerical Simulations
-% figures for SWRO, PRO and the ERD
-% original .m file from: C:>User>bav1839>Documents>MATLAB>Counter-current-solver
+%
+% Create figures form chapter: Numerical simulations
+% 
 close all;
-[Output1, Output2, time]=fun_1(1,0,'sol',1e6,1e-6),
+[Output1, Output2, time]=fun_1(1,0,'sol',1e4,1e-4),
+%
 %figure(1); set(gcf,'color','w'); f = gcf; exportgraphics(f,'Figure_6.png');
 %figure(2); set(gcf,'color','w'); f = gcf; exportgraphics(f,'Figure_7.png');
 %figure(3); set(gcf,'color','w'); f = gcf; exportgraphics(f,'Figure_8_ERD.png');
 %
 
 %% Average simulation time:
-% manually disable figures first
-T=zeros(1,100);
+%
+% IMPORTANT: manually comment out line: 116<->117 in "SIM_0_data"
+%
+T=zeros(1,100); 
 for i=1:length(T)
-[Sim_3b_output1, Sim_3b_output2, time]=fun_1(1,.32,'sol',1e6,1e-6);
+[Output1, Output2, time]=fun_1(1,0,'sol',1e4,1e-4);
 T(i)=time;
 end
-mean(T)
-%5.9319
+mean(T) %= 0.9600
+%
 
 %% Optimisation-1(blue)
 c1=datetime("now");
diff --git a/fun_1.m b/fun_1.m
index 0967258..406a9d2 100644
--- a/fun_1.m
+++ b/fun_1.m
@@ -1,4 +1,4 @@
-function [output1, output2, output3] = fun(input,option_data,obj,option_mesh,option_BVP)
+function [output1, output2, output3] = fun_1(input,option_data,obj,option_mesh,option_BVP)
 %%  fun   Solves BVP for SWRO-PRO hybrid system using bvp5c
 %
 %       fun(input,option_data,obj,option_mesh,option_BVP) will solve the
@@ -29,6 +29,10 @@ function [output1, output2, output3] = fun(input,option_data,obj,option_mesh,opt
 tic;
 %% Read data
 if option_data == 0; DATA = @(x)Sim_0_data(input); end
+
+
+
+
 % Simulations
 if option_data == 0.11; DATA = @(x)Sim_11_data(input); end
 if option_data == 0.12; DATA = @(x)Sim_12_data(input); end
-- 
GitLab