Wednesday, 5 February 2014

Publishing data over internet real time using LabVIEW SCCT 3.0

if our program is going to run local area network, we don't have any problem we can use the ipadrress or pc name in the host field of the subscriber side program.

but if we want to publish the data over internet, we cannot use pc name and using ipaddress may be difficult like remembering the address etc.

alternatively we can create dns for the PC in which publisher program is running. There are two ways to create dns for our ip address

1. Creating Free DNS
2. Webhost

1. Creating Free DNS
we can create a free dns in https://www.dnsdynamic.org

  • Signup
  • Activate account
  • Enter easy understandable name to your IP
  • Check availability for your preferred name











    • If available, enter the Ip address for which it has to point to
    • Click add
    • Now you easy to remember host address is ready for your subscriber program
    2. Webhost
    If you already own website the you can create much better host address for your subscriber program
    • Login to web host account
    • go to domain management section

    • created subdomain (for example. if your site name www.yoursite.com, create a subdomain of yourprefferedname.yoursite.com)
    • Check for zone editor in your domain manager page

    • choose the subdomain that you have created and enter your publisher IP address in the point to field.
    • Now your yourprefferedname.yoursite.com is your host address for your subscriber program.
    If you have any question please contact me.

    Thursday, 14 November 2013

    Converting Random Data to Json File in LabVIEW

    I have created a small program to implement Highcharts in LabVIEW. Highcharts is javascript based charts for which data needs to be passed in Json file format.  There may be alternate when I am writing this post this is the method I know.

    In this simple LabVIEW program,

    First, I am going to generate a random data and store in a JSON file format.
    Second, I am going to implement a Highcharts with .net labview component.
    Third, in the Highcharts json file called back to pass the data to series.


    JSON file creation in LabVIEW

    There is no inbuilt vis available for Json file in labview. So, I have installed "Json toolkit for LabVIEW"


    I got lot errors implementing it in my code. There is no good examples programs are available for this toolkit. So I tried for an alternate and I found the following JamesMcN Json vis


    http://james.newtonking.com/json/help/index.html

    Monday, 11 November 2013

    Live Random Data - Highcharts

    Highcharts is a charting library written in pure HTML5/JavaScript, offering intuitive, interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types.

      Highcharts Example

    Wednesday, 6 November 2013

    Websocket for LabVIEW and RGraph

    One of the post I found useful for web socket connection programming in LabVIEW.

    “From Post"


    I normally don’t post on LAVA, but lately I have been experimenting with the WebSocket protocol, ecmascript, and the SVG DOM for creating animated browser displays with data streamed from LabVIEW. The technique is surprisingly simple. All you have to do is create a script to change the attributes of the SVG elements using the Document Object Model. The WebSocket protocol has a built in message event handler that allows you to create your own script function which executes when messages are received. The browser connects to the socket server and sends a handshake when you create the WebSocket object in script.


    All you need do is put a TCP/IP listerner in your diagram and return this handshake as described in the wikipedia article on WebSockets. Once the connection is made, you can stream bidirectional data between your LabVIEW application and any bleeding edge browser (Firefox 4, Chrome 9, Safari, IE9?). You can use the DOM to set the transform attributes of SVG elements using the streamed info (rotate, scale, set heigh, width, line points, etc.).
    Now that we can all design our own GUI objects using Inkscape (free), I suggest a concerted effor to develop a standard SVG format, streaming protocol (based on WebSockets) and open-source script library. The very best thing about this is that it is all FREE, and runs on any platform that has an HTML5/SVG/WebSockets supporting browser (I’m keeping my fingers crossed for the next firmware revision of the Nintendo DSi), and requires NO PLUGINS. So all you folks with iOS and Android who feel left out by the WebUI Builder, or those of us who are infurated by it’s $1500/yr price tag (after spending $ on LabVIEW RT/FPGA), Cheer Up!


    Here are some screenshots of my efforts. The files are opened in the OS, but will also work when served by the old-fashioned “non-webservices” LV web server (you gotta add an SVG mime type to the mime-types file).


    You can also use RGraph Library and the HTML <canvas> tag if you want to implement a non-SVG browser solution. The library is free for non-commercial use.
    I suggest a community effort the create the standard SVG formats for UI elements, and a free, open-source ecmascript library for handling the messaging and DOM animation tasks. If there is interest, I will upload my script as a starting point, but I must warn that there is much improvement needed.
    sm”
    Screenshot_5.png
    Screenshot_7.png


    So what is my idea?


    0. Ditch Silverlight.


    1. Convert all of the nice-looking UI panel objects in the Web UI Builder from Microsoft XAML to SVG and distribute them with the LabVIEW professional development license. I am programmer first, and I admit my web panel objects don’t look too good.


    2. Design a script library for handling WebSockets communcation (or add native support for WebSockets to the Shared Variable Engine) and manipulating/updating the SVG UI objects from streamed WebSockets data. Make this library open source.


    3. Create a standard open protocol for streaming LabVIEW data that sits on top of WebSockets and is free and open.


    4. Publish documentation for the SVG UI elements so users and thrid parties can create new UI objects. Make use of the creativity of the community at large!


    5. Modernize the Web Publishing Tool so that it will optionally output an HTML5 and/or SVG document that accepts streaming I/O from WebSockets. The user could choose from compatible SVG elements to use in place of front panel elements on the VI being published.


    6. Create a Web UI SVG element exchange for registered NI users to upload/download elements for free.


    7. Work toward the long term goal of adding SVG Import/Export to the control editor (with better editing tools), or make the CTL format of custom controls SVG/XML.


    http://lavag.org/topic/13777-labview-websockets-and-svg/


    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Support-for-HTML5-and-SVG-in-Web-Publishing-Tool/idi-p/1437488

    Local Server Installation for Websocket verification

    Steps to install a local server so that we can test our Websocket program.


    Step1 

    Install Xampp local server to test the Websocket program. Also I installed bitnami for XAmmp to install WordPress. it is not required for Webscoket program.

    installation steps are explained in detail Here

    Step2 

    Now to check a local server, we need to run basic websocket program. for that I used the book "HTML5 Definite guide for Websocket"

    From the book, I tried the first example. and succeeded. I have got the results as mentioned in the book. this example didn’t work in office proxy network. it worked in home internet.

    See the example1.rar full source code link http://www.websocket.org/echo.html

    Step3 

    settingup local websocket server

    http://tech.kaazing.com/documentation/jms/3.5/about/setup-guide.html

    Tools Used


    http://downloadxampp.com/download.html

    http://bitnami.com/stack/xampp

    Download BitNami for XAMPP Windows Installer

    Ref


    http://code.google.com/p/phpwebsocket/

    http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/

    http://www.sitepoint.com/introduction-to-the-html5-websockets-api/

    http://www.websocket.org/book.html

    Tuesday, 5 November 2013

    LabVIEW Websocket project part 2

    We have successfully completed phase 1 of our sample project. now we will try to view in browser that is we will develop a subscriber for browser.

    To check this we need to develop a HTML page. tools required for


    We will convert the Subcriber vi front panel to HTML5

    After very long research I chose HighCharts Javascript based charting. In my comparison I have included Amcharts, Zing charts, Google charts, High charts and some other charts. in this I chose High Charts for few reasons.

    I am using HighCharts 3.0.7. Now I have to try one basic program how to use it.

    1. Download the latest version from www.highcharts.com
    2. Check the example program. I have located one example code, which displays dynamic graph
    3. copy the code and paste it in notepad and save as html file. open it in browser
    4. you should see this output

    <html>  
     <head>  
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
     <title>Highcharts Example</title>  
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>  
     <script type="text/javascript">  
     $(function() {  
          Highcharts.setOptions({  
               global : {  
                    useUTC : false  
               }  
          });  
          // Create the chart  
          $('#container').highcharts('StockChart', {  
               chart : {  
                    events : {  
                         load : function() {  
                              // set up the updating of the chart each second  
                              var series = this.series[0];  
                              setInterval(function() {  
                                   var x = (new Date()).getTime(), // current time  
                                   y = Math.round(Math.random() * 100);  
                                   series.addPoint([x, y], true, true);  
                              }, 1000);  
                         }  
                    }  
               },  
               rangeSelector: {  
                    buttons: [{  
                         count: 1,  
                         type: 'minute',  
                         text: '1M'  
                    }, {  
                         count: 5,  
                         type: 'minute',  
                         text: '5M'  
                    }, {  
                         type: 'all',  
                         text: 'All'  
                    }],  
                    inputEnabled: false,  
                    selected: 0  
               },  
               title : {  
                    text : 'Live random data'  
               },  
               exporting: {  
                    enabled: false  
               },  
               series : [{  
                    name : 'Random data',  
                    data : (function() {  
                         // generate an array of random data  
                         var data = [], time = (new Date()).getTime(), i;  
                         for( i = -999; i <= 0; i++) {  
                              data.push([  
                                   time + i * 1000,  
                                   Math.round(Math.random() * 100)  
                              ]);  
                         }  
                         return data;  
                    })()  
               }]  
          });  
     });  
     </script>  
     </head>  
     <body>  
     <script src="http://code.highcharts.com/stock/highstock.js"></script>  
     <script src="http://code.highcharts.com/stock/modules/exporting.js"></script>  
     <div id="container" style="height: 500px; min-width: 500px"></div>  
     </body>  
     </html> 
    I am going to use this code in our project for publishing the random data over internet browser. First, I have to study this code only then I will know which part of the I have to use, edit etc.

    I just thought of referring some books and found following books. Because books are good way to understand the technology. Let us see whether following books are helping us to complete the project successfully.




    Converting Random Data to Json File

    I thought to convert random data generated in publisher.vi to Json file. But there is no point in doing this. If I convert it then I have to send file over the websocket which will be time consuming process. file creation takes some time disk writing at publisher end also in subscriber end, which is complicated solution when we can transmit the data directly.

    however, I found some interesting toolkit for json file creation in LabVIEW, which I have explained here. It may be useful some other time.



    Monday, 4 November 2013

    Real time data publishing over network/ Internet using Labview

    Project Description

    My requirement is, I wanted to develop a project with which I can publish the real time data over network / Internet and provide remote user access permission to control& monitor the DAQ operation & data processing remotely.

    After a lot of research, I found a technology called WebSocket, which seems to be latest technology developed to transfer realtime data. I found it suits to my project. as I am familiar in labview programming langauge, if it is supported in labview, I can make use of this technology. Surprisingly there are addons already available for LabVIEW. Two three addons I found in that TSM4 SCCT for Labview http://toolsforsmartminds.com/products/SCCT.php seems to be the best one.



    Since I am new new to websocket technology and the SCCT3.0 addon. I am planning to start with some example program so that I get familiarity on this technology