PHP 和 Labview - 从 Labview 获取值并在网页上显示该值 - 同一网络上的两台不同计算机
我绝不被视为程序员。我所知道的唯一编程语言是 HTML - 所以要温柔一点:)
前几天我的老板来找我,问我是否想学习 PHP,所以我说当然。他扔给我一些教科书,并说这就是我希望你做的事情:
有一台运行 Labview 的计算机,可以监控各种传感器。他希望我从传感器获取数据并将其显示在同一网络上的网络服务器上。他想要的格式:您在新创建的网站上的文本输入框中输入命令,例如“腔室压力”,然后它会获取运行labview的计算机上显示的数据,并读取另一个框中的值位于网站上的第一个文本框下方。
让我知道应该从哪里开始。任何一点帮助都会很棒。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我首先使用 LabVIEW 将传感器的数据存储到数据库中。一个包含传感器名称、值以及可能的上次读取时间的简单数据库就可以了。 MySQL 数据库相对容易设置,并且与我发现的 php 配合良好。
接下来是在网络服务器上使用 php 根据输入获取数据并将其显示在网页上。
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.
首先要尝试的是 LabView 中内置的远程面板支持。这允许您从另一台计算机上的 Web 浏览器查看或控制 LabView 应用程序。远程面板有很多限制(对连接客户端的最大数量有限制,并且客户端上需要 LabView 运行时),但设置它们只需要 20 分钟。请参阅 LV 帮助中的“使用浏览器远程查看应用程序或前面板”。
如果您想要获得传感器的下拉列表和一些实时更新的绘图,远程面板尤其有用。动态地
更新绘图需要实际工作才能以网络标准方式实现。
使用这个原型来弄清楚你的老板真正想要做什么。如果他的目标是能够偶尔查看生产线上的腔室压力下降情况,那么您就完成了。如果他的目标是与 100,000 名 Facebook 好友分享腔室压力的实时更新(其中一半人想用 iPhone 或黑莓手机查看),那么还有更多工作要做。上面讨论的任何一种方法(使用 LabView Web 服务器/Web 服务平台,或将所有内容写入数据库并使用 php 等将其取出)都可以工作;后者更具可扩展性。
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.
这可能没有帮助,但要求您做的事情是高级的。这不应该是您的第一个 PHP 项目。
首先创建一个网页,您可以在其中输入命令代码,然后将根据输入的代码显示硬编码值。
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.
如果您知道如何从 PHP 中访问 Web 服务,您可以将 LabVIEW 应用程序构建为 Web 服务并从 PHP 中访问它。但如果没有任何适当的培训(LabVIEW 和 PHP),这将花费您相当长的时间。
吨
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