Logging and extract data to CSV

MAPS - Logging and extract data to CSV

This manual shows how to logging data during the process and extract this logs to CSV after finishing process. Every process is saved to other CSV file. 
"Copyright © Mitsubishi Electric Europe B.V.

IMPORTANT !

These Function Blocks are demo versions that are only  intended to demonstrate program functions and provide general orientation for  your software choices. They are not suitable for use in real applications! "

"Improper use of demo versions in applications can lead to serious malfunctions  and damage! Programs for real applications must always be configured for the  individual application by trained staff and tested thoroughly before being  used.

Mitsubishi Electric cannot assume any liability if these examples are used in real applications."

Creating and logging Analog Agent 

Firstly create Analog Agent and set logging
           

In logging settings choose logging mode and set data configuration.
In this example data is logging to:

C:\ProgramData\Adroit Technologies\Adroit\Configurations\TEST\Datalogs\Analog

Where “Analog” is name of .lgd file with data.

If after process data into file must be cleared, select option “Clear at start”.
After start logging You should have files into folder as below:
 
But folder “CSV” is created manually. 

Creating BATCH file 

Before creating batch file paste small console application “extract.exe” into folder with logging data:
C:\ProgramData\Adroit Technologies\Adroit\Configurations\TEST\Datalogs\
 

For more details about this application look into Adroit Help in Open Configurator
 

Next step is create BATCH file which extract logged data into .LGD to new CSV file with timestamp when file was created. 
Open notepad and write:
extract localhost.Adroit,LOG$ANALOG_TO_LOG$value,,,0,CSV\LOG_%date%_%time:~0,2%%time:~3,2%%time:~6,2%.csv
 

Save as ExtractToCSV.bat into the same folder. 
Where ANALOG_TO_LOG is name of Agent with logging data.  As You see in Open Configurator in DataLog Agents:
 

In this moment You can try Your batch file. Just double-click on him. You should get CSV file with data in “CSV” folder
 
It was created manually. Next step is create script which will do the same automatically.  

Creating and setting Agent Script to start batch file 

Write name of Agent Script and Add Agent
 
Choose language as VBScript and create module into the same folder
 
IMPORTANT: Uncheck “Exclude path from file name”!

Write script text
SUB main()
dim shell
set shell=createobject("wscript.shell")
shell.CurrentDirectory="C:\ProgramData\Adroit Technologies\Adroit\Configurations\TEST\Datalogs"
shell.run "ExtractToCSV.bat"
set shell=nothing
END SUB


Select a subroutine as main

 
And choose when script should be started (create CSV)


Attachments:

File name:

Description:

 

 

extract.exe

Application extract

extractscript.bas

ExtractToCSV.bat

File with script to run batch file

Batch file to run extract



    • Related Articles

    • Maps system requirements (data sheet)

      Summary: In the attached files you will find a data sheet with the system requirements of the Maps Scada system.
    • ME96 and MAPS connected by Modbus RTU

      This document shows how to connect electronic multi-measuring instrument ME96-MB to MAPS SCADA via Modbus RTU. Connection is using MOXA 1130 converter RS485 to USB Configuration MOXA converter Searching MOXA in device manager   The most important ...
    • ME96 and MAPS connected by Modbus TCP_IP

      This document shows how to connect electronic multi-measuring instrument ME96-MB to MAPS SCADA via Modbus TCP/IP Configuring Local Network Parameters Set static address IP on local network     MAPS Config Editor  Install new driver First install new ...
    • DIGITAL: Maps driver list

      Summary: In the attachment you can download a sheet in which you can find information about the drivers for Scada Adroit Maps.
    • MAPS agents programs example PL

      Artykuł zawiera przykładowe programy obsługi agentów w programie MAPS This project contains example programs of agents in MAPS Przykładowe programy  Odczyt/zapis agentów z pozycji C# (pojedyncze agenty) Biblioteki ...