Code covered by the BSD License  

Highlights from
GTL jetfuel_ternplot with neural network

image thumbnail

GTL jetfuel_ternplot with neural network

by

 

This is an upgrade of the ternplot code written by Carl Sandrock (ID#2299).

main_2D.m
%%
optional = [...
0.00	24.94	75.07
0.00	49.87	50.13
33.33	33.25	33.42
20.00	19.95	60.05
10.00	29.92	60.08
0.00	74.81	25.20
20.00	59.84	20.16
42.00	41.89	16.11
60.00	29.92	10.08
66.00	16.96	17.04
75.00	0.00	25.00
60.00	14.96	25.04
42.00	15.96	42.04
50.00	0.00	50.00
30.00	9.97	60.03
25.00	0.00	75.00
17.00	41.89	41.11
11.00	63.83	25.17
49.00	49.87	1.13
74.00	24.94	1.07
100.00	0.00	0.00
0.00	100.00	0.00
0.00	0.00	100.00
5.00	89.77	5.23
5.00	84.78	10.22
10.00	84.78	5.22
10.00	79.79	10.21
5.00	4.99	90.01
10.00	4.99	85.01
5.00	9.97	85.03
10.00	9.97	80.03
90.00	4.99	5.01
85.00	4.99	10.01
85.00	9.97	5.03
80.00	9.97	10.03
];
%% Three D plot for freezing point of n-Paraffin,  Cyclo Paraffin and iso-Paraffin blends
int(sym('k'));
syms('Density','HeatContent','FlashPoint','FreezingPoint')
experimental = [...
33.33	33.42		33.24666667
20      60.052		19.948
10      60.078		29.922
0       25.195		74.805
20      20.156		59.844
42      16.1092		41.8908
60      10.078		29.922
66      17.0442		16.9558
75      25          0
60      25.039		14.961
42      42.0416		15.9584
50      50          0
30      60.026		9.974
25      75          0
17      41.1092		41.8908
11      25.1664		63.8336
49      1.13		49.87
74      1.065		24.935
100     0           0
0       0           100
0       100         0
5       5.234		89.766
5       10.221		84.779
10      5.221		84.779
10      10.208		79.792
5       90.013		4.987
10      85.013		4.987
5       85.026		9.974
10      80.026		9.974
90      5.013		4.987
85      10.013		4.987
85      5.026		9.974
80      10.026		9.974
5.4     80.01716	6.58284
20.475	50.065065	24.959935
35.55	20.11297	43.33703
13.5	70.0429		16.4571
18      60.0572		21.9428
20.25	55.06435	24.68565
22.5	50.0715		27.4285
24.75	45.07865	30.17135
27      40.0858		32.9142
31.5	30.1001		38.3999
17.55	60.05577	21.39423
12.15	70.03861	14.81139
21.15	50.06721	25.78279
30.15	30.09581	36.75419
15.75	60.05005	19.19995
24.75	40.07865	30.17135
];
data=[...
0.79363	43.50826667	55.52	-37.2
0.8281	43.08768	57.1	-51.6
0.8301	43.07376	57.38	-75
0.7949	43.3257		58.68	-75
0.7763	43.6587		57.6	-46.1
0.77	43.77322	55.62	-34.4
0.75773	43.8613		54.56	-29.25
0.765	43.7994		54.32	-31.375
0.7724	43.51204	55.3833	-25.2
0.77653	43.66516	55.08	-33.7
0.802	43.3903		55.36	-36.8333
0.80907	43.27953333	55.08	-30
0.82727	43.12838	56.04	-41.1
0.8461	42.90373333	56.44	-48.4
0.8079	43.3548		58.42	-49.9
0.78968	43.55442	59.48	-57.3
0.74954	44.01798	56.633	-31.16666667
0.7427	44.01454	55.08	-25.3
0.7346	44.24		46      -30
0.7613	43.8		61      -77
0.8834	42.70536	57      -43
0.767	43.93527963	60.84	-75
0.773	43.79218547	61.38	-75
0.7654	43.9243864	59.26	-56.2
0.7715	43.8065323	58.7	-54.6
0.8703	42.67924848	59.02	-75
0.8628	42.82848717	59.46	-42.7
0.864	42.78413719	59.74	-75
0.8569	42.82101876	58.28	-50.8
0.7435	44.00884131	54.34	-26.6
0.751	43.9582029	54.54	-29.1
0.7447	44.0252603	54.5	-26.6
0.7523	43.92183937	54.82	-27.7
0.8658	42.72069168	35.28	-75
0.822	43.28857864	37.9	-47.9
0.7778	43.98524171	51.9	-34.1
0.844	43.31042266	59.74	-44.3
0.8307	43.42990283	57.44	-48.7
0.824	43.44324236	57.42	-46.9
0.8174	43.54915276	56.88	-45.2
0.8105	43.66346692	55.8	-43.6
0.804	43.69292325	57.76	-38
0.7902	43.8535876	58.28	-37.2
0.8313	43.40388571	54.18	-46.3
0.8471	43.14289428	48.16	-43.7
0.8206	43.414117	47.1	-41.6
0.7935	43.74176291	46.44	-36
0.836	43.16145738	41.02	-45.3
0.809	43.45547386	41.5	-40.8
];

k=1;
A = (experimental(:, 1)')/100;
B = (experimental(:, 2)')/100;
C = (experimental(:, 3)')/100;

max=[0.840,45.5544,63.4,-40];
min=[0.775,43,50,-76];
[a,b]=size(data);
m = zeros(a,b);
n=m;
for i=1:1:b
    for j=1:1:a
        m(j,i)=data(j,i)>min(1,i);
        n(j,i)=data(j,i)<max(1,i);
    end
end

opt=data.*(m.*n);
trn = experimental;

p=1;
d=1;
while p<=d
    if sum(opt(p,:))==0
        opt(p,:)=[];
        trn(p,:)=[];
        [d e]=size(opt);
        p=1;
    else p=p+1;
    end
end

D = trn(:, 1)';
E = trn(:, 2)';
F = trn(:, 3)';

nam={'Density','Heat Content','Flash Point','Freezing Point'};

while k <= 4
    figure
    subplot(2, 2, 1)
    ternplot(A, B, C, '.'); ternlabel('iso-para', 'n-para', 'cyclo-para', nam(1,k));
    subplot(2, 2, 2)
    terncontour(A, B, C, data(:,k)); ternlabel('iso-para', 'n-para', 'cyclo-para', nam(1,k));
    subplot(2, 2, 3)
    ternpcolor(A, B, C, data(:,k)); ternlabel('iso-para', 'n-para', 'cyclo-para', nam(1,k));
    shading interp
    k=k+1;
end

k=1;
while k <= 4
    figure
    ternpcolor(A, B, C, data(:,k)); ternlabel('iso-para', 'n-para', 'cyclo-para', nam(1,k));
    shading interp
    h = axes('Position', [0.179 0.11 0.8 0.785], 'Layer','bottom'); 
    terncontour(D, E, F, opt(:,k)); 
    shading interp
    axis(h, 'off', 'equal', 'tight');
    colorbar;
    k=k+1;
end

figure
ternpcolor(D, E, F, opt); 
hold on
ternplot(D, E, F, '*');
shading interp
hold on
terncontour(D, E, F, opt); ternlabel('np', 'ip', 'cp', 'optimize plot');
hold off
colorbar;
%hcb=colorbar('YTickLabel',{'�C','g/mL','MJ/Kg'});
%set(hcb,'YTickMode','manual')


k=1;
figure
while k <= 4
    ternpcolor(D, E, F, opt(:,k)); ternlabel('iso-para', 'n-para', 'cyclo-para', 'Optimized Plot');
    shading interp
    hold on
    ternplot(D, E, F, '*'); ternlabel('iso-para', 'n-para', 'cyclo-para', 'Optimized Plot');
    shading interp
    hold on
    terncontour(D, E, F, opt(:,k)); ternlabel('iso-para', 'n-para', 'cyclo-para', 'Optimized Plot');
    shading interp
    hold on
    k=k+1;
end
figure
ternpcolor(D, E, F, opt);
shading interp;
hold on;
ternplot(D, E, F, '*');
shading interp;
hold off;
h = axes('Position', [0.179 0.11 0.8 0.785], 'Layer','bottom'); 
terncontour(D, E, F, opt); 
shading interp;
ternlabel('iso-para', 'n-para', 'cyclo-para', 'Optimized Plot');
axis(h, 'off', 'equal', 'tight');
colorbar;

figure
[d e]=size(opt);
out=reshape(opt,(d*e),1);
terncontour([D,D,D], [E,E,E], [F,F,F], out'); ternlabel('iso-para', 'n-para', 'cyclo-para', 'Optimized Plot');
colorbar;

Contact us