views:

157

answers:

4

Hello. I am by no means considered a programmer. The only programming language I some what know is HTML - so be gentle :)

My boss came up to me the other day and asked me if i wanted to learn PHP, so i said sure. He threw me some text books and said here's what i want you to do:

There's a computer running labview that monitors various sensors. He wants me to take the data from the sensors and display it on a webserver on the same network. The format he wants it in: you punch in a command in a text entry box on the newly created website such as "chamber pressure" and then it takes the data that is displayed on the computer running labview and reads the value in another box that is under the first text box on the website.

Let me know where I should start. Any bit of help would be awesome.

A: 

This may not be helpful, but what you've been asked to do is advanced. This should not be your first PHP project.

Start by creating a web page where you can type in a command code and a hard-coded value will be displayed based on what code was typed in.

Scott Saunders
Thanks for the quick reply. I pretty much have the basics of the webpage done with the input boxes. im just replying on the php code to some how retrieve the data on the labview computer
Adam S
That's the advanced part. I don't know labview, but unless it has built in web services, you're going to have a hard time. How does labview make its data accessible?
Scott Saunders
LV understands files, tcp, harware ports, databases, .NET, ActiveX, etc, etc (not stdin/out/err, oddly). However, the LV code needs to be written to talk to these: the screen display values are not accessible. Also, LV does have a web server and can be used to generate web services, but it's fairly advanced stuff.
Underflow
A: 

If you know how to access a Webservice from within PHP, you could build your LabVIEW app as a webservice and access that from PHP. But without any proper training (LabVIEW and PHP) that will take you quite some time.

Ton

Ton
It's a side project and doesn't have to be completed anytime soon. In my down time I'm supposed to work on it when i have nothing else to do - not vital. I'm going to talk to the programing specialist here, i remember he was able to retrieve the data via command prompt but i wasn't paying attention to the commands he used...
Adam S
How do you build a LabView app as a web service?
Gabe
In your Project explorer you can create a new build. This build can be a Webservice (other options are executable, source distribution for instance). After selecting this you can add VIs to your webservice and the protocol they should return (XML for isntance). When you deploy your webservice and start the LabVIEW webserver you can browse to the URL and the VI will be run. For effectively changing your app to your webservice you need to setup a communication between your executable and the webservice VIs. Look in the LabVIEW examples for hints. (perhaps it's better to post this as a separate Q
Ton
A: 

I would start by using LabVIEW to store the data from the sensors to a database. A simple database with sensor name, value and possibly last reading time would do. MySQL databases are relatively easy to setup and work well with php I have found.

Next would be to use php on the webserver to fetch the data depending on the input and display it on the web page.

Swinders
A: 

The first thing to try is the Remote Panel support built into LabView. This allows you to view or control a LabView application from a web browser on another machine. Remote Panels have many limitations (there is a restriction on max number of connected clients and the LabView runtime is required on the client) but it will only take 20 minutes to get them set up. See "Viewing an Application or Front Panel Remotely Using a Browser" in the LV help.

Remote panels are particularly good if you want to have e.g. a pull-down list of sensors and some plots that update in real time. Dynamically updating plots are something that takes real work to implement in a web-standards way.

Use this prototype to figure out what your boss really wants to do. If his goal is to be able to peek at the chamber pressure down on the production line once in a while, you're done. If his goal is to share realtime updates on chamber pressure with 100,000 of his Facebook friends, half of whom want to view it with an iPhone or a Blackberry, then there's more work to do. Either of the approaches discussed above (using the LabView web server/web service platform, or writing everything to a database and pulling it out using php etc) will work; the latter is more scalable.

Robert Calhoun