Sinumerik

Connectware device driver for Siemens Sinumerik 840Dsl and 828D CNC systems. The driver acts as client for the Sinumerik “Access MyMachine / OPC UA” machine interface.

Important

To be able to access the Sinumerik OPC UA interface the machine requires Sinumerik Operate, a Sinumerik OPC UA license and a compatible OPC UA server version. For information on the machine prerequisites, compatibility & setup please see the SINUMERIK Access MyMachine / OPC UA Configuration Manual

Some Sinumerik vocabulary

  • Tool number (toolNo): Sinumerik internal tool number which uniquely identifies each tool

  • Tool identifier (toolIdent): Tool name. In the tool management each tool is explicitly defined both by its identifier and its duplo number. This means that a tool area can only contain equal tool identifiers with different duplo numbers.

  • Duplo number (duploNo): Number of replacement (“sister”) tool

  • Cutting edges (numCuttEdges): Number of cutting edges of a tool. This is not the number of blades but the number of different cut radius along the tool. Most tools have one cutting edge (eg regular drill). Also called D-Number.

Commissioning File Specifics

The following describes the available device specifics for a Sinumerik device. The Cybus Sinumerik OPC UA Reference file can be found in section Reference Device File

Connection Settings

The device connection is configured with a resource of type Cybus::Connection. Please note that the Sinumerik driver uses the Connectware OPC UA driver implementation and therefore the same settings apply here.

1sinumerikConnection:
2  type: Cybus::Connection
3  properties:
4    protocol: Sinumerik
5    connection:
6      host: '127.0.0.1'
7      port: 854
8      username: admin
9      password: admin
protocol

Required. Must be Sinumerik.

connection
host

Required.

For a detailed overview on all available OPC UA connection settings see the Connectware OPC UA Client driver documentation.

Connection Properties

host (string, required)

Hostname or IP of the Sinumerik device

Example: "192.168.2.60"

port (integer, required)

Port of the Sinumerik device

Default: 4840

Example: 4840

resourcePath (string)

Path of the Sinumerik server

Default: ""

Example: ""

username (string)

Username for Sinumerik server

Example: "user"

password (string)

Password for Sinumerik server

Example: "user"

timeout (integer)

Timeout, in milliseconds

Default: 1000

Examples: 1000, 2000

options (object)

Properties of the options object:

defaultSecureTokenLifetime (integer)

Lifetime of the secure token. Specified in milliseconds.

Default: 3600000

requestedSessionTimeout (integer)

OPC UA sessions may survive TCP connection breaks and are only deleted if no message from a client is received within the timeout period. Specified in milliseconds.

Default: 3600000

endpointMustExist (boolean)

Specifies if the connection is strictly meant for the given endpoint. If false and the endpoint doesn’t exist, a reasonable default endpoint is automatically chosen.

Default: false

messageSecurityMode (string, enum)

This element must be one of the following enum values:

  • None

  • Sign

  • SignAndEncrypt

Default: "None"

securityPolicy (string, enum)

This element must be one of the following enum values:

  • Aes128_Sha256_RsaOaep

  • Basic128

  • Basic128Rsa15

  • Basic192

  • Basic192Rsa15

  • Basic256

  • Basic256Rsa15

  • Basic256Sha256

  • None

  • PubSub_Aes128_CTR

  • PubSub_Aes256_CTR

Default: "None"

watchInterval (integer)

For observing connection breaks, a connection watchdog runs regularly. Short intervals guarantee short notice on break but lead to higher load. Specified in milliseconds

Default: 30000

connectionStrategy (object)

If a connection attempt failes, retries will be performed with growing delays in between. The following parameter control how these delays behave.

Properties of the connectionStrategy object:

maxRetry (integer)

Maximum number of connection retries in case of failure.

Default: 1000000000

initialDelay (integer)

Delay of the first retry. Consecutive retries will randomly take longer delays.

Default: 1000

maxDelay (integer)

Maximum delay of a retry.

Default: 60000

randomisationFactor (number)

This parameter controls added randomisation to the retry attempts. Must be a number between 0 and 1. If set to 0, retries will be performed with exponentially growing delay until maxDelay. If set to 1, a maximum noise will be added to the retry delays.

Default: 0

Additional restrictions:

  • Maximum: 1

Endpoint settings

Each connection can have several endpoints. They define the operations that are supported.

You define an endpoint by adding a resource of type Cybus::Endpoint

They have two key properties:

  • An operation

  • and a Sinumerik driver method

A Sinumerik endpoint support the following modes of operation:

  • Read

  • Write

  • Polling subscription (subscribe operation with type poll)

  • Notify subscription (subscribe operation with type notify)

Polling subscription

The subscribe pattern offers the possibility to subscribe to a Sinumerik driver method and poll the specified method in a given interval.

Example mapping:

 1machineInfoSubscription:
 2  type: Cybus::Endpoint
 3  properties:
 4    protocol: Sinumerik
 5    connection: !ref sinumerikConnection
 6    topic: getMachineInfo
 7    subscribe:
 8      type: poll
 9      method: getMachineInfo      # Sinumerik driver method
10      pollInterval: 5000
properties
protocol

Required. Must be Sinumerik

connection

Required. Must be a reference to a Sinumerik connection

