File

src/api/model/channel/cncServices.ts

Description

This class groups all the services that interact with cnc kernel, changing its state, execution modes or request the s state of running kernels.

Extends

EventEmitter

Index

Methods

Constructor

constructor(hmiComm: CommHmiNodeServer, cncKernelType: enums.CncKernelType, route: string, cncNodeIndex: number, cncClientId: number)
Parameters :
Name Type Optional
hmiComm CommHmiNodeServer No
cncKernelType enums.CncKernelType No
route string No
cncNodeIndex number No
cncClientId number No

Methods

Public Async axisZeroSearchBlock
axisZeroSearchBlock(axisName: string)

Method that sends to the CNC a string with the name of the axis to set for zero search.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Parameters :
Name Type Optional
axisName string No
Public cancelBlock
cancelBlock()

Method that cancels an interrupted block.

This method is only applicable if a running block is cancellable. You can find out it using request method.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public cancelStart
cancelStart()

Method that cancel start in double start mode.

This method is used to reset the first stage of double start mode Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public disableSblk
disableSblk()

Method that disables single block execution.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public enableSblk
enableSblk()

Method that enables single block execution.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public enterBlockMode
enterBlockMode(keep: string)

Method that sets the CNC in block execution mode.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Cnc will fire CncModeEvent when cnc has completed the transition.

cnc.on('CncModeEvent', (event) => {
if(event.data.state === 'BLK_SELEC'){
console.log('Block mode activated')
}

})
Parameters :
Name Type Optional Default value
keep string No ""
Public existsZeroSearchSubr
existsZeroSearchSubr()

Returns if there is Zero Search Subroutine

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public leaveBlockMode
leaveBlockMode()

Method that takes the CNC out of block execution mode.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Cnc will fire CncModeEvent when cnc has completed the transition.

cnc.on('CncModeEvent', (event) => {
if(event.data.state === 'PRG_SELEC'){
console.log('Block mode deactivated')
}

})
Public leaveControl
leaveControl()

Method that tries to leave control of the channel in the CNC.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public request
request(type: string)

Method that gets CNC info: status, mode, available actions. Possible request types: CNC_STATUS, CANCEL_BLOCK_ALLOWED, INSPECTION_ALLOWED, MDI_ALLOWED CANCEL_CONTINUE_ALLOWED.

Returns a promise. This promise is fulfilled with reply object ServiceResponse.

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

//CNC_STATUS
cnc.getChannel(1).cncServices.request('CNC_STATUS').then(data => console.log(JSON.stringify(data, null, 2)));

{
"data": {
"actions": [
"CONECTA",
"SELEC_P",
"SELEC_B",
"DESELEC_B",
"SET_B",
"START_E",
"STOP_E",
"PRESEL_EJES",
"MEAS_TOOL",
"INI_TOOL",
"EXEC_B",
"RESET",
"ENTRAR_INSPEC",
"SALIR_INSPEC",
"MODO_START",
"START_CONSUL",
"CANCEL_HOME",
"SELEC_EJES",
"OFFSET_P",
"OPTIONS_P",
"VAL_PM",
"DISABLE_KEY",
"ENABLE_KEY",
"DISABLE_REPKEY",
"ENABLE_REPKEY",
"ENABLE_SBLK",
"DISABLE_SBLK",
"CONSULTA",
"DESCONECTA"
],
"cncPrgSelecData": {
"channel": 1,
"cncKernelType": 0,
"externalSub": 0,
"mode": "STANDARD",
"nTimes": 0,
"selectedProgName": "",
"selectedProgPath": "",
"startOffset": 0,
"stopOffset": 0,
"stopProgram": ""
},
"blockSearchMode": "NO_ACTIVE",
"cancelContinueMode": "NO_ACTIVE",
"execMode": "STANDARD_MODE",
"handWheelAxis": [],
"inspecMode":"NO_INSPEC",
"newInspecMode":"NO_NEW_INSPEC",
"isJogMovement": "0",
"isWaitingDoubleStart": "0",
"mode": "PRG_SELEC",
"options": "WRK_OFF,REAL_OFFSET_OFF,REAL_ZONE_OFF,SW_LIMIT_OFF,M01_OFF,BLOCK_SKIP_OFF,CHNL_WAIT_OFF,SET_SYNC0",
"reposAxis": [],
"singleBlock": "0",
"state": "READY",
"ffcAllowed": "FFC_NOT_ALLOWED"
},
"returnCode": 0
}

