Thanks to reading the link Plotting a sequence of images as a gif
using FileIO, ImageMagick
using PyCall
pyimport("sys").executable
@pyimport CoolProp.CoolProp as CP
@pyimport CoolProp.Plots as CPP #StateContainer
TT = [[55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55];
[33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49]]
n=size(TT,2)
file=""
i=1
for i in 1:n
pp = CPP.PropertyPlot("R32", "PH", unit_system="KSI")
pp.title("R32 log p-h Diagramm")
pp.set_axis_limits([-40, 700, 0, 15000])
pp.xlabel("h [kJ/kg]")
pp.ylabel("P [kPa]")
pp.calc_isolines(num=20)
cycle = CPP.SimpleCompressionCycle("R32", "PH", unit_system="KSI")
T0 = TT[2,i]+273.15
pp.state.update(CP.QT_INPUTS,0.0,T0-0.02)
p0 = pp.state.keyed_output(CP.iP)
T2 = TT[1,i]+273.15
pp.state.update(CP.QT_INPUTS,1.0,T2+0.02)
p2 = pp.state.keyed_output(CP.iP)
pp.calc_isolines(CP.iT, [T0-273.15,T2-273.15], num=2)
cycle.simple_solve(T0, p0, T2, p2, 0.7, SI=true)
cycle.steps =50
sc = cycle.get_state_changes()
pp.draw_process(sc)
@pyimport matplotlib.pyplot as plt
plt.close(cycle.figure)
#pp.show()
ss=string("C:/Users/hermesr/Documents/R32_",i,".jpg")
pp.savefig(ss)
end
A = load("C:/Users/hermesr/Documents/R32_1.jpg");
for i in 2:n
A = cat(A, load("C:/Users/hermesr/Documents/R32_"*string(i)*".jpg"), dims=3)
end
save("C:/Users/hermesr/Documents/test.gif", A)