topic

Optional. Your MQTT topic to write the data to.

operation

Required. Must to be subscribe

type

Required. Must be poll.

method

Required. Describes the Sinumerik driver method.

params

Optional. Array of method parameter.

pollInterval

Optional. Polling interval in milliseconds. Default 1000ms.

Read

The read operation offers the possibility to request a machine action and receive a response. The operation follows the JSON-RPC 2.0 Specification. To make it work you only need to specify a read operation on the desired method and send a message on a request-topic (req):

Example message:

{
  "id": 123,
  "params": [
    "param a",
    "param b",
    "param c"
  ]
}

Example mapping:

1getMachineInfo:
2  type: Cybus::Endpoint
3  properties:
4    protocol: Sinumerik
5    connection: !ref sinumerikConnection
6    read:
7      method: getMachineInfo
endpoint properties
protocol

Required. Must be Sinumerik

connection

Required. Must be a Sinumerik connection.

operation

Required. Must to be read.

method

Required. Describes the Sinumerik method.

This configuration will subscribe to getMachineInfo/req and publish responses to getMachineInfo/res.

MQTT payload

The MQTT request payload requires two keys:

  • id: User-defined correlation ID which can be used to identify the response

  • params: Array of parameters required for the used driver method

Following the example mapping above (method: getMachineInfo), the request payload, send on topic getMachineInfo/req, needs to be as following:

{ "params": [], "id": "<any-correlation-id>" }

This invokes the Sinumerik driver method getMachineInfo and returns the following response on topic getMachineInfo/res:

On success: { "result": { <machine-infos> }, "id": "<request-correlation-id>" }
On error  : { "error": "<error>", "id": "<request-correlation-id>" }

See the Examples section for further information.

Write

Endpoints configured with the write operation works exactly as endpoints configured with the read operation, allowing you to execute Sinumerik methods by sending a message to a set-topic (set).

Currently, these endpoints don’t support the return of any result.

Please refer to the Read section for more information.

Notify subscription

Certain Sinumerik driver methods offer events realized through the subscribe operation with type notify. Notifications are fired when a certain event is triggered.

Important

This feature is highly unstable and can crash the OPC UA server.

Example mapping:

 1sinumerikOnNcProgramChangedSubscription:
 2  type: Cybus::Endpoint
 3  properties:
 4    protocol: Sinumerik
 5    connection: !ref sinumerikConnection
 6    subscribe:
 7      type: notify
 8      method: onNcProgramChanged
 9
10mapping:
11  type: Cybus::Mapping
12  properties:
13    mappings:
14      - subscribe:
15          endpoint: !ref sinumerikOnNcProgramChanged
16        publish:
17          topic: 'notify/onNcProgramChanged'
endpoint properties
protocol

Required. Must be Sinumerik

connection

Required. Must be a Sinumerik connection.

operation

Required. Must to be subscribe.

type

Required. Must be notify.

method

Required.

Endpoint Properties

type (string, enum)

The type of subscription

This element must be one of the following enum values:

  • notify

  • poll

method (string, required)

The method to use

params (array)

The method parameters

pollInterval (integer)

The amount of time between polls

Default: 1000

Additional restrictions:

  • Minimum: 1000

publishInterval (integer)

Optional, sets the interval in which values are sent to their appropriate publish methods.

Default: 1000

samplingInterval (integer)

Integer, that sets the interval in which values are read from the server.

Default: 1000

maxNotificationsPerPublish (integer)

Sets the maximum number of monitor notifications that are in a single publish message of the OPC UA subscription. Setting this to a lower value will lead to more network traffic.

Default: 100

priority (integer)

Default: 10

requestedLifetimeCount (integer)

Default: 30

requestedMaxKeepAliveCount (integer)

Default: 10

retryMonitorTimeout (integer)

Default: 300000

Additional restrictions:

  • Minimum: 10000

Sinumerik Methods

This section describes the available Sinumerik driver methods. Each method is a specific RPC call which requires certain parameters and provides a defined return. The method paramter must be provides in the request payload in the params section. See the Examples section for further information.

Important

Each driver method requires certain access rights on the Sinumerik. The driver automatically sets the required OPC UA access rights for the currently connected OPC UA user. Please make sure the user is allowed to change its access rights. See also method getMyAccessRights.

Sinumerik NC variables are described here as:

  • <variable-name> (<type>, <sinumerik-machine-data-reference>): <description>

Note

NC variable details are found in the Siemens Sinumerik NC variables documentation, see e.g. SINUMERIK 840D sl NC variables.

Machine Information

Some machine information

Get Machine Information

Provides static Sinumerik machine information.

  • Method: getMachineInfo

  • Operation: subscribe or req/res

  • Parameter: none

  • Return

    • nckType (string, -): NC type

    • nckVersion (string, $AN_NCK_VERSION): NC version

    • anLanguageOnHmi (string, $AN_LANGUAGE_ON_HMI): Current language set on HMI

    • maskToolManagement (string, $MC_TOOL_MANAGEMENT_MASK): Channel-specific settings for NCK tool management function

    • basicLengthUnit (string, -): Global basic unit

    • numCuttEdgeParams (string, -): Number of parameters of a cutting edge in the T/TO module

    • numCuttEdgeParams_ts (string, ): Number of monitoring parameters of a cutting edge in the T/TS module

    • numToolParams_tu (string, MD 18094: MM_CC_TDA_PARAM ): Number of OEM data of a tool in the T/TU module

    • numCuttEdgeParams_tu (string, MD 18096: MM_CC_TOA_PARAM): Number of OEM data of a cutting edge in the T/TUE module.

