Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: BobO on October 04, 2018, 05:50:22 AM

Title: Input Wanted! BRX HTTP features...
Post by: BobO on October 04, 2018, 05:50:22 AM
We are digging into what we might want to add to BRX through a web interface and would love to have input from our users!

Some ideas we are kicking around now are:
1. Web pages for:
   a) Basic system status...pretty much anything currently available from the SysInfo dialog pages in DmD.
   b) File system access...minimally file listing and file read access to the ram and sdcard disks. I have mixed emotions about writing or deleting.
   c) Basic image register data display. This is somewhat redundant to 2C below, one being browse-able the other more programmable. May not need both.
   d) ??
2. REST API for:
   a) Running program blocks. Something like /run/PgmBlockName?parameter_fed_into_string_containing_whatever_you_want
   b) Reading image register locations and returning as JSON object records. Something like /data/json?FieldJuan=V0&FieldToo=T0.Acc&Field3=D[V1]:3
   c) Reading image register locations and returning as live web page table. Similar to json, like /data/page?FieldJuan=V0&FieldToo=T0.Acc&Field3=D[V1]:3
   d) ??

We're listening!
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on October 04, 2018, 12:14:23 PM
And for those who have no clue what a REST API is, basically it is a means of using HTTP URLs as function calls. So rather than reading documents, you are issuing commands or requests for services.

Here's an example that happens to already be running on the DMSim.  ;) In this example, I am issuing a command to the PLC via a web browser, asking it to send me the current value of some element references formatted as a JSON record. Note the request at the top of the browser, and the response in the browser window. Just getting started, but this will give you an idea of what is possible.

Title: Re: Input Wanted! BRX HTTP features...
Post by: ATU on October 04, 2018, 04:57:55 PM
On the HTML access, I have seen other equipment and web page interfaces use brackets in the format  [variable] for simple display of of data in HTML, since html ignores the brackets.  As long as you could handle the nesting of brackets for array access. I would like to see something like that where I could use a simple HTML editor and insert data into the page. 

Any chance for adding an  FTP server for files on the memory card?
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on October 04, 2018, 06:19:20 PM
On the HTML access, I have seen other equipment and web page interfaces use brackets in the format  [variable] for simple display of of data in HTML, since html ignores the brackets.  As long as you could handle the nesting of brackets for array access. I would like to see something like that where I could use a simple HTML editor and insert data into the page. 

Any chance for adding an  FTP server for files on the memory card?

For an initial feature, I don't envision user definable pages via direct HTML generation. We will likely do an instruction that will allow you to define a small number of pages from PLC code (which will generate HTML) and those will definitely allow embedding data.

FTP is not a priority right now, but HTTP will give you rudimentary access.
Title: Re: Input Wanted! BRX HTTP features...
Post by: ATU on October 04, 2018, 06:35:04 PM
I would like to see simple HTML user defined pages with embedded data. Using them on another controller. Techs love them. Great diagnostic tool where there is no HMI.
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on October 05, 2018, 02:43:54 AM
I would like to see simple HTML user defined pages with embedded data. Using them on another controller. Techs love them. Great diagnostic tool where there is no HMI.

The instruction I'm proposing will allow you to create tables of live fields with descriptions. Does that not accomplish the same thing without the complexity?
Title: Re: Input Wanted! BRX HTTP features...
Post by: ATU on October 05, 2018, 09:51:44 AM
Sure. Would it be one instruction/html page or one page encompassing all tables?
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on October 05, 2018, 10:04:49 AM
An instruction would configure a page, and the system would support some arbitrary number of simultaneous pages. Since it is code, the pages could be reconfigured at will.

