Minor changes to process_experiment
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Mon, 20 May 2024 14:10:25 +0000 (16:10 +0200)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Mon, 20 May 2024 14:10:25 +0000 (16:10 +0200)
This function was quite high level so it only needed minor changes.
It now calculates the "start" pressure - the pressure after opening
the valve (which marks start of the sorption experiment cycle).

process_experiment.m

index 74cfc5a502a6606906723ac18d81ecd053603a0f..ac94b5e6d016b0b984688a06ab83d818018c6355 100644 (file)
@@ -1,13 +1,11 @@
-function [p_eq n] = process_experiment(t, p, V1, V2, Vvz, p_up = 0, T = 298, graph = 1, threshold = 0.05)
+function [p_eq n] = process_experiment(t, p, V1, V2, Vvz, T = 298, graph = 1, threshold = 0.01)
        R = 8.314;
-       [p_eq, p_ao] = get_important_pressure(t, p, graph, threshold);
-       if (p_up != 0)
-               p_ao = (p_up(find(detect_open(t, p, threshold) == 1) - 1) * V1 + p_eq(1:(end - 1)) .* (V2 - Vvz)) / (V1 + V2 - Vvz);
-       end
-       delta_n = (p_ao - p_eq(2:end)) .* (V1 + V2 - Vvz) / R / T;
-       n = cumsum(delta_n);
+       [p_eq, p_fill] = get_important_pressure(t, p, graph, threshold);
+       p_start = (p_eq(1:(end - 1)) * (V2 - Vvz) + p_fill * V1) / (V1 + V2 - Vvz);
+       delta_n = (p_start - p_eq(2:end)) .* (V1 + V2 - Vvz) / R / T;
+       n = [0 cumsum(delta_n)];
        if (graph)
                figure();
-               plot(p_eq, [0 n], "-o");
+               plot(p_eq, n, "-o");
        end
 end