Get Machine State

Provides current Sinumerik machine state.

  • Method: getMachineState

  • Operation: subscribe or req/res

  • Parameter: none

  • Return

    • anPoweronState (string, $AN_POWERON_STATE): machine power on state

    • poweronTime (string, $AN_POWERON_TIME): machine runtime in minutes

    • licenseStatus (string, -): Licensing status

    • nckMode (string, -): Mode in which the NCK works

    • sysTimeSinceStartup (string, -): System run time in seconds since NCK ramp-up

    • progStatus (string, DB21-30, DBX35.0 - DBX35.4): Program status

    • progName (string, -): Active program name

    • workPName (string, -): Active workpiece name

    • accessLevel (string, -): Level of the access rights currently set

Get Spindle Speed

Get spindle speed.

  • Method: getSpindleSpeed

  • Operation: subscribe or req/res

  • Parameter: none

  • Return

    • actualSpeed (string, $AA_S[x]): Spindle speed actual value

    • commandSpeed (string, -): Spindle speed desired value

Get Spindle Feed

Get spindle feed.

  • Method: getSpindleFeed

  • Operation: subscribe or req/res

  • Parameter: none

  • Return

    • actualFeed (string, -): Current constant cutting rate

    • commandFeed (string, -): Constant cutting rate of the master spindle

On NC program change

The method provides an event when the execution of a NC-file changes.

  • Method: onNcProgramChanged

  • Operation: notify

  • Parameter: none

  • Return

    • progStatus (string, DB21-30, DBX35.0 - DBX35.4): NC program state

    • progName (string, -): Name of active NC-file

    • workPName (string, -): Work piece name

Tool Interaction

Get Tool

Read tool by tool number. Method returns the essential tool configuration. See also Examples.

  • Method: getTool

  • Method signature: object tool = getTool (string toolNo)

  • Operation: subscribe or req/res

  • Parameter:

    1. toolNo (string): Tool number of tool to read

  • Return:

    • toolNo (string, ): Internal tool number of the tool

    • adaptNo (string, -): Number of adapter defined by system parameter $TC_ADPx

    • duploNo (string, $TC_TP1): Duplo number (number of replacement tool)

    • numCuttEdges (string, $P_TOOLND): Number of cutting edges of a tool

    • toolIdent (string, $TC_TP2): Tool identifier

    • toolInfo (string, $TC_TP11): Definition of the sub-group to which the tool belongs

    • toolInMag (string, $A_TOOLMN): Current magazine in which the tool is located

    • toolInPlace (string, $A_TOOLMLN): Current location in which the tool is located

    • toolMon (string, $TC_TP9): Type of tool monitoring

    • toolplace_spec (string, $TC_TP7): Magazine location type of tool

    • toolSearch (string, $TC_TP10): Selection of the order of the replacement tools

    • toolMyMag (string, $A_MYMN): Owner magazine of the tool magazine from which the tool was loaded

    • toolMyPlace (string, $A_MYMLN): Owner magazine of the tool - Magazine location from which the tool was loaded

    • toolsize_left (string, $TC_TP3): Tool size to the left in half locations

    • toolsize_right (string, $TC_TP4): Tool size to the right in half locations

    • toolsize_upper (string, $TC_TP5): Tool size upwards in half locations

    • toolsize_down (string, $TC_TP6): Tool size downwards in half locations

    • toolOverSize (string, $TC_TP3 … $TC_TP6): Tool size as fixed setting (two half locations left & right, one half location top & bottom) (true, false, special)

    • toolState (string, $TC_TP8): Tool state

    • toolStateLocked (string, $TC_TP8.2): Tool state - tool is locked (true, false)

    • toolMaxVelo (string, $TC_TP_MAX_VELO): Maximum speed of the tool if the value is >0. There is no monitoring if no speed limit is defined (=0).

    • toolMaxAcc (string, $TC_TP_MAX_ACC): Maximum angular acceleration of the tool if the value is >0. There is no monitoring if no acceleration limit is defined (=0).

    • lifetime (string, $TC_MOP2): Remaining service life in minutes

    • maxLifetime (string, $TC_MOP5): Desired service life

    • toolType (string, $TC_DP1): Tool type

    • length1 (string, $TC_DP3): Tool length 1

    • length2 (string, $TC_DP4): Tool length 2

    • radius (string, $TC_DP6): Tool radius

    • wearLength1 (string, $TC_DP12): Tool wear length 1

    • wearLength2 (string, $TC_DP13): Tool wear length 2

    • wearRadius (string, $TC_DP15): Tool wear radius

    • coolant1 (string, $TC_DP25.10): Coolant 1 (on, off)

    • coolant2 (string, $TC_DP25.11): Coolant 2 (on, off)

    • spindleDirection (string, $TC_DP2.8 & $TC_DP2.9): Spindle direction (left, right, off)

    • teethCount (string, $TC_DPNT): Number of teeth of a cutting edge

