# Display Motor Current Variance

**URL:** <https://forum.inductiveautomation.com/t/display-motor-current-variance/47684>\
**Category:** Ignition\
**Created:** [June 11, 2021, 9:36am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684 "2021-06-11T09:36:37Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adriaan.leRoux](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adriaan.leRoux](https://forum.inductiveautomation.com/u/Adriaan.leRoux)\
**Post date:** [June 11, 2021, 9:36am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/1 "2021-06-11T09:36:37Z")

</div>

What would be the best way to display motor current variance?

I would like to make some sort of display that would show if a motor is running smoothly or not. But I do not want to use a TimeSeries chart. I want something that is easy to read by the artisans.

Is this where a box plot would be useful, or is there a better way? This is kind of reaching into statistics which is not my strong suite

Any ideas?

---

<div class="post-metadata">

**Author:** ![Adriaan.leRoux](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adriaan.leRoux](https://forum.inductiveautomation.com/u/Adriaan.leRoux)\
**Post date:** [June 11, 2021, 10:12am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/2 "2021-06-11T10:12:13Z")

</div>

What I think would be a good idea is to have a graph that shows the amount of times a certain value appears in a certain amount of time and display that

So the Y axis would be the amount of times this value appears and the X axis would be the values

Imagine a scatter plot over time, each dot would be a marble on a track, now if you tilt this track all the marbles would run to the one side, that is the graph I would like to display.

But I don’t know the terms or name of this chart… Is this a heatmap line graph?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 11, 2021, 11:13am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/3 "2021-06-11T11:13:24Z")

</div>

That would be a histogram.

---

<div class="post-metadata">

**Author:** ![Adriaan.leRoux](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adriaan.leRoux](https://forum.inductiveautomation.com/u/Adriaan.leRoux)\
**Post date:** [June 11, 2021, 11:19am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/4 "2021-06-11T11:19:07Z")

</div>

🤦‍♂️  
…Thanks… I got lost in a wormhole there… There is no built in way of doing this right? You create your data using scripting, correct?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 11, 2021, 11:21am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/5 "2021-06-11T11:21:46Z")

</div>

> [@Statistics Extensions for Ignition](http://forum.inductiveautomation.com/t/statistics-extensions-for-ignition/17100):
>
> After discussions elsewhere with @Brian on the forum, I’ve ported the statsutils library from [http://boltons.readthedocs.io](http://boltons.readthedocs.io) some changes from the originaL Removed the format\_histogram functions, as they were using unsupported string formatting. Maybe when Ignitions’s Jython gets upgraded, I can look at it again. Renamed remaining histogram function to histogram. Brevity is good. Added ‘raw’ flag to histogram function to give a one-dimensional list with repeat histogram values, instead…

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 11, 2021, 11:23am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/6 "2021-06-11T11:23:09Z")

</div>

Still a bit of scripting involved, but statsutils should help make it less painful.

---

<div class="post-metadata">

**Author:** ![Adriaan.leRoux](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adriaan.leRoux](https://forum.inductiveautomation.com/u/Adriaan.leRoux)\
**Post date:** [June 12, 2021, 10:33am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/7 "2021-06-12T10:33:08Z")

</div>

I actually enjoy the scripting part a lot, so that’s not an issue.

So I have developed code that does this, but I have a question if you don’t mind

Currently this is a script running on a view, now the way I see it there are three ways of doing this

1. script the view, so it runs on the session, and if I understand this correctly it means that the information will be processed mostly at the browser side, so each browser does the same calculation

2. script this at the gateway and store this information in a tag, then the browser simply grabs the data and displays it

3. script this in SQL and have the gateway pull this info into a tag, so SQL does the processing and the gateway collects and and distributes this data

Will I see big performance differences between the 3? And which would be the most optimal / optimised way of doing this? Do I let SQL do the brunt of the work and “spare” the gateway? Is it fine for each instance tondo this calculation?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 12, 2021, 10:46am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/8 "2021-06-12T10:46:24Z")

</div>

All scripting execution happens on the gateway when using Perspective. So part of option 1 is moot. However, every client would still be hitting up the db for information with multiple requests to the gateway for the same information.

If the same information to be displayed, then I would script it and stick it in a tag. If you use a gateway event script, you could put it on its own dedicated thread. Depends how critical the script needs to be. Doing it as a gateway script or as a stored procedure or view in the db I think seems to be more a matter of preference.

---

<div class="post-metadata">

**Author:** ![Adriaan.leRoux](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adriaan.leRoux](https://forum.inductiveautomation.com/u/Adriaan.leRoux)\
**Post date:** [June 12, 2021, 10:49am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/9 "2021-06-12T10:49:48Z")

</div>

Thank you very much! So permance wise it is either SQL or a gateway script, with no serious difference in performance either way

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 12, 2021, 10:52am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/10 "2021-06-12T10:52:07Z")

</div>

Nothing noticeable to me, however, others may chime in depending on the scope of their projects. I’m in an assembly plant, so my data is more event driven.

---

<div class="post-metadata">

**Author:** ![Adriaan.leRoux](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adriaan.leRoux](https://forum.inductiveautomation.com/u/Adriaan.leRoux)\
**Post date:** [June 12, 2021, 11:08am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/11 "2021-06-12T11:08:50Z")

</div>

I appreciate the help, I am in a bakery, so I deal with continuous processes, I’ll see what I can do

---

<div class="post-metadata">

**Author:** ![Adriaan.leRoux](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adriaan.leRoux](https://forum.inductiveautomation.com/u/Adriaan.leRoux)\
**Post date:** [June 12, 2021, 11:12am UTC](https://forum.inductiveautomation.com/t/display-motor-current-variance/47684/12 "2021-06-12T11:12:49Z")

</div>

I do recall @pturmel saying something about “letting SQL do the brunt work”