cnc.getChannel(1).cncServices.request('CANCEL_BLOCK_ALLOWED').then(data => console.log(JSON.stringify(data, null, 2)));

{
"data": {
"state": "FALSE"
},
"returnCode": 0
}

Parameters :
Name Type Optional Default value
type string No "CNC_STATUS"
Public reset
reset()

Sends to the CNC the reset signal.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public Async resetError
resetError(errorPosition: number)

Resets an error indexed by position.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Parameters :
Name Type Optional
errorPosition number No
Public selectProgram
selectProgram(programName: string, path: string, mode: string, startOffset: number, stopOffset: number, nTimes: number, stopProgram: string, externalStop, cursorOffset)

Method that sends to the CNC the program that will be selected for execution.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

       values: 	"STANDARD","STANDARD_NO_SELEC","STANDARD_CYC_NO_SELEC","BLOCK_SEARCH","AUT_BLOCK_SEARCH","THEOR_TRAVEL",
                 "G_FUNCTIONS","GMST_FUNCTIONS","MAIN_PLANE","RAPID_MOV","RAPID_MOV_S0","SINTAX_CHECK","EXECUTION_TIME","2D_GRAPHICS"
Parameters :
Name Type Optional Default value Description
programName string No ""

Name of the program

path string No ""

Path of the program

mode string No "STANDARD"

Execution mode values: "STANDARD","STANDARD_NO_SELEC","STANDARD_CYC_NO_SELEC","BLOCK_SEARCH","AUT_BLOCK_SEARCH","THEOR_TRAVEL", "G_FUNCTIONS","GMST_FUNCTIONS","MAIN_PLANE","RAPID_MOV","RAPID_MOV_S0","SINTAX_CHECK","EXECUTION_TIME","2D_GRAPHICS"

startOffset number No 0

Offset in bytes to set program start block.

stopOffset number No 0

Offset in bytes to set program stop block.

nTimes number No 0

Condition to stop the esxecution, number of times have to passed from stopBlock.

stopProgram string No ""

Name of the program or subroutine where we want to set a stop block.

externalStop No false

If the stop subroutine is extenal or is located inside main program.

cursorOffset No -1

Offset in bytes to set program current block to simulate for Graphic support. -1 by default. optionals arguments not implemented in kernelservices

Public setBlock
setBlock(block: string)

Method that sends to the CNC the block that will be selected for execution.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Parameters :
Name Type Optional Default value Description
block string No ""

Block to be set for executing

Public setDoubleStart
setDoubleStart(bDoubleStart: boolean)

Method that set CNC start mode. To execute a program start key must be pressed only 1 odoublesr 2 times

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

If double start mode is enabled, when a START is detected channel object will fire CncDoubleStartEventData event

onCncDoubleStartEvent = (event) => {
if (
event.data.cncKernelType === 0
) {
if (event.data.value === 1) {
console.log('waiting second start');
//You can cancel start depending on the conditions you consider
this.cnc.getChannel(1).cncServices.cancelStart();
} else {
console.log('second start received')
}
}
};
Parameters :
Name Type Optional Default value Description
bDoubleStart boolean No false

To enable or disable double start behaviour

Public setTool
setTool(tool: number)

Method that sets a tool selection block in the CNC for execution.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Parameters :
Name Type Optional Description
tool number No

Logic number of the tool

Public startExecution
startExecution()

Method that start CNC execution. It is only applicable to simulated kernel, real kernel will raise a warning.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public stopExecution
stopExecution()

Method that stops CNC execution. It is only applicable to simulated kernel, real kernel will raise a warning.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

Public takeControl
takeControl()

Method that tries to take control of the channel in the CNC.

Returns a promise. This promise is fulfilled with reply object ServiceResponse

return object will contain the returnCode, if value is 0 everything went well, if not data will have the explanation of the error.

results matching ""

    No results matching ""