I'm thinking each page could be configured with 30+ lines. Still chewing on line content, but some combination of descriptive text and tag data, read for certain, and maybe write. We're not looking to replace an HMI (which we hope to build some day) but to provide exactly the kind of diagnostics access you are describing.
Title: Re: Input Wanted! BRX HTTP features...
Post by: Garyhlucas on October 05, 2018, 01:23:43 PM
This sounds a lot like the HMI IN YOUR POCKET I proposed a while back to provide access for setpoints on a PLC where you don?t really need an HMI. Except it looks like you wouldn?t need an app?
Title: Re: Input Wanted! BRX HTTP features...
Post by: ATU on October 05, 2018, 01:28:09 PM
Also, It would be nice down the road to have a dedicated memory structure with defined arrays of DINTS , REALS and STRINGS to edit configuration data via a web page. Nothing big, maybe 5-10 each? Anything more, you need an HMI. Nothing too fancy. Enough for the end user to setup IP addresses and limited configuration data.
Title: Re: Input Wanted! BRX HTTP features...
Post by: Bolt on October 09, 2018, 04:22:07 PM
I have built a fairly extensive webpage that is hosted on a local server.  I access all the data from the BRX via php commands to get the modbus data into arrays, and then build my web pages with those arrays.  It's a little bit of work to set up, but once working, it's rock solid.  Using it, I can read I/O and register values, control coils and set register values, etc.  I also post allot of data to an SQL server, which can then run historical charts, tables, etc.  At this point, I'm trying to build everything into web pages, and not need any HMI's.  With a php page obviously the data is not current after page load, but I think I could accomplish that with some java modbus libraries.

I would happily welcome any web capabilities.  Having API capabilities would help a bunch in polling data from various registers, vs putting them all into modbus, and having to slice and dice all the data into the necessary formats on my web pages.  I would like to see allot more than 30 lines be populated into an array though.

Having more capabilities into the BRX would really streamline things greatly.  Ideally I would like to see the web server be run entirely on the BRX, greatly cutting back on the hardware and supporting devices needed in a new setup.  There may or may or may not be a patent on that?
Title: Re: Input Wanted! BRX HTTP features...
Post by: Bolt on August 08, 2020, 12:36:37 PM
And for those who have no clue what a REST API is, basically it is a means of using HTTP URLs as function calls. So rather than reading documents, you are issuing commands or requests for services.

Here's an example that happens to already be running on the DMSim.  ;) In this example, I am issuing a command to the PLC via a web browser, asking it to send me the current value of some element references formatted as a JSON record. Note the request at the top of the browser, and the response in the browser window. Just getting started, but this will give you an idea of what is possible.
Is this REST API available yet?  Retrieving current values from PLC and returning in JSON format?  If so, is there any example code?
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on August 08, 2020, 01:27:40 PM
Is this REST API available yet?  Retrieving current values from PLC and returning in JSON format?  If so, is there any example code?

We are launching new products this Fall, and API will be in the associated release.

No example code necessary. It's just an HTTP GET.
Title: Re: Input Wanted! BRX HTTP features...
Post by: RBPLC on August 09, 2020, 08:35:41 PM
Can you speak to what these new products are?
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on August 09, 2020, 08:56:35 PM
Can you speak to what these new products are?

With the caveat that unreleased products are subject to change...and from memory...
1. Several new discrete modules, including some TTL versions
2. BX-HSIO4 - line driver version of HSIO that operates at 2MHz in and out.
3. A new POM that implements a second full Ethernet port. Supports everything the built in port does.
Title: Re: Input Wanted! BRX HTTP features...
Post by: Bolt on August 09, 2020, 10:37:29 PM
We are launching new products this Fall, and API will be in the associated release.
Excellent!
Any possibility of sending bits and bytes to the PLC via an API?  Perhaps sandboxed like MC and MHR, et al?
Title: Re: Input Wanted! BRX HTTP features...
Post by: deep6ixed on August 11, 2020, 08:18:02 AM
Been chewing on this web service idea, but i don't have access to DmD at the moment.  What can the json instructions do.