Get Tool Complete

Read tool by tool number. Method returns the complete tool configuration. See also Examples.

  • Method: getToolComplete

  • Method signature: object tool = getToolComplete (string toolNo)

  • Operation: subscribe or req/res

  • Parameter:

    1. toolNo (string): Tool number of tool to read

  • Return: Method returns all essential tool information (see getTool), plus

    • toolCompensationEdgeData (object, $TC_DPx): Tool edge offset data. Note: objectIndex = parameterIndex - 1

    • toolSupervisionData (object, TC_MOPx): Monitoring data per tool edge. Size given by numCuttEdgeParams_ts. Note: objectIndex = parameterIndex - 1

    • toolUserData (object, $TC_TPCx): User-defined tool parameter. Size given by numToolParams_tu. Keys addressed as toolUser_1toolUser_n.

    • toolUserEdgeData (object, $TC_DPCx): User-defined cutting edge parameter. Size given by numCuttEdgeParams_tu. Note: objectIndex = parameterIndex - 1

Get Tools

Read all available tools on the Sinumerik. Method returns essential tool information for each tool.

  • Method: getTools

  • Method signature: object tools = getTools ()

  • Operation: subscribe or req/res

  • Parameter: none

  • Return

    • object of getTool objects. Key is the tool number.

Get Tools Complete

Read all available tools on the Sinumerik. Method returns complete tool information for each tool.

  • Method: getToolsComplete

  • Method signature: object tools = getToolsComplete ()

  • Operation: subscribe or req/res

  • Parameter: none

  • Return

    • object of getToolComplete objects. Key is the tool number.

Create Tool

Create new tool on the Sinumerik and set tool configuration.

  • Method: createTool

  • Method signature: createTool (toolNo, fields, toolArea)

  • Operation: subscribe or req/res

  • Parameter:

    1. toolNo (string): Tool number to be created

    2. fields (object): Optional, default = {}. Tool configuration to set (see Set Tool Configuration)

    3. toolArea (string): Optional, default = 1. Tool area in which the tool should be created.

  • Return

    • Status code

      • 0: success

      • 1: Tool area does not exist

      • 2: Tool number out of range

      • 3: Tool number exists already

      • 4: Maximum number of tools reached)

Set Tool Configuration

Set or modify the configuration of a tool.

  • Method: setToolFields

  • Method signature: setToolFields (toolNo, fields)

  • Operation: subscribe or req/res

  • Parameter:

    1. toolNo (string): Tool number to be created

    2. fields (object): Tool configuration to set

  • Return: status code

Tool configuration

The tool configuration (fields) can be any of the essential tool configuration (see return of getTool method). Simply add the setting key to the fields object. Additionally any ToolUserData ($TC_TPCx), ToolCompensationEdgeData, ToolSupervisionData and ToolUserEdgeData parameter can be written by adding the key toolUser_x, toolCompensationEdgeData_x, toolSupervisionData_x and toolUserEdgeData_x, where x should be replaced by the corresponding parameter number, to the fields object.

Example:

{
  "fields": {
    "toolIdent": "COOLTOOL",
    "<more_fields>": "...",
    "toolUser_3": "2.3"
  }
}

See also Examples.

Set Tool

Convenient method to create a tool, set tool configurations and load the tool into a magazine. If no tool number is given the method searches for the first available tool number and uses this for tool creation. See also Examples.

  • Method: setTool

  • Method signature: string toolNo = setTool (toolNo, toolInMag, toolInPlace, fields)

  • Operation: subscribe or req/res

  • Parameter:

    1. toolNo (string): Tool number to be created. Auto-assigned if toolNo = "".

    2. toolInMag (string): Magazine number the tool should be loaded to. Not loaded if toolInMag = "".

    3. toolInPlace (string): Magazine place the tool should be loaded to. Not loaded if toolInPlace = "".

    4. fields (object): Tool configuration to set. (see Set Tool Configuration)

  • Return

    • toolNo (string): Tool number of the created tool

Delete Tool

Delete an existing tool.

  • Method: deleteTool

  • Method signature: deleteTool (toolNo, toolArea)

  • Operation: subscribe or req/res

  • Parameter:

    1. toolNo (string): Tool number to be deleted

    2. toolArea (string): Optional, default = 1. Tool area in which the tool should be deleted.

  • Return

    • Status code

      • 0: success

      • 1: Tool area does not exist

      • 2: Tool number out of range

      • 3: Tool number exists already

      • 6: Tool active

Delete Tool and Unload

Delete an existing tool. If the tool is loaded into a magazine, the tool is unloaded prior to deletion.

  • Method: deleteToolAndUnload

  • Method signature: deleteToolAndUnload (toolNo, toolArea = '1')

  • Operation: subscribe or req/res

  • Parameter:

    1. toolNo (string): Tool number to be deleted

    2. toolArea (string): Optional, default = 1. Tool area in which the tool should be deleted.

  • Return: status code (see deleteTool)

Get Tools in Magazine

