oI started working on the gauge and I think this seemed a lot more difficult than it is. It is still a in progress project but my goal was to make a gauge in python that will operate on live info(5-10 second intervals) on electricity info. I started with the plotly library. This library wasn't very clear when I went through the documentation. Me being a PyCharm professional user spend about an hour trying to figure out why I cant run any of the demo programs that were demoed on the documentation. I took me a while but then I found out that all those commands are made specially for ipython notebook and then I found another section for users of other ide's. Learning this I went forward and found a Gauge template after making a few changes to this template and playing around I think I had the grasp of the library. So for the library you wrote all your code in libraries and it made the graphical interface by converting your code to html and made an html file that you could open in you browser. After this I had a though on how I would be updating this html file. Me never having worked with html was not sure how but after spending some time on w3school I learnt a command with which I can make the html page force refresh it self every 5 seconds and when it refreshes the html page would have the new live data. I implemented this command after plotly produced the html file. Python would open it delete the first line and then retype it with the command to refresh every 5 seconds(update-I am still in the process of writing this blog but I just came across something called ajax that might be worth giving a look at in the next blog). Next I started working on moving the pointer of the gauge. I learnt about this my learning of the command M for move, L for line to, and Z to end. This is how the shape would be made in css and html and if I got python to update the html file every 5 seconds by changing the location or coordinates of the pointer it would update on the webpage to have a moving pointer. After learning that I went on to figure how what value would correspond to how much movement. To do this I tried breaking it between percentage and the coordinates on the circle. This took a look of math(geometry, trignometry, and algebra). I figured out how to scale percent to how much this meant on the scale by doing the math on paper. I am yet to write the algorithm for this on python. When I do I will blog about it and hopefully by success with AJAX. I believe I may use the math library SymPy to simplify my work.
_____________________________________________________________________
0 Comments
Leave a Reply. |
AuthorHi! My name is Ayush Zenith! I am currently a senior at Andover High School. I have been part of the Energize Andover Program since June, 2017 (8th grade). I have since been working on improving my knowledge in programming and working on writing better applications in order to save and conserve resources in buildings... Archives
November 2020
Categories |