File

src/api/interface/traceManager.ts

Description

This class groups all the services related to the CNC TraceManager.

The TraceManager displays signal information about CNC variables.

Index

Properties
Methods

Constructor

constructor(hmiComm: CommHmiNodeServer)
Parameters :
Name Type Optional
hmiComm CommHmiNodeServer No

Properties

route
Type : string

Methods

Public read
read()

This function reads trace's state in data format, showing variables from TraceData.

TODO: If there are more than one traces active, a UID will be used to identify each one of them.

Returns a ServiceResponse promise. This promise is fulfilled with returnCode = 0 if everything is OK or returnCode = -1 when something goes wrong.

Example in javascript:


EXAMPLE 1

cnc.traceManagerServices.setConfig({channels: [{name:'A.PPOS.X'},{name:'A.ACCEL.Y'}],mode: 'CONTINUOUS',triggerType:'NONE',triggerAbs:false}).then(console.log).catch(console.error)

cnc.traceManagerServices.read().then(console.log).catch(console.error)

Output:

{data: {…}, returnCode: 0}
data:
channelValues: Array(2)
0: (4441) [32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, …]
1: (4441) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  …]
length: 2
__proto__: Array(0)
dataRange: {from: 1162, to: 5603}
nChannels: 2
nSamples: 4441
state: 1  //NOT_TRIGGERED

cnc.traceManagerServices.read().then(console.log).catch(console.error)

{data: {…}, returnCode: 0}
data:
channelValues: Array(2)
0: (2548) [152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, 152499, …]
1: (2548) [-93749, -62499, -62499, -62499, -93749, -31249, -93749, -31249, -93749, -31249, -93749, -31249, -62499, -31249, -93749, -31249, -62499, …]
length: 2
__proto__: Array(0)
dataRange: {from: 5603, to: 8151}
nChannels: 2
nSamples: 2548
state: 1

EXAMPLE 2:

cnc.traceManagerServices.setConfig({channels: [{name:'A.PPOS.X',tSampleCh:5000},{name:'A.ACCEL.Y',tSampleCh:5000}], tSample:4000, nSample:100, mode: 'SINGLE',triggerType: 'UP',
triggerAbs: false,triggerLevel: 10,triggerChannel:0,triggerPosition:50}).then(console.log).catch(console.error)

cnc.traceManagerServices.read().then(console.log).catch(console.error)

Output:

{data: {…}, returnCode: 0}
data:
channelValues: Array(2)
0: (100) [32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 32577, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
1: (100) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -156249, -1093749, -2937499, -5562499, -8624999, -11968749, -15468749, -18843749, -22031249, -24937499, -27406249, -29218749, -30343749, -30562499, -29812499, -28218749, -25812499, -22999999, -19781249, -16437499, -13031249, -9718749, -6562499, -3906249, -1624999, -62499, 656249, 749999, 1031249, 2343749, 4656249, 7718749, 11031249, 14531249, 17937499, 21187499, 24249999, 26749999, 28781249, 30062499, 30531249, 29999999, 28624999, 26343749, 23656249, 20531249, 17156249, 13781249, 10437499, 7249999, 4437499, 2093749, 312499, -593749, -749999, -374999, 31249, 124999, 187499, 124999, 124999, 62499, 93749, 93749, 62499, 62499, 93749, 31249, 62499, 62499, 62499, 31249, 31249, 62499, 31249, 31249, 62499, 0, 31249]
length: 2
__proto__: Array(0)
nChannels: 2
nSamples: 100
state: 0 //FULL
Public setConfig
setConfig(config: TraceConfiguration)

This function sets customized configuration TraceConfiguration for the TraceManager

Returns TraceConfigReturn data related to the variables set.

Examples in javascript:



cnc.traceManagerServices.setConfig({channels: [{name:'A.PPOS.X'},{name:'A.ACCEL.Y'}],mode: 'CONTINUOUS',triggerType: 'NONE',triggerAbs: false}).then(console.log).catch(console.error)

cnc.traceManagerServices.setConfig({channels: [{name:'A.PPOS.X'},{name:'A.ACCEL.Y'}],mode: 'SINGLE', triggerType: 'NONE',triggerAbs: false, nSample:100}).then(console.log).catch(console.error)

cnc.traceManagerServices.setConfig({channels: [{name:'A.PPOS.X',tSampleCh:5000},{name:'A.ACCEL.Y',tSampleCh:5}], tSample:4000, nSample:100, mode: 'SINGLE', triggerType: 'UP', triggerAbs: false, triggerLevel: 10,triggerChannel:1,triggerPosition:50}).then(console.log).catch(console.error)

cnc.traceManagerServices.setConfig({channels: [{name:'A.PPOS.X'},{name:'A.ACCEL.Y'}], nSample:100, mode: 'CONTINUOUS', triggerType: 'UP', triggerAbs: false, triggerLevel: 10,triggerChannel:1,triggerPosition:50}).then(console.log).catch(console.error)

Output:

returnCode: 0; //If setConfig task has been successful
returnCode: {-1...-14} //If during setConfig task the traceManager encountered an error.

SetConfig example:
Input:
cnc.traceManagerServices.setConfig({channels: [{name:'A.PPOS.X'},{name:'A.ACCEL.Y'}],mode:'SINGLE,triggerType: 'NONE',triggerAbs:false}).then(console.log).catch(console.error)
Output:
data: "nSample is missing or incorrect", returnCode: -8
Reason: nSample must be set during setConfig, when configuring NONE triggerType and SINGLE mode

The channel period (tSampleCh) and the main period (tSample) are optional. (Note: Period units for setconfig: microsec)

By default the period is set to be equal to a CNC loop cycle (by default 4ms) when there is no channel period or period inputs.

If both periods are set in the config, the smallest value will be set as period.

Parameters :
Name Type Optional Description
config TraceConfiguration No

is a group of different variables to set custom configuration

Public start
start()

This function enables to start a previously configured Oscilloscope trace.

Returns a ServiceResponse promise. This promise is fulfilled with returnCode = 0 if everything is OK or returnCode = -1 when something goes wrong.

Example in javascript:

cnc.traceManagerServices.start().then(console.log).catch(console.error)
Public stop
stop()

This function stops the TraceManager.

Returns a ServiceResponse promise. This promise is fulfilled with returnCode = 0 if everything is OK or returnCode = -1 when something goes wrong.

Example in javascript:

cnc.traceManagerServices.stop().then(console.log).catch(console.error)

results matching ""

    No results matching ""