Returns which tools are loaded into the magazine locations (places) for a given magazine.

  • Method: getToolsInMagazine

  • Method signature: object places = getToolsInMagazine (magazineNo)

  • Operation: subscribe or req/res

  • Parameter:

    1. magazineNo (string): Magazine number

  • Return

    • places (object): Object with magazine places and corresponding tool numbers (0 = no tool loaded)

Get Tools in Magazines

Returns which tools are loaded into the magazine locations (places) for all magazines on the Sinumerik.

  • Method: getToolsInMagazines

  • Method signature: object magazines = getToolsInMagazines ()

  • Operation: subscribe or req/res

  • Parameter: none

  • Return

    • magazines (object): Object with magazine number and magazine places (object, see getToolsInMagazine)

Load Tool

Load tool into magazine.

Note

The tool configuration and the magazine configuration need to match in order to successfully load a tool into a magazine, e.g. the tool place type (toolplace_spec) needs to match the magazine place type.

  • Method: loadTool

  • Method signature: loadTool (toolInMag, toolInPlace, toolNo)

  • Operation: subscribe or req/res

  • Parameter:

    1. toolInMag (string): Magazine number

    2. toolInPlace (string): Magazine place to load

    3. toolNo (string): Tool to be loaded

  • Return: status code

Unload Tool

Unload tool from magazine.

  • Method: unloadTool

  • Method signature: unloadTool (toolInMag, toolInPlace)

  • Operation: subscribe or req/res

  • Parameter:

    1. toolInMag (string): Magazine number

    2. toolInPlace (string): Magazine place to unload

  • Return: status code

On Active Tool Changed

Method provides a notification when the active spindle tool changes.

  • Method: onActiveToolChanged

  • Operation: notify

  • Parameter: none

  • Return

    • active (object)

      • actTNumber (string): Number of active tool

      • actToolIdent (string): Identifier of active tool

      • actDuploNumber (string): Duplo number of active tool

      • actDNumber (string): Number of active tool edge

    • previous (object)

      • actTNumber (string): Number of previous tool

      • actToolIdent (string): Identifier of previous tool

      • actDuploNumber (string): Duplo number of previous tool

      • actDNumber (string): Number of previous tool edge

On Tool Changed

The method provides an event on any essential tool configuration change, i.e. tool is added, altered or removed.

  • Method: onToolChanged

  • Operation: notify

  • Parameter: none

  • Return

    • toolNo (string): Tool number of changed tool

    • fields (object): Tool configuration (see return of getTool)

    • previousFields (object): Previous tool configuration (see return of getTool)

On Tool Complete Changed

The method provides an event on any complete tool configuration change, i.e. tool is added, altered or removed.

  • Method: onToolCompleteChanged

  • Operation: notify

  • Parameter: none

  • Return

    • toolNo (string): Tool number of changed tool

    • fields (object): Tool configuration (see return of getToolComplete)

    • previousFields (object): Previous tool configuration (see return of getToolComplete)

On Magazine Tool Changed

The method provides an event on any magazine tool change, i.e. when a tool is loaded/unloaded to a magazine.

  • Method: onMagazineToolChanged

  • Operation: notify

  • Parameter: none

  • Return

    • magNo (string, -): Magazine number

    • magPlace (string, -): Magazine location

    • toolNo (string, -): Tool number which loaded/unloaded to/from this location

Magazine Information

Get Magazine

Method returns information about a specific magazine.

  • Method: getMagazine

  • Method signature: object magazine = getMagazine (magNo)

  • Operation: subscribe or req/res

  • Parameter:

    1. magNo (string): Magazine number to read

  • Return

    • magNo (string, -): Magazine number

    • magActPlace (string, $TC_MAP8): Current magazine position

    • magNrPlaces (string, -): Number of real locations (in chain magazine) or number of slots (in box magazine)

    • magCmdState (string, -): Command state of the magazine

    • magIdent (string, $TC_MAP1): Identifier of the magazine

    • magKind (string, $TC_MAP1): Type of the magazine

    • magState (string, $TC_MAP3): State of the magazine

Get Magazines

Method returns information about all available magazine.

  • Method: getMagazines

  • Method signature: object magazines = getMagazines ()

  • Operation: subscribe or req/res

  • Parameter: none

  • Return

    • object of getMagazine objects. Key is the magazine number.

File System

Read File

Read a file from the Sinumerik file system.

  • Method: readFile

  • Method signature: { path, data } = readFile (path)

  • Operation: subscribe or req/res

  • Parameter:

    1. path (string): File path including filename, addressable either as absolute or relative path (e.g. “Sinumerik/FileSystem/Sub Program/foobar.SPF” or “Sub Program/foobar.SPF”)

  • Return

    • path (string): Absolute file path

    • data (string): Base64 encoded file content

Write File

Write file to Sinumerik file system. Directories are created automatically from given file path if non existing on the Sinumerik. By default, existing files are not overwritten. If you require files to be overwritten, specify the overwrite flag.

  • Method: writeFile

  • Method signature: writeFile (filepath, data, overwrite)

  • Operation: subscribe or req/res

  • Parameter:

    1. path (string): File path including filename, addressable either as absolute or relative path (e.g. “Sinumerik/FileSystem/Sub Program/foobar.SPF” or “Sub Program/foobar.SPF”)

    2. data (string): Base64 encoded file data

    3. overwrite (bool): Optional, default: false. Overwrite existing file.

  • Return: status code

