Retrieve last 12 hours of data
-
Hi @phildunlap
Thanks!
Is ma-point-values the best way to get all this data to show on a chart? We are using ma-point-values to retrieve 12 hours of values for 12 or so points, and it really feels like it is slowing down the entire page significantly
-
@rshah said in Retrieve last 12 hours of data:
Is ma-point-values the best way to get all this data to show on a chart? We are using ma-point-values to retrieve 12 hours of values for 12 or so points, and it really feels like it is slowing down the entire page significantly
How often are you retrieving point values? If you have a timer (ma-now) and are updating the query for point values too regularly you will definitely cause the system to bog down.
-
@jared-wiltshire said in Retrieve last 12 hours of data:
How often are you retrieving point values? If you have a timer (ma-now) and are updating the query for point values too regularly you will definitely cause the system to bog down.
Jared, we are retrieving once per minute.
Am I correct in this assumption:
Calling ma-point-values fetches all 12 hours (for example) of data every single time you call it?
Or, does it only fetch the latest data?If the former, is there a better way of doing this? I can probably create an array and call ma-get-point to get the latest point and push to the array rather than getting 12 hours worth of data every minute for 8+ points.
Thanks!
-
@rshah said in Retrieve last 12 hours of data:
Calling ma-point-values fetches all 12 hours (for example) of data every single time you call it?
Correct. Although saying "calling" is a little confusing, its not a function, its an Angular component. It will fetch all 12 hours when its attributes change (e.g. when the time period changes).
@rshah said in Retrieve last 12 hours of data:
ma-get-point to get the latest point and push to the array
Are you talking about point values rather than points?
This is essentially what the
<ma-point-values>
component does if you set thelatest="x"
attribute.Are you sure that you don't have some other error in your console (e.g. infinite digest error) which could be causing the page to bog down?
-
@jared-wiltshire said in Retrieve last 12 hours of data:
Are you sure that you don't have some other error in your console (e.g. infinite digest error) which could be causing the page to bog down?
Hi, yes no error.
How would we use latest if we wanted 12 hours worth of data (point values) for ma-serial-chart?
I thought about using
latest
initially but as there is only a way to limit the scope of latest via NUMBER of points rather than time-duration, I moved away from it.My end goal is to populate ma-serial-chart with 12 hours of point values for multiple datapoints. I can send you the code I am using to do that now if it would help.
-
@rshah said in Retrieve last 12 hours of data:
How would we use latest if we wanted 12 hours worth of data (point values) for ma-serial-chart?
You would have to know the sample/poll period of the data points.
@rshah said in Retrieve last 12 hours of data:
My end goal is to populate ma-serial-chart with 12 hours of point values for multiple datapoints. I can send you the code I am using to do that now if it would help.
What rollup are you using? Have you opened your chrome developer tools and checked the network requests that are going out? Check they aren't occurring more frequently than you intended and that they aren't taking too long to complete.
You can post up your code if you would like, sure.
-
Here's how I would accomplish what you are doing:
<ma-watch-list-get ng-model="designer.watchList" parameters="designer.parameters" on-points-change="designer.points = $points" id="d01a1ce8-d4d7-43b3-831c-9c619fb4bace" watch-list-xid="WL_ac76beaa-10f4-40f0-b714-d0fda1c1e801"></ma-watch-list-get> <div class="ma-designer-root" id="4a3435f4-e428-4ee2-8ba8-1cf4511aa999" style="width: 1366px; height: 768px; position: relative;"> <ma-point-values id="5a8730ae-18bc-443c-8bad-e9ef83ccf104" points="designer.points" rollup-interval="15 minutes" rollup="FIRST" to="designer.time" from="designer.time | maMoment:'subtract':12:'hours'" style="position: absolute; left: 27px; top: 0px;" values="designer.values"></ma-point-values> <ma-serial-chart id="2796c91b-75b7-4759-9228-60d2e840b90f" style="position: absolute; width: 854px; height: 541px; left: 29px; top: 93px;" points="designer.points" values="designer.values" legend="true"></ma-serial-chart> <ma-now id="2269ccdd-6d99-4732-81a4-3d607e73dbb8" style="position: absolute; left: 210px; top: 0px;" update-interval="1 minute" output="designer.time"></ma-now> </div>
-
Here is what we are doing now -- I am not very familiar with Angular, my experience is largely with React -- can you advise if this is a bad way to do this?
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>Boiler 2 Screen</title> <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1"> <link rel="stylesheet" href="/modules/mangoUI/web/vendor/angular/angular-csp.css"></link> <link rel="stylesheet" href="/modules/mangoUI/web/vendor/angular-material/angular-material.css"> <link rel="stylesheet" href="/modules/mangoUI/web/vendor/material-design-icons/iconfont/material-icons.css"> <link rel="stylesheet" href="/modules/mangoUI/web/vendor/md-pickers/mdPickers.css"> </head> <body layout="column"> <!-- We only want to obtain last 12 hours of data, so use Angular Moment Library to do figure out what last 12 hours are--> <ma-now update-interval="1 minutes" output="to"></ma-now> <ma-calc input="to | maMoment:'subtract':12:'hours'" output="from"></ma-calc> <!-- Obtain 12 hours of point values based on point XID, average them per minute store them in an array (object) (param = values) --> <!-- Boiler DHW information --> <!-- Member 1 Information (DHW Mode only) --> <ma-point-values point-xid="member1DhwTankTemp" rendered="true" values="m1TankValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="DP_member1FiringRateDHW" rendered="true" values="m1FireDHWValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="member1OutletTemp" rendered="true" values="m1OutletTempValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <!-- Member 3 Information (DHW Mode only) --> <ma-point-values point-xid="member3DhwTankTemp" rendered="true" values="m3TankValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="DP_member3FiringRateDHW" rendered="true" values="m3FireDHWValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="member3OutletTemp" rendered="true" values="m3OutletTempValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <!-- DHW Flow Data --> <ma-point-values point-xid="DHWSupplyRate" rendered="true" values="dhwSupplyRateValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="DHW11ReturnRate" rendered="true" values="dhw11SupplyRateValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="DP_DhwConsumedRate" rendered="true" values="dhwConsumedRateValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="IoM322DHWBsmntReturnTemp" rendered="true" values="returnBasementTemperatureValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="IoM3DHWSupTemp" rendered="true" values="DHW22SupplyTemperatureValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="IoM322DHW11ReturnTemp" rendered="true" values="return11TemperatureValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-point-values point-xid="DHWBsmntReturnRate" rendered="true" values="basementReturnRateValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <!-- Displays only if the app is still loading --> <div ng-if="appLoading"> <span>App is loading..</span> </div> <!-- Actual content of page once loaded --> <div ng-cloak layout="column" flex> <h3 class="centerText">DHW Tanks and Boilers</h3> <div layout="row"> <md-card flex="75"> <md-card-content layout="column"> <ma-serial-chart style="height: 490px; width: 100%" series-1-values="m1FireDHWValues" series-1-title="Member 1 DHW Firing Rate" series-1-color="red" series-1-axis="left" series-1-type="smoothedLine" series-2-values="m3FireDHWValues" series-2-title="Member 3 DHW Firing Rate" series-2-color="green" series-2-axis="left" series-2-type="smoothedLine" series-3-values="m1TankValues" series-3-title="Member 1 Tank Temp" series-3-color="blue" series-3-axis="right" series-3-type="smoothedLine" series-4-values="m3TankValues" series-4-title="Member 3 Tank Temp" series-4-color="yellow" series-4-axis="right" series-4-type="smoothedLine" legend="true" options="{ valueAxes:[ { axisColor:'white', color:'white', title: 'Firing Rate (%)', titleColor: 'white', fontSize:26, titleFontSize:26, minimum:0, maximum:100 }, { axisColor:'white', color:'white', title: 'Temperature (ºF)', titleColor: 'white', fontSize:26, titleFontSize:26, minimum:0, maximum:180 } ] }"> </ma-serial-chart> </md-card-content> </md-card> <md-card flex="25"> <md-card-content layout="column"> <div layout="row"> <md-card flex="50"> <md-card-title> <md-card-title-text> Member 1 Firing Rate (DHW) </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{m1FireDHWValues[m1FireDHWValues.length - 1].rendered}}</h4> </md-card-content> </md-card> <md-card flex="50"> <md-card-title> <md-card-title-text> Member 3 Firing Rate (DHW) </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{m3FireDHWValues[m3FireDHWValues.length - 1].rendered}}</h4> </md-card-content> </md-card> </div> <div layout="row"> <md-card flex="50"> <md-card-title> <md-card-title-text> Member 1 DHW Outlet Temp </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{m1OutletTempValues[m1OutletTempValues.length - 1].rendered}}</h4> </md-card-content> </md-card> <md-card flex="50"> <md-card-title> <md-card-title-text> Member 3 DHW Outlet Temp </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{m3OutletTempValues[m3OutletTempValues.length - 1].rendered}}</h4> </md-card-content> </md-card> </div> <div layout="row"> <md-card flex="50"> <md-card-title> <md-card-title-text> Member 1 DHW Tank Temperature </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{m1TankValues[m1TankValues.length - 1].rendered}}</h4> </md-card-content> </md-card> <md-card flex="50"> <md-card-title> <md-card-title-text> Member 3 DHW Tank Temperature </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{m3TankValues[m3TankValues.length - 1].rendered}}</h4> </md-card-content> </md-card> </div> </md-card-content> </md-card> </div> <h3 class="centerText">DHW Flow and Temperature</h3> <div layout="row"> <md-card flex="75"> <md-card-content layout="column"> <ma-serial-chart style="height: 490px; width: 100%" series-1-values="dhwSupplyRateValues" series-1-title="DHW Supply Rate" series-1-color="red" series-1-axis="left" series-1-type="smoothedLine" series-2-values="dhwConsumedRateValues" series-2-title="DHW Consumed Rate" series-2-color="green" series-2-axis="left" series-2-type="smoothedLine" series-3-values="DHW22SupplyTemperatureValues" series-3-title="DHW Supply Temperature" series-3-color="blue" series-3-axis="right" series-3-type="smoothedLine" legend="true" options="{ valueAxes:[ { axisColor:'black', color:'black', title: 'Flow Rate (Gal / Min)', titleColor: 'black', fontSize:26, titleFontSize:26, minimum:0, maximum:100 }, { axisColor:'black', color:'black', title: 'Temperature (ºF)', titleColor: 'black', fontSize:26, titleFontSize:26, minimum:0, maximum:180 } ] }"> </ma-serial-chart> </md-card-content> </md-card> <md-card flex="25"> <md-card-content layout="column"> <div layout="row"> <md-card flex="50"> <md-card-title> <md-card-title-text> DHW Supply Flow Rate </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{dhwSupplyRateValues[dhwSupplyRateValues.length - 1].rendered}}</h4> </md-card-content> </md-card> <md-card flex="50"> <md-card-title> <md-card-title-text> 22 DHW Supply Temperature </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{DHW22SupplyTemperatureValues[DHW22SupplyTemperatureValues.length - 1].rendered}}</h4> </md-card-content> </md-card> </div> <div layout="row"> <md-card flex="50"> <md-card-title> <md-card-title-text> 11th Flr DHW Return Flow Rate </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{dhw11SupplyRateValues[dhw11SupplyRateValues.length - 1].rendered}}</h4> </md-card-content> </md-card> <md-card flex="50"> <md-card-title> <md-card-title-text> 22 DHW Bsmt Return Temperature </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{returnBasementTemperatureValues[returnBasementTemperatureValues.length - 1].rendered}}</h4> </md-card-content> </md-card> </div> <div layout="row"> <md-card flex="50"> <md-card-title> <md-card-title-text> DHW Consumed Flow Rate </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{dhwConsumedRateValues[dhwConsumedRateValues.length - 1].rendered}}</h4> </md-card-content> </md-card> <md-card flex="50"> <md-card-title> <md-card-title-text> 22 DHW 11th Flr Return Temp </md-card-title-text> </md-card-title> <md-card-content layout="column"> <h4 id="testing">{{return11TemperatureValues[return11TemperatureValues.length - 1].rendered}}</h4> </md-card-content> </md-card> </div> </md-card-content> </md-card> </div> </div> <script src="/modules/mangoUI/web/vendor/requirejs/require.js"></script> <script src="/modules/mangoUI/web/loaderConfig.js"></script> <script>require(['ngMango/bootstrap']);</script> </body> </html>
-
@rshah two things
a) I would strongly suggest moving your page into a custom / dashboard designer page inside the UI module. I can tell you that the above page will break upon installation of Mango 3.4
To make the page full screen / no menu and toolbar, see here - https://forum.infiniteautomation.com/topic/3297/deploying-custom-page/3b) Don't get every point and its values individually. Use a watch list as I posted above. You can use multiple watch lists if you want multiple charts. This also lets you dynamically add/remove points from the watchlist and you wont have to change your page markup.
-
Thanks a lot!
We will do that.