Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This set of functions are used in combination with tasks. Some functions provide helper functionality that are only invokable within LUA functions that are executed by task (cf. Section 4.5.2). Furthermore, there are functions included that can be used to add and delete task definitions directly within LUA scripts. Using them provides the opportunity to dynamically create task that are not listed within the task definition file. Note that adding and deleting of task can only be done during server start up (e.g. within the callback "OnInitEvent").

Description

Signature

string nxa.SourceItemID | nxa.SourceVar ()

This function can be used to query the ID of the source item that triggered the corresponding task. This function can only be used within LUA functions that are invoked by tasks.

Parameters

None.

Return

TypeDescription
stringitemID of the source item that triggered the task

Description

Signature

string nxa.DestinationItemID ()

This function can be used to query the ID of the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks.

Parameters

None.

Return

TypeDescription
stringitemID of the destination item that is configured within the task

Description

Signature

nxa.SetDestinationValue (variant)

This function can be used to set a new value for the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks. Note that the new value will only be set within the server - it will not be forwarded to the field device.

Parameters

NameTypeMandatory/OptionalDescription
 variantMnew value of the destination item

Return

None.

Description

Signature

nxa.WriteDestinationValue (variant)

This function can be used to write a new value to the destination item that is configured within the corresponding task. Compared to setting a value, a value write will also propagate the value change to the field device. This function can only be used within LUA functions that are invoked by tasks.

Parameters

NameTypeMandatory/OptionalDescription
 variantMnew value of the destination item

Return

None.

Description

Signature

variant nxa.ReadDestinationValue ()

This function can be used to read the current value of the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks.

Parameters

None.

Return

TypeDescription
variantcurrent value of the destination item

Description

Signature

variant nxa.InputValue | nxa.SourceValue ()

This function can be used to query the value of the source item that triggered the corresponding task. This function can only be used within LUA functions that are invoked by tasks.

Parameters

None.

Return

TypeDescription
variantcurrent value of the source item

Description

Signature

nxa.ExecuteDelayedScript (string, number)

This function executes a LUA script that is specified as String parameter. The execution can optionally be delayed.

Parameters

NameTypeMandatory/OptionalDescription
 stringMname of the LUA script
 numberOdelay in milliseconds (optional)

Return

None.

Description

Signature

nxa.AddWriteTask (string, string, bool, bool, bool, number, variant)

This function adds a new "WRITE" task definition during runtime.

Parameters

NameTypeMandatory/OptionalDescription
 stringMitemID of the source Server Item that triggers the task
 stringMitemID of the destination Server Item that is changed by the task
 boolMcorresponds to the "OnReceive" parameter of the task definition (cf. Section 4.5.2)
 boolMcorresponds to the "OnSend" parameter of the task definition (cf. Section 4.5.2)
 boolMcorresponds to the "OnSet" parameter of the task definition (cf. Section 4.5.2)
 numberMtime interval in milliseconds that the task will be delayed when triggered
 variantOif used, this value will be used instead of the value of the source item (optional)

Return

None.

Description

Signature

nxa.AddReadTask (string, string, bool, bool, bool, number)

This function adds a new "READ" task definition during runtime.

Parameters

NameTypeMandatory/OptionalDescription
 stringMitemID of the source Server Item that triggers the task
 stringMitemID of the Server Item that has to be read
 boolMcorresponds to the "OnReceive" parameter of the task definition (cf. Section 4.5.2)
 boolMcorresponds to the "OnSend" parameter of the task definition (cf. Section 4.5.2)
 boolMcorresponds to the "OnSet" parameter of the task definition (cf. Section 4.5.2)
 numberMtime interval in milliseconds that the task will be delayed when triggered

Return

None.

Description

Signature

nxa.AddSetTask (string, string, bool, bool, bool, number, variant)

This function adds a new "SET" task definition during runtime.

Parameters

NameTypeMandatory/OptionalDescription
 stringMitemID of the source Server Item that triggers the task
 stringMitemID of the destination Server Item that is changed by the task
 boolMcorresponds to the "OnReceive" parameter of the task definition (cf. Section 4.5.2)
 boolMcorresponds to the "OnSend" parameter of the task definition (cf. Section 4.5.2)
 boolMcorresponds to the "OnSet" parameter of the task definition (cf. Section 4.5.2)
 numberMtime interval in milliseconds that the task will be delayed when triggered
 variantOif used, this value will be used instead of the value of the source item (optional)

Return

None.

Description

Signature

nxa.AddScriptTask (string, string, bool, bool, bool, number, string, number)

This function adds a new "SCRIPT" task definition during runtime.

Parameters

NameTypeMandatory/OptionalDescription
 stringMsourceItemID
 stringMdestinationItemID
 boolMcorresponds to the "OnReceive" parameter of the task definition (cf. Section 4.5.2)
 boolMcorresponds to the "OnSend" parameter of the task definition (cf. Section 4.5.2)
 boolMcorresponds to the "OnSet" parameter of the task definition (cf. Section 4.5.2)
 numberMtime interval in milliseconds that the task will be delayed when triggered
 stringMLUA script name that will be executed when the task is triggered
 numberM(optional) ModuleID. Needs to be > 5000. Can be referenced in the nxa.RemoveScriptTask function.

Return

None.

Description

Signature

bool nxa.AddVarTask (string, string, number)

This function can be used to add a task that is triggered if a variable changes its value.

Parameters

NameTypeMandatory/OptionalDescription
 stringMname of the variable that shall be the trigger for the task.
 stringMname of the LUA function that shall be invoked.
 numberM(optional) delay for executing the function.

Return

TypeDescription
booltrue on success, false otherwise

Description

Signature

nxa.RemoveScriptTask (string, number)

Removes all "SCRIPT" tasks matching the provided parameters from the runtime system, even if defined in the definition file.

Parameters

NameTypeMandatory/OptionalDescription
 stringMsourceItemID
 numberM(optional) ModuleID as set in the nxa.AddScriptTask function.

Return

None.

Description - INTERNAL DOCUMENTATION

Signature

nxa.ExecuteXCommandValue (string)

This function is used to execute an XLogic command within LUA. This version takes a single string as parameter which includes all parameters.

Parameters

NameTypeMandatory/OptionalDescription
 stringMXCommand including all parameters as string

Return

None.

Description - INTERNAL DOCUMENTATION

Signature

nxa.ExecuteXCommand (string, string, ...)

This function is used to execute an XLogic command within LUA. This version takes a single string as parameter which includes all parameters.

Parameters

NameTypeMandatory/OptionalDescription
 stringMNamd of XCommand. The variable scope is encoded as "'"'. If no scope is needed only the XCommand name shall be given.
 stringMInputs, Parameters and Outputs
 ...

Return

None.

Description - INTERNAL DOCUMENTATION

Signature

number nxa.GetFreeTransactionID ()

This function returns the next free transaction IDs which can be used to identify a task. The transaction ID is never reused. The transaction ID can be used as last parameter for the functions nxa.SetValue, nxa.WriteValue, nxa.ReadValue, nxa.SetDestinationValue, nxa.WriteDestinationValue, nxa.ReadDestinationValue, nxa.ExecuteDelayedScript

Parameters

None.

Return

TypeDescription
numbertransaction ID

Description - INTERNAL DOCUMENTATION

Signature

nxa.CancelTransaction (number)

Aborts a currently running task using its transaction ID.

Parameters

NameTypeMandatory/OptionalDescription
 numberMtransaction ID of the task that shall be canceled.

Return

None.

  • No labels