Batch files for control

The console client can be used to create batch files to control the Analytics Storage Provider. Some parameters are provided for this purpose:

-Help / -H / -?

Returns a description of all parameters

Parameters for the configuration settings:

-CreateASPConfig

Create a new Analytics Storage Provider settings XML

-MainTopic <mainTopic>

Analytics Storage Provider Main Topic

-Comment <comment>

Analytics Storage Provider comment

-EventLogTrace <True|False>

Trace to the event log

-DebugLog <True|False>

Additional DebugLog

-StorageType <type>

Storage type (ANALYTICSFILE, AZURESQL, AZUREBLOB)

-StorageConnString <connString>

Connection string or path to the memory

-TlsType <Tls1.0|Tls1.1|Tls1.2>

Tls type (for AzureBlob)

-MaxDuration <duration (sec)>

Maximum duration of a TAY file

-MaxWriteLen <writeLen (bytes)>

Maximum length of a data packet

Configuration parameters:

-LocalProvider

Use the connection settings of the locally installed Analytics Storage Provider

-ConfigFile <path>

Use all configurations from the configuration file of an Analytics Storage Provider Recorder window

-ProviderGuid <guid>

Provider of the Analytics Storage Provider to be used

-ConfigCmdID <id>

ID number of the preconfigured recording in the configuration file

-ConfigCmdAlias <alias>

Alias of the preconfigured recording in the configuration file

Connection parameters:

-Broker /-Host <hostname>

Host name or IP address of the broker used

-Port <port>

Broker port (default value: 1883)

-User <username>

Username for the connection

-Password / -Pwd <password>

Password for the connection

-CA <path>

Path to the CA certificate for the connection

-Cert <path>

Path to the certificate for the connection

-Key_Cert <path>

Path to the key file for the connection

-Key_Pwd <password>

Password for the key file for the connection

Function parameters:

-StartRecord

Sends a StartRecord command

-StopRecord

Sends a StopRecord command

-IsRecordingActive

Checks whether a recording is currently running

-GetHistorical

Sends a GetHistoricalData command

-StopHistorical

Sends a StopHistoricalData command

-UpdateHistorical

Sends a HistoricalUpdate command

-CancelAllRec

Sends a Cancel command to all active recordings

-CancelAllHist

Sends a Cancel command to all active historical data streams

Recording start/stop parameters:

-Alias <alias>

Alias name of the recording

-RecName <record>

Alias name of the data set

-Topic <topic>

Topic to be included

-DataFormat <Bin|Json>

Data format of the live data stream

-Duration <seconds>

Recording duration

-Ringbuffer <None|TimeBased|DataBased>

Ring buffer mode (default value: Default)

-RinbufferPara <minutes/MB>

Parameters for the ring buffer (in seconds or megabytes)

-Mode <All|Subset>

Mode of recording. Takes all symbols and a subset of the symbols

-Symbols / -Sym <Symbol1,Symbol2>

List of symbol subset as comma-separated list

-RecorderGuid <guid>

Guid of the Analytics Storage Provider Recorder window

-Storage <guid>

Guid from Storage where to write to

-SubBroker <guid>

Guid from the Sub Broker from which the data is to be recorded

Historical data stream start/stop parameters:

-SystemID <systemID guid>

System ID of the recorded data set

-Topic <topic>

Topic of the recorded data set

-Layout <layout guid>

Layout of the recorded data set

-RecordID <id>

ID of the data set to be streamed

-StartTime <time ns>

Start time of the data set to be streamed in nanoseconds

-EndTime <time ns>

End time of the data set to be streamed in nanoseconds

-MaxSamples <samples>

Maximum number of samples (default value: 5000)

-UsrSampleTime <ms>

Sampling rate. (Default value: -1; sampling rate of the recording)

-DataFormat <Bin|Json>

Data format of the data stream

-ResultTopic <topic>

Result MQTT topic to which the data will be streamed

-Mode <All|Subset>

Streaming mode. Streams all or a subset of the symbols

-Symbols / -Sym <Symbol1,Symbol2>

List of symbol subset as comma-separated list

Historical data stream update parameters:

-MaxSamples <samples>

Maximum number of samples (default value: 5000)

-UsrSampleTime <ms>

Sampling rate. (Default value: -1; sampling rate of the recording)

-MaxPackSize <samples>

Maximum message size in kilobytes

-SendDuration <ms>

Waiting time between sending messages in milliseconds

-ResultTopic <topic>

Result MQTT topic to which the data will be streamed

Command line samples:

Create configuration:

TwinCAT.Analytics.StorageProvider.Client
     -CreateASPConfig
          -MainTopic Beckhoff/ASPTest
          -Comment Analytics Storage Provider (Test)
          -EventLogTrace False
          -DebugLog False
          -StorageType ANALYTICSFILE
               -StorageConnString C:\TwinCAT\Functions\TF3520-Analytics-StorageProvider\Storage
               -MaxDuration 120
               -MaxWriteLen 2048
          -Broker 172.17.62.135
               -Port 1883
               -User tcanalytics
               -Pwd 123

Start recording with local Analytics Storage Provider:

TwinCAT.Analytics.StorageProvider.Client
     -localprovider
     -startrecord
          -alias cmdTest
          -recname cmdRec1
          -topic TestSignals/TestStream
          -dataformat Bin
          -Duration 30
          -mode Subset
          -Symbols Variables.fCosine,Variables.fSine

Start configuration file of a recording:

TwinCAT.Analytics.StorageProvider.Client
     -ConfigFile "C:\Users\User\AppData\Roaming\Beckhoff\TwinCAT Analytics Storage Provider\TcAnalyticsStorageProvider_Recorder.xml"
     -ProviderGuid 76141a7f-e580-4281-99d8-1b8a75ca014d
     -startrecord
     -ConfigCmdAlias cmdTest

Check recording status

TwinCAT.Analytics.StorageProvider.Client
     -Broker 172.17.62.135
          -Port 1883
          -User tcanalytics
          -Pwd 123
     -ProviderGuid 76141a7f-e580-4281-99d8-1b8a75ca014d
     -IsRecordingActive
          -alias cmdTest
          -recorderGuid a8e171d2-712d-bd8e-da15-7eef28b71ad2

Stop all recordings:

TwinCAT.Analytics.StorageProvider.Client
     -Broker 172.17.62.135
          -Port 1883
          -User tcanalytics
          -Pwd 123
     -ProviderGuid 76141a7f-e580-4281-99d8-1b8a75ca014d
     -CancelAllRec

Start historical data stream:

TwinCAT.Analytics.StorageProvider.Client
     -localprovider
     -GetHistorical
          -systemID c29ac2d4-76ce-ff44-4d7f-355ffbcca6bf
          -layout 9a8e171d-712d-bd8e-da15-7eef28b71ad2
          -topic TestSignals/TestStream
          -recordID 1
          -startTime 132696863612730000
          -endTime 132696864177720000
          -maxSamples 5000
          -usrSampleTime -1
          -resultTopic _TestSignals/TestStream/123
          -dataformat Bin
          -mode Subset -symbols Variables.fSine