Read Directory

Get list of files and subdirectories from directory.

  • Method: readDirectory

  • Method signature: { path, entries } = readDirectory(path)

  • Operation: subscribe or req/res

  • Parameter:

    1. path (string): Directory path, addressable either as absolute or relative path (e.g. “Sinumerik/FileSystem/Sub Program” or “Sub Program”)

  • Return

    • path: (string) Absolute directory path

    • entries: (array) Directory entries

Delete Directory

Delete directory. By default, directories that have any content (files/subdirectories) are not deleted. If you require to delete directories including content recursively, specify the recursive flag (use with care!).

  • Method: deleteDirectory

  • Method signature: deleteDirectory (directoryPath, recursive)

  • Operation: subscribe or req/res

  • Parameter:

    1. path (string): Directory path, addressable either as absolute or relative path (e.g. “Sinumerik/FileSystem/Sub Program” or “Sub Program”)

    2. recursive (bool): Optional, default: false. Delete directories including any content recursively.

  • Return: Status code

Access Rights Management

Get User Access Rights

Read OPC UA access rights of the current OPC UA user.

  • Method: getMyAccessRights

  • Operation: subscribe or req/res

  • Parameter: none

  • Return: Access rights

Give User Access

Set accesss rights for current OPC UA user. Please note that all driver methods automatically set their required access rights.

  • Method: giveUserAccess

  • Operation: subscribe or req/res

  • Parameter:

    1. level (string): User access level

  • Return: Status code

Examples

The examples are using the Sinumerik Reference Device File below. Thus, the MQTT topics might differ in your application but the payload needs to be the same (as long as no JSONata rules are being used).

Get Tool Complete

Example showing how to read the complete tool configuraton of tool number 1.

  • Method: getToolComplete

  • Operation: req/res

Request on MQTT topic “sinumerik-opcua/<machine-ip>/getToolComplete/req”

{
  "id": 1,
  "params": [
    "1"
  ]
}

Example response on MQTT topic “sinumerik-opcua/<machine-ip>/getToolComplete/res”

{
  "id": 1,
  "timestamp": 1589978193302,
  "result": {
    "toolNo": "1",
    "toolIdent": "SUPER_DRILL_7",
    "duploNo": "1",
    "numCuttEdges": "1",
    "toolInMag": "2",
    "toolInPlace": "15",
    "toolState": "131",
    "toolplace_spec": "1",
    "toolMaxAcc": "0",
    "toolMaxVelo": "0",
    "adaptNo": "0",
    "toolInfo": "0",
    "toolMyMag": "2",
    "toolMyPlace": "15",
    "toolSearch": "0",
    "toolMon": "0",
    "toolStateLocked": "false",
    "toolOverSize": "true",
    "toolsize_down": 1,
    "toolsize_left": 1,
    "toolsize_right": 1,
    "toolsize_upper": 1,
    "lifetime": "0",
    "maxLifetime": "0",
    "toolType": "205",
    "length1": "50",
    "length2": "0",
    "radius": "25",
    "wearLength1": "0",
    "wearLength2": "0",
    "wearRadius": "0",
    "coolant1": "on",
    "coolant2": "off",
    "spindleDirection": "right",
    "toolCompensationEdgeData": {
      "0": "205",
      "1": "9",
      "2": "50",
      "3": "0",
      "4": "0",
      "5": "25",
      "6": "0",
      "7": "0",
      "8": "0",
      "9": "0",
      "10": "0",
      "11": "0",
      "12": "0",
      "13": "0",
      "14": "0",
      "15": "0",
      "16": "0",
      "17": "0",
      "18": "0",
      "19": "0",
      "20": "0",
      "21": "0",
      "22": "0",
      "23": "0",
      "24": "256",
      "25": "0",
      "26": "0",
      "27": "0",
      "28": "0",
      "29": "0",
      "30": "0",
      "31": "0",
      "32": "0",
      "33": "0",
      "34": "0"
    },
    "toolSupervisionEdgeData": {
      "0": "0",
      "1": "0",
      "2": "0",
      "3": "0",
      "4": "0",
      "5": "0",
      "6": "0",
      "7": "0",
      "8": "0"
    },
    "toolUserData": {
      "toolUser_1": "0",
      "toolUser_2": "10",
      "toolUser_3": "0",
      "toolUser_4": "0",
      "toolUser_5": "0",
      "toolUser_6": "0",
      "toolUser_7": "0",
      "toolUser_8": "0",
      "toolUser_9": "0",
      "toolUser_10": "0"
    },
    "toolUserEdgeData": {
      "0": "0",
      "1": "0",
      "2": "0",
      "3": "0",
      "4": "0",
      "5": "0",
      "6": "0",
      "7": "0"
    }
  }
}

Set Tool

Example showing how to create a new tool and to set its configuration. In the example we do not require to set a specific tool number but rather let the driver choose the next available tool number automatically.

  • Method: setTool

  • Operation: req/res

Request on MQTT topic “sinumerik-opcua/<machine-ip>/setTool/req”

