How to store data collected on SD-card in PD 688 or PD 803, via a USB memory stick and a COPP PC into a database or excel sheet
The below illustration shows a system setup, where a milk truck collects data during the day. These data must go into the dairy, but there is no means of an online connection between the dairy and the truck. In this case, you can save data to database or excel by storing the collected data in the filevar-register. Afterward, you can transfer these data via an USB memory stick.
Requirements for the truck-side component for the data collection that is located in PD 688 (or PD803/PD 802):
- Create a record with the data you wish to store, and an array of these records.
- Create a filevar-register that uses your array as its datatype
- Enter a name in your filevar-register under “USB_filename”
- Create a button in your visualization to save to USB (using the filevar – method)
- How you choose to collect data and fill your array is up to you.
Requirements for the dairy-side database interface component that is located in the COPP PC:
- First, create a filevar-register with the same array type and the same USB-name as the one you created for the data collection component.
- Second, create a database register (see the tutorial “Exporting data from VIGO6 using ODBC” which also explains the prerequisites for your database/excel).
- Third, create a button in your PC visualization to load from USB (using the filevar – method), or call this method during start-up.
- Last, implement a routine that reads data record by record, from the filevar-register. The filevar is an internal SD-file on the PC. Then store the data into the database register. You have to copy the data from the physical USB memory stick into the COPP PC- folder “USB”.
Try it out (using MID reports.cfv as an example):
- Fetch the following zip file and unpack it to a folder on your PC
- In the folder “COPP PC” open the excel sheet MID_reports.xls”. It should contain only column-headings in row 1. You must select ‘Enable for editing’ first time you open it.
Extract: (more columns exist in the spreadsheet)
NB! In screen step 1:
If you do not have a file from a “real life system” use the demo-file provided in the root folder: ‘MID reports.cfv’ as shown below (you must be a little patient when data are loaded into excel, since there are almost 8000 records).