Hi,
I have a set of data as results of running an MPC on a plant. I Can plot them with different backends but all of them are kind of static and I want to have the plot somehow animated in a way that all the values send to the figure as time goes. (Something like the process control diagrams!)
Here is the figure:
and the values of each vector :
https://github.com/Amirrezz94/LivePlot/blob/main/Static_Plot.jl
x1plot = [1.0, 0.9795959216465395, 1.0368036842462345, 1.2028438837092144, 1.468154989063687, 1.484055235892751, 1.4938946862488587, 1.5005513093323886, 1.504091565137907, 1.5062191301896122, 1.50723308388958, 1.507288731512581, 1.5067513329370403, 1.506009529188478, 1.5053144502810871, 1.5047608686366774, 1.5043505278278517, 1.5057681395074252, 1.5156671360318288, 1.4642357050787553, 1.328804302180349, 1.0994915852159097, 0.9616308274087315, 0.8994648628690904, 0.9083554901326204, 0.9981247006970843, 1.0197780221873798, 0.9955365828440463, 0.9938023332828294, 0.9950418390760862, 0.9951649572666283, 0.9951022163498978, 0.9950946305781759, 0.9950981963153389, 0.9950990007360584, 0.9950990795213179, 0.9950992378569707, 1.017119253453507, 0.957454099894261, 0.8220053221516276, 0.6400249624344633, 0.4519672717479262, 0.29049728630763155, 0.17067123187614328, 0.09198737853508454, 0.04560067948020436, 0.022116845848733656, 0.01066739270183293, 0.00513727052766951, 0.0024728901525444755, 0.0011901674984636005, 0.0005727760769532625, 0.0002756455188223564, 0.00013265169483293524, 6.383714169286266e-5, 3.0720931890655257e-5, 1.47841693781098e-5, 7.114772386469779e-6, 3.4239331958835335e-6, 1.6477449910767394e-6, 7.92967491473073e-7];
x2plot = [1.0, 1.1693204393002945, 1.092348952598085, 0.7101275515881297, 0.059399916226932845, 0.04626029495172327, 0.0455645813677555, 0.05284801420497194, 0.06931472268326216, 0.08946798593694463, 0.111103323272987, 0.13279527936302252, 0.15308832420130622, 0.17089644183709943, 0.1857698655190422, 0.19780191656641646, 0.2073667092747314, 0.21056967565908466, 0.19095091608794906, 0.3245020337524915, 0.6676689357816971, 1.2446599825306528, 1.5913352595002264, 1.7478891261196652, 1.7263028276423635, 1.5022143287369396, 1.448543253111473, 1.5095953112706582, 1.5142498608900314, 1.5114019397524534, 1.5112953709451284, 1.5116128060023797, 1.511759769797567, 1.5118529098034357, 1.5119322735019494, 1.5119969618348428, 1.5120483033301813, 1.4570361560651433, 1.606240249114801, 1.9449003463387, 2.399882311033357, 2.870049148014794, 3.2737389590659807, 3.5733129431347157, 3.7700273801428463, 3.88599651018131, 3.9447071318613185, 3.9733312027059133, 3.9871566916880687, 3.9938177194186366, 3.997024558170196, 3.9985680501545593, 3.999310882166257, 3.9996683690748642, 3.999840406439859, 3.999923197375075, 3.9999630394531067, 3.9999822130174096, 3.999991440145422, 3.9999958806284943, 3.9999980175774956];
Uplot = [0.35, 0.2699999904313764, 0.18999998137291352, 0.10999997448230449, 0.04539907071366808, 0.10367493085978326, 0.10327709091917717, 0.11529761190958211, 0.13848012688673858, 0.16185464485723203, 0.1823727925585447, 0.199304874045882, 0.2125036846273396, 0.22231517077252533, 0.2294010077774763, 0.2344771419222313, 0.23813775565051726, 0.23883749715155914, 0.22949800193603898, 0.28783159313172274, 0.36783149492996836, 0.44537053780033853, 0.36537053193355845, 0.28537052759173054, 0.2053705232764413, 0.12682792765066467, 0.20682787416365098, 0.25222064781513504, 0.22817736352312346, 0.22513677268342214, 0.2263371884222026, 0.2265187995313641, 0.22645134679156112, 0.2264339495713379, 0.22643229251475103, 0.22642931830598687, 0.2264262544501991, 0.20592615433278016, 0.28592616022836725, 0.3659261687059535, 0.4459261770956456, 0.5259261863232586, 0.6059261902808774, 0.6859261798293037, 0.7659260975790092, 0.8459205735152734, 0.8658449896428112, 0.8704684890936347, 0.8715378898346539, 0.8717852584175038, 0.8718401315333874, 0.8718508114094117, 0.8718512565991956, 0.8718493319885355, 0.8718468595187957, 0.8718442621650363, 0.8718416399998976, 0.871839020508764, 0.8718364186698746, 0.8718338545014419, 0.8718313621014645];
SetPoint = [1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 1.5032 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.9951 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
t_plot = [0, 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, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60];
using Plots
NFE_sim = 60;
plotlyjs()
p11 = plot( t_plot,[x1plot[nIter] for nIter in 1:NFE_sim+1], label=“x1”)
p11 = plot!(t_plot,[x2plot[nIter] for nIter in 1:NFE_sim+1], label=“x2”)
p11 = plot!(t_plot, xₛₚ[1:NFE_sim + 1], label=“y_sp”, linetype=:steppost, linestyle=:dash)
p12 = plot(t_plot[1:end], [Uplot[nIter] for nIter in 1:NFE_sim+1], label=“u”, linetype=:steppost)
fig1 = plot(p11, p12, layout=(2, 1));
display(fig1)
savefig(fig1,“file.eps”)
Is there any solution to this??
Thank you all in advance!Preformatted text