Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: etElMadr on August 09, 2021, 09:28:10 AM
-
Hoping there's a better way! Using Do-More on a BRX, just finished the first iteration of a program that basically reads input conditions, churns thru several tables of data (often recursively) looking for matching conditions, and spits out the results to various outputs. The code is fairly simple, if a bit abstract due to lots of pointers and indirect addressing. The key to getting the correct output is in data in the various tables. There are two tables with up to 150 records of two & nine fields respectively, and a multidimensional table with about 240 records of 6 fields with a minimum depth of about 2 (all subject to change when I refactor for the production version of the code). These tables were created using the Structured Memory Blocks (Structs).
This all works fine with a small data set, but it looks like manually inputting the data into the tables is going to be daunting. At first, I was hoping I could create a 2 dimensional Data View of the structured data similar to a spreadsheet; that doesn't appear to be possible. Then I tried to export / import data, but that doesn't appear to be possible with Structs. I've read that maybe I could put a CSV file on the sdcard, then read/write to it; doable but cumbersome when changes are needed. Probably the most client friendly option is to create a UI in a HMI device; doable but time consuming. Currently, I'm just using some code to move one test record at a time from the Data View to respective structured data record; again, doable but cumbersome.
In certain cases, I can prepopulate the tables with known configurations. Its also possible that I can hard-code some output states. But much of the data has to be mapped to specific conditions, and client will certainly need to modify as conditions / preferences change.
Are there any other ways to manually manipulate the data? Hoping there's a better way then the options described above!
-
When creating lots of data in structures, you have these options:
- Data View (one at a time)
- File System: open .csv (FILEOPEN), read a line (FILEREAD), parse it (see tokenize project in example forum), stuff it in your data blocks (same project) - not hard to do if you understand parsing text files.
- Standard Comm: Similar to File System, but you must use either a standard protocol (e.g. MQTT/S or HTTPCMD or FTP, but those last 2 would also require File System type parsing or JSONPARSE)
- Custom Comm: Roll Your Own protocol using TCPOPEN/STREAMIN or PACKETIN (UDP), w/similar parsing logic as Standard Comm once you get the data
Once you have the data in your retentive blocks, you could then stick the data in your .DMD project file via the Memory Image Manager (see Tools->Memory Image Manager), but it currently only supports EDITING INVIDUAL SIMPLE TYPES, not structure fields. But it DOES let you bulk transfer the PLC data to your DISK project and later be able to write it back to the PLC from the DISK project (then tweak it using Data View). The point being, once the data is in the PLC, the Memory Image Manager lets you tie all that data back to your disk project, available to write it back to a cleared PLC again later, without having re-enter all the data.
EDIT: Here's the tokenize project forum link:
https://forum.hosteng.com/index.php?topic=3303.0