Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

How to managed data on DB and query by ma-point-query


  • Hello guys :)
    I have this situation: three machines produce different objects each.
    Each object is produced from the moment an operator presses start and ends when he presses stop.
    To produce these objects there is no defined time, even those of the same type may have different manufacturing times.
    What I would like to know is if it is possible:

    1. Obtain for each product object the data acquired over time of its production.
    2. Of each object obtain the machine that produced it
    3. Of each machine obtain the sector to which it belongs

    In practice it is possible to create identifiers to perform these associations at the DB level? Since I have to get some graphs and reports for each product item (production time, temperature values etc.), I would like to know if it is possible to create a set of relational tables linked by keys so that I can query the IDs through queries and derive the related data through ma-point-query?
    Thanks !


  • So do you have meta points updating values when the respective start and stop buttons are pressed?
    If so, that would solve your turnaround time, and the would work based off of the the machine the point's update event is tied to.

    What do you mean by sector? That would be data entry driven unless you can provide more info..


  • 0_1527597614131_Diagramma1.png
    I hope this image can be explanatory. Pressing start the machine performs various steps. For each step I have values that are acquired by the sensors until you press stop.

    0_1527597814169_Diagramma2.png

    Once the process is finished, the system will have to return a history of the parameters collected with relative timestamp and it will generate a graph of the values trend. My problem is that I have to associate all these data to a specific product, as this machine does not produce only a type of product but different, so how will I distinguish product A with its values from product B with its own? I had thought about creating a table. At the start, I performed an insert using a SQL datasource (for example, with Product ID, timestamp, val1, val2, val3). So to get the final data I would query the table for Product ID and I would have finished.
    @MattFox thanks i hope this is helpful for mango users not only for me ;)


  • Does the brewers dash board not do something similar with its batch control? Maybe you can gets some ideas from there...


  • @CraigWeb are you referring to this example?


  • yup I think its doing exactly what you want but obliviously a different process....


  • @CraigWeb How could I create a batch? I do not know where to start. I can not take the time as a point of reference, but I need to give an ID to every series of processes that take place between a start and a stop. I did not understand how to accomplish this


  • Whoa, let's not get ahead of ourselves too far.

    It is true that the Brewer's Dashboard provides means of aggregating information about a product produced in batches, and in that sense it definitely is related and possibly usable for what you're talking about. However, it's definitely got an idiosyncratic implementation that was tailored to use in a brewery, and most specifically their fermentation. Things like automatically advancing between stages in terms of days, or only being able to specify one value to set to all setpoints associated with a fermentation tank in an automatic stage advancement, requiring a 'brewers dashboard monitor' data source with a glycol sensor and a cooling utilization data point, etc may make it cumbersome to adapt to the processes' needs to aggregate data for or control. Also, the brewers dashboard is not included in the Enterprise license.

    If you do want to give it a try, you can, there are instructional videos in this category: https://forum.infiniteautomation.com/category/20/brewers-dashboard

    Tanks need to be created as Temperature Control Monitor data sources, which are then associated with sensors. Then recipes need to be declared, which are stages composing a process. With that set up, you can begin a process in an asset.

    I do think it would be worthwhile to have a further generalized process data aggregation / stage progression tool.


  • @pierjsap I would say that Mango contains all the tools necessary to construct such a dashboard. I would not be trying to store the information in a SQL table, you should just leverage data points which keep their data in the time series database.

    • Data point tags
    • JSON store
    • Meta data points
    • Custom dashboard
    • User module

    I can't give you a complete example as its obviously something a little more complex. If you give us a little more information I can give you some pointers though.

    • Is there a set of data points x,y,z per machine, and multiple machines?
    • Is the start/stop for each machine just a binary data point?
    • What is the "product object" and how is this information obtained/entered?
    • How is the product id generated?
    • What sort of reports do you need? We can build a dashboard to display a report like view which could be printed, however using a scheduled/emailed report would be trickier

    If you contact support we can help you with a custom tailored solution.


  • If it's not affecting IP, i'd be keen to see the outcome of this job, sounds really interesting and could work for me with a future control related job.


  • @Jared-Wiltshire

    Is there a set of data points x,y,z per machine, and multiple machines?
    Yes, my project involves the construction of n-machines that have n-data points. But I would start to implement only one with 3 data points.

    Is the start/stop for each machine just a binary data point?
    I have inserted a binary button that is read by a scripting data source that when set to true starts reading 3 data points.
    In this regard, I wanted to ask you if you can activate and deactivate a data point and / or a data source using a script command. Eg by pressing the active button and deactivating the data source and its data points

    What is the "product object" and how is this information obtained/entered?
    I'll give you an example. Let's say that I have to create a glass object, this object can be a glass, a plate or a bottle. Each of these can be characterized by the various chemical components, because a glass must be transparent a bottle of green color a dish must be more resistant than both. So to realize this I have to observe how long it takes to make an object? I need to get some energy consumption data for a glass,
    derive the consumption for the realization of a dish. These data will then be used for statistical purposes ie to make a stronger glass takes 1 hour of time, I have to melt the components at 1500 ° C instead of 1000 ° C. So every time I start production of an object I can not take into account a period of time. But I have to take into account an ID that identifies a single production process process for both immediate consultation and future data consultation.

    How is the product id generated?
    I do not know, this was my question, I was trying to understand how to associate a production process with an object.
    Example:
    ID: 001
    XID: dhsflhdsfdhskfhdsfhds001
    type: Yellow glass
    realization time: 2 hours
    realized on: 2018-05-30 9.30 AM
    maximum temperature: 1000 ° C
    temperature per minute 1: 500 ° C - power per minute 1: 500W
    temperature per minute 2: 800 ° C - power per minute 1: 2000W
    temperature at minute 3: 1000 ° C - power per minute 1: 3000W
    temperature per minute 4: 500 ° C - power per minute 1: 1000W
    temperature per minute 5:30 ° C - power per minute 1: 500W

    What sort of reports do you need? We can build a dashboard to display a report like view which could be printed, however using a scheduled/emailed report would be trickier
    I think reporting is the least of my problems because Mango has these customizable tools


  • From what I'm seeing here, the most logical way of doing this is either using the Json store or an alphanumeric data point storing json. This way you could maintain all of the properties/characteristics applied for a given product generation session. When graphing however, take the list of point values and parse the json inside. Combine the respective values into arrays of the same type, then you can graph it all simultaneously to provide a characteristics chart. Am I getting the right idea here or way out left field?


  • From what I'm seeing here, the most logical way of doing this is either using the Json store or an alphanumeric data point storing json. This way you could maintain all of the properties/characteristics applied for a given product generation session. When graphing however, take the list of point values and parse the json inside. Combine the respective values into arrays of the same type, then you can graph it all simultaneously to provide a characteristics chart. Am I getting the right idea here or way out left field?

    Sounds reasonable to me. I may be over-complicating what is being talked about, but I would think it's going to involve several components, and those could all be done a few ways, I'm sure. My first hack at some of the potential problems:

    1. Getting data about a batch in progress: create batches by tagging points with the batch id, then retrieve this in queries, store tag creation time in the json store (I would also use the JSON store to keep stage history and possible sequences if I had some sense of stage progression). Figure out what batches exist by processing what JSON store entries exist.
    2. Ending batches and maintain a process history: gather point IDs from the tags, start time from the JSON store, and serialize that into an alphanumeric virtual point as JSON with the end time and the id of any process script run on it.
    3. Arbitrary setpoint process control: at batch creation time POST a script to the /rest/v2/script/run endpoint with some RuntimeManager.sleep(millis); handling the delays. Store the whole request model in the JSON store or construct the context points from the tags and store the script. Set values out to some update alphanumeric point if you want a live update feed from running processes. You might also need something like that if you're to be able to resume a process after a power failure, as the script would no longer be running. I would consider making the script somewhat arbitrary by storing process control information into an alphanumeric point as JSON, also, which may give it the ability to resume if it knew where it was and what resuming should be.

    Then reviewing batches is a matter of one point's history, and when a value is selected parsing that JSON to make the appropriate requests on the points from the process, as I think Fox is suggesting.


  • @pierjsap said in How to managed data on DB and query by ma-point-query:

    I have inserted a binary button that is read by a scripting data source that when set to true starts reading 3 data points.
    In this regard, I wanted to ask you if you can activate and deactivate a data point and / or a data source using a script command. Eg by pressing the active button and deactivating the data source and its data points

    Its pretty easy to enable/disable data points from a dashboard using a point's enable() method. And yes you can also enable/disable data points or data sources from a script. However I'm not sure this is necessary, I would probably just leave the data points logging continuously.

    Tag each data point with a set of tags to uniquely identify the machine.

    To find and view a set of trends/statistics for a particular product's production I would query the binary data point which indicates the start/stop of the machine and find the time periods where the machine was running. You can then query for the point values / stats for the x, y, z data points for the time period selected. You can collate these time periods with the product ID that corresponds to each by checking the value of the product ID data point (see below) at that point in time.

    @pierjsap said in How to managed data on DB and query by ma-point-query:

    But I have to take into account an ID that identifies a single production process process for both immediate consultation and future data consultation.

    I would probably have a meta data point which generates a new ID whenever the start/stop binary data point goes from 0->1. The data point could be an alphanumeric data point or just a plain numeric data point containing an incrementing integer.

    Another alternative would be to generate the new product ID on the frontend (dashboard) and allow the operator to override it via a text box. It seems like you need the operator to also select the product type e.g. "type: Yellow glass". You could provide a drop down select for this. Then when the operator clicks the start button, it would set/save these two values to two separate data points as well as setting the start/stop binary data point to true.


  • @Jared-Wiltshire
    Its pretty easy to enable/disable data points from a dashboard using a point's enable() method. And yes you can also enable/disable data points or data sources from a script. However I'm not sure this is necessary, I would probably just leave the data points logging continuously.
    0_1527755660733_disable.JPG

    What's wrong?
    Would you give me an example of how to recall classes and methods for working with datasoruce and datapoint and extracting the fields?
    I do not know the Java architecture you have implemented ...

    Tag each data point with a set of tags to uniquely identify the machine.
    0_1527761820401_tag.JPG
    It is possible to set "tags{}" field ?
    Eg. tags:{"nameProduct" : "productAlpha" , "id": "164", xid": "DP_RomeElettricoScrPotenza","name":"RomeElettricoScrPotenza"}

    Thanks in advance


  • You should consult the Mango JavaScript help, linked to by the blue (?) in the scripting data source properties and here: https://github.com/infiniteautomation/ma-core-public/blob/main/Core/web/WEB-INF/dox/mangoJavaScript.htm

    The answer would be to use the RuntimeManager object, like RuntimeManager.enableDataPoint(ScrAmperaggio.getDataPointWrapper().getXid());

    To the tags modification question, it sounds like you may be seeking this thread: https://forum.infiniteautomation.com/topic/3439/accessing-a-points-tag-value-via-script


  • @pierjsap said in How to managed data on DB and query by ma-point-query:

    What's wrong?

    I specified "from a dashboard", you are trying to use the function in a server side script. These are two different environments.

    @pierjsap said in How to managed data on DB and query by ma-point-query:

    Would you give me an example of how to recall classes and methods for working with datasoruce and datapoint and extracting the fields?

    I was not suggesting to tag data points from within a script, in fact I would advise against this. I was suggesting to setup all your data sources for the sensors and possibly meta data sources as required then tagging these through the bulk data point editor in the UI. You can these use these tags from your dashboards to locate the applicable data points for the machine you are viewing.