{
  "id": 2
  "params": [
    "",           // No specific tool number required
    "",           // We do not want to load the tool into magazine number
    "",           // We do not want to load the tool into magazine place
    {
      "toolIdent": "MY_NEW_TOOL",
      "toolType": "900",
      "length1": "125.5",
      "radius": "3.24,
      "spindleDirection": "left",
      "coolant1": "on",
      "toolOverSize": "true",
      "toolUser_2": "2.3"
    }
  ]
}

Example response on MQTT topic “sinumerik-opcua/<machine-ip>/setTool/res”

{
  "id": 2,
  "timestamp": 1589978193302,
  "result": "2"               // Driver created tool number 2
}

Here the driver successfully created a new tool using the next available tool number 2.

Reference Device File

Sinumerik OPC UA Reference File.

Download: sinumerik-reference.yml

  1---
  2# ----------------------------------------------------------------------------#
  3# Cybus Connectware Device Commissioning File
  4# Device: Sinumerik OPC UA Reference Device
  5# ----------------------------------------------------------------------------#
  6# Copyright: Cybus GmbH (2020)
  7# Contact: support@cybus.io
  8# ----------------------------------------------------------------------------#
  9description: >
 10  Sinumerik OPC UA Reference Device
 11
 12metadata:
 13  name: Sinumerik 840D
 14  icon: https://www.cybus.io/wp-content/uploads/2017/10/for-whom1.svg
 15  provider: cybus
 16  homepage: https://www.cybus.io
 17  version: 1.0.0
 18
 19parameters:
 20  host:
 21    type: string
 22    default: 192.168.0.1
 23
 24  port:
 25    type: integer
 26    default: 4840
 27
 28  username:
 29    type: string
 30    default: ''
 31
 32  password:
 33    type: string
 34    default: ''
 35
 36resources:
 37  sinumerikConnection:
 38    type: Cybus::Connection
 39    properties:
 40      protocol: Sinumerik
 41      connection:
 42        host: !ref host
 43        port: !ref port
 44        username: !ref username
 45        password: !ref password
 46
 47  # Machine information
 48
 49  # Machine info
 50  getMachineInfoSubscription:
 51    type: Cybus::Endpoint
 52    properties:
 53      protocol: Sinumerik
 54      connection: !ref sinumerikConnection
 55      subscribe:
 56        type: poll
 57        pollInterval: 5000
 58        method: getMachineInfo
 59
 60  getMachineInfo:
 61    type: Cybus::Endpoint
 62    properties:
 63      protocol: Sinumerik
 64      connection: !ref sinumerikConnection
 65      read:
 66        method: getMachineInfo
 67
 68  # Machine state
 69  # { anPoweronState,
 70  #   poweronTime,
 71  #   licenseStatus,
 72  #   nckMode,
 73  #   sysTimeSinceStartup,
 74  #   progStatus,
 75  #   progName } = getMachineState()
 76  getMachineStateSubscription:
 77    type: Cybus::Endpoint
 78    properties:
 79      protocol: Sinumerik
 80      connection: !ref sinumerikConnection
 81      subscribe:
 82        type: poll
 83        pollInterval: 5000
 84        method: getMachineState
 85
 86  getMachineState:
 87    type: Cybus::Endpoint
 88    properties:
 89      protocol: Sinumerik
 90      connection: !ref sinumerikConnection
 91      read:
 92        method: getMachineState
 93
 94  # On NC-Program change
 95  # { progStatus, progName } = onNcProgramChanged()
 96  onNcProgramChangedSubscription:
 97    type: Cybus::Endpoint
 98    properties:
 99      protocol: Sinumerik
