Page 1 of 1

Live Data Overlay

PostPosted: Wed Sep 05, 2018 4:00 pm
by LSM1604
Hi,

I was wondering if someone could help me with something please?

I have built a tour of an industrial environment (valves, pumps, tanks, motors etc), and I would like to make some enhancements if possible.

One of those enhancements is to have an overlay of live data shown from within the tour. For example, if I hover my mouse over a particular pump it shows me whether it is running or not running, and the flow rate of the water running through it. If I hover over a tank it shows me the level. A motor it shows my the RPM etc.

We have all of this data and it is held within OSISoft PI Historian, and therefore have the ability to use the PI API should we need to.

Is there any way that I can get a tour created with PanoTour to do this? If not, could someone point me in the right direction with how I can get KrPano to do this once the tour has been built in PanoTour?

Any help is welcome :)

Thanks,
Liam

Re: Live Data Overlay

PostPosted: Sat Sep 08, 2018 12:00 pm
by 360-compunics-com-ni
Can be done using PTP and some custom coding, here is a general overview:
You can use AJAX-calls to get the live data, the following function (inside your index.html-file) can be triggered by an event like entering a scene (onnewpano) or at certain intervals (every 10 seconds, for example) - having it execute on every mouseover-event might lead to issues when users "fire" the event too rapidly.

The server-side script "get_livedata.php" would extract the data corresponding to the current pano's hotspots (hsidlist) and echo it back in a determined format, which could then be interpreted and displayed by the "show_livedata()"-function which can be inserted into the generated XML-files as custom plugin or via the "include XML"-plugin.

Code: Select all
function get_livedata( hsidlist ) {
    if (hsidlist == "") {
        return;
    } else {
        if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                var callstr = "show_livedata(" + xmlhttp.responseText + ")";
      getCurrentTourPlayer().call(callstr);
            }
        };
        xmlhttp.open("GET","get_livedata.php?ids="+hsidlist,true);
        xmlhttp.send();
    }
}