Been doing a lot of work with web app design and I wonder how much you could actually run client side via JS and have the DoMore serve the html static and a small JS file that handles all the major lifting from the browser.

Something along the lines of a static HTML / JS you'd upload into the cpu filesysyem and then the broswer would then update to and from cpu via JSON.
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on August 11, 2020, 11:01:52 AM
Been chewing on this web service idea, but i don't have access to DmD at the moment.  What can the json instructions do.

Been doing a lot of work with web app design and I wonder how much you could actually run client side via JS and have the DoMore serve the html static and a small JS file that handles all the major lifting from the browser.

Something along the lines of a static HTML / JS you'd upload into the cpu filesysyem and then the broswer would then update to and from cpu via JSON.

The JSON instructions are for building and parsing JSON records.

The API returns PLC data as JSON records, appropriate for JavaScript running on the client. Our current plan is to roll out the API and initial web server this fall, and then next year roll out an instructions for generating user web pages that will heavily use JS to drive client side stuff.
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on August 11, 2020, 11:03:52 AM
Excellent!
Any possibility of sending bits and bytes to the PLC via an API?  Perhaps sandboxed like MC and MHR, et al?

Not in the initial release, but it is something we want to do. One of our concerns was exposing everything via the API, but I like the sandbox idea. We will probably use some form of API key as well.
Title: Re: Input Wanted! BRX HTTP features...
Post by: Bolt on August 11, 2020, 11:12:22 AM
Been chewing on this web service idea, but i don't have access to DmD at the moment.  What can the json instructions do.

Been doing a lot of work with web app design and I wonder how much you could actually run client side via JS and have the DoMore serve the html static and a small JS file that handles all the major lifting from the browser.

Something along the lines of a static HTML / JS you'd upload into the cpu filesysyem and then the broswer would then update to and from cpu via JSON.
There's always plcnut's method of web serving: https://forum.hosteng.com/index.php?topic=1117.0 (https://forum.hosteng.com/index.php?topic=1117.0)
Title: Re: Input Wanted! BRX HTTP features...
Post by: Bolt on August 11, 2020, 11:12:57 AM
Excellent!
Any possibility of sending bits and bytes to the PLC via an API?  Perhaps sandboxed like MC and MHR, et al?

Not in the initial release, but it is something we want to do. One of our concerns was exposing everything via the API, but I like the sandbox idea. We will probably use some form of API key as well.
Please do!
Title: Re: Input Wanted! BRX HTTP features...
Post by: johnr on August 11, 2020, 12:24:53 PM
Does that mean that the new POM would also be 10/100 Mbps?
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on August 11, 2020, 04:24:17 PM
Does that mean that the new POM would also be 10/100 Mbps?

It is.
Title: Re: Input Wanted! BRX HTTP features...
Post by: deep6ixed on August 12, 2020, 05:57:18 AM
The JSON instructions are for building and parsing JSON records.

The API returns PLC data as JSON records, appropriate for JavaScript running on the client. Our current plan is to roll out the API and initial web server this fall, and then next year roll out an instructions for generating user web pages that will heavily use JS to drive client side stuff.

This sounds exciting.
Title: Re: Input Wanted! BRX HTTP features...
Post by: robert.beal on October 26, 2021, 01:31:15 PM
Any update on being able to send bits and bytes to the PLC via the Web API? I can read from the API but I cannot change the values so I can interact with the plc code.
Title: Re: Input Wanted! BRX HTTP features...
Post by: BobO on October 26, 2021, 01:36:05 PM
Any update on being able to send bits and bytes to the PLC via the Web API? I can read from the API but I cannot change the values so I can interact with the plc code.

We do plan to add it, but the primary concern is how to do it securely. Since (for now) the webserver isn't encrypted, we have concerns that even using an API key or something like that is still too exposed.
Title: Re: Input Wanted! BRX HTTP features...
Post by: robert.beal on October 26, 2021, 05:15:53 PM
Thanks, hopefully soon we will get there.