100      connection: !ref sinumerikConnection
101      subscribe:
102        type: poll
103        method: onNcProgramChanged
104
105  # Spindle Speed
106  # { actSpeed, cmdSpeed } = getSpindleSpeed()
107  getSpindleSpeed:
108    type: Cybus::Endpoint
109    properties:
110      protocol: Sinumerik
111      connection: !ref sinumerikConnection
112      read:
113        method: getSpindleSpeed
114
115  # Spindle Feed
116  # { acConstCutS, cmdConstCutSpeed } = getSpindleFeed
117  getSpindleFeed:
118    type: Cybus::Endpoint
119    properties:
120      protocol: Sinumerik
121      connection: !ref sinumerikConnection
122      read:
123        method: getSpindleFeed
124
125  # TOOLS
126
127  # Get tool
128  # tool = getTool(toolNo)
129  getTool:
130    type: Cybus::Endpoint
131    properties:
132      protocol: Sinumerik
133      connection: !ref sinumerikConnection
134      read:
135        method: getTool
136
137  # Get complete tool
138  # tool = getToolComplete(toolNo)
139  getToolComplete:
140    type: Cybus::Endpoint
141    properties:
142      protocol: Sinumerik
143      connection: !ref sinumerikConnection
144      read:
145        method: getToolComplete
146
147  # Read tools
148  # tools = getTools()
149  getTools:
150    type: Cybus::Endpoint
151    properties:
152      protocol: Sinumerik
153      connection: !ref sinumerikConnection
154      read:
155        method: getTools
156
157  # Read complete tools
158  # tools = getToolsComplete()
159  getToolsComplete:
160    type: Cybus::Endpoint
161    properties:
162      protocol: Sinumerik
163      connection: !ref sinumerikConnection
164      read:
165        method: getToolsComplete
166
167  # Get tools in magazine
168  # toolsInMagazine = getToolsInMagazine(toolNo)
169  getToolsInMagazine:
170    type: Cybus::Endpoint
171    properties:
172      protocol: Sinumerik
173      connection: !ref sinumerikConnection
174      read:
175        method: getToolsInMagazine
176
177  # Get tools in magazines
178  # toolsInMagazine = getToolsInMagazines()
179  getToolsInMagazines:
180    type: Cybus::Endpoint
181    properties:
182      protocol: Sinumerik
183      connection: !ref sinumerikConnection
184      read:
185        method: getToolsInMagazines
186
187  # Create tool
188  # createTool(toolNo, fields)
189  createTool:
190    type: Cybus::Endpoint
191    properties:
192      protocol: Sinumerik
193      connection: !ref sinumerikConnection
194      read:
195        method: createTool
196
197  # Set tool fields
198  # setToolFields(toolNo, fields)
199  setToolFields:
200    type: Cybus::Endpoint
201    properties:
202      protocol: Sinumerik
203      connection: !ref sinumerikConnection
204      read:
205        method: setToolFields
206
207  # Set tool
208  # toolNo = setTool(toolNo, toolInMag, toolinPlace, fields)
209  setTool:
210    type: Cybus::Endpoint
211    properties:
212      protocol: Sinumerik
213      connection: !ref sinumerikConnection
214      read:
215        method: setTool
216
217  # Delete tool
218  # deleteTool(toolNo)
219  deleteTool:
220    type: Cybus::Endpoint
221    properties:
222      protocol: Sinumerik
223      connection: !ref sinumerikConnection
224      read:
225        method: deleteTool
226
227  # Delete Tool And Unload
228  # deleteToolAndUnload(toolNo)
229  deleteToolAndUnload:
230    type: Cybus::Endpoint
231    properties:
232      protocol: Sinumerik
233      connection: !ref sinumerikConnection
234      read:
235        method: deleteToolAndUnload
236
237  # Load tool into magazine
238  # loadTool(toolInMag, toolInPlace, toolNo)
239  loadTool:
240    type: Cybus::Endpoint
241    properties:
242      protocol: Sinumerik
243      connection: !ref sinumerikConnection
244      read:
245        method: loadTool
246
247  # Unload tool from magazine
248  # unloadTool(toolInMag, toolInPlace)
249  unloadTool:
250    type: Cybus::Endpoint
251    properties:
252      protocol: Sinumerik
253      connection: !ref sinumerikConnection
254      read:
255        method: unloadTool
256
257  # On active tool change
258  # { active: {...}, previous: {...} } = onActiveToolChanged()
259  onActiveToolChangedSubscription:
260    type: Cybus::Endpoint
261    properties:
262      protocol: Sinumerik
263      connection: !ref sinumerikConnection
264      subscribe:
265        type: poll
266        method: onActiveToolChanged
267
268  # On tool change
269  # { toolNo, fields, previousFields } = onToolChanged()
270  onToolChangedSubscription:
271    type: Cybus::Endpoint
272    properties:
273      protocol: Sinumerik
274      connection: !ref sinumerikConnection
275      subscribe:
276        type: poll
277        method: onToolChanged
278
279  # On magazine tool change
280  # { magNo, magPlace, toolNo } = onMagazineToolChanged()
281  onMagazineToolChangedSubscription:
282    type: Cybus::Endpoint
283    properties:
284      protocol: Sinumerik
285      connection: !ref sinumerikConnection
286      subscribe:
287        type: poll
288        method: onMagazineToolChanged
289
290  # MAGAZINES
291
292  # Get magazine
293  # magazine = getMagazine(magNo)
294  getMagazine:
295    type: Cybus::Endpoint
296    properties:
297      protocol: Sinumerik
298      connection: !ref sinumerikConnection
299      read:
300        method: getMagazine
301
302  # Get magazines
303  # magazines = getMagazines()
304  getMagazines:
305    type: Cybus::Endpoint
306    properties:
307      protocol: Sinumerik
308      connection: !ref sinumerikConnection
309      read:
310        method: getMagazines
311
312  # FILES
313
314  # Read file
315  # { path, data } = readFile(path)
316  readFile:
317    type: Cybus::Endpoint
318    properties:
319      protocol: Sinumerik
320      connection: !ref sinumerikConnection
321      read:
322        method: readFile
323
324  # Write file
325  # path = writeFile(path, data, overwrite)
326  writeFile:
327    type: Cybus::Endpoint
328    properties:
329      protocol: Sinumerik
330      connection: !ref sinumerikConnection
331      read:
332        method: writeFile
333
334  # Read directory
335  # { path, entries } = readDirectory(path)
336  readDirectory:
337    type: Cybus::Endpoint
338    properties:
339      protocol: Sinumerik
340      connection: !ref sinumerikConnection
341      read:
342        method: readDirectory
343
344  # Delete directory
345  # path = deleteDirectory(path)
346  deleteDirectory:
347    type: Cybus::Endpoint
348    properties:
349      protocol: Sinumerik
350      connection: !ref sinumerikConnection
351      read:
352        method: deleteDirectory