sosDoubleSet (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

1.52.00


sosDoubleSet will update the value of an existing DOUBLE object.

Please note that when using this function in a non-NX32L project, math.inc must be explicitly included by the application.

 

Input:

key : STRING

The key for the object to update.

Note: Starting with runtime firmware V2.40.00, the key can be prefixed with "!" to access system objects.

 

value : DOUBLE default 0

The new value for the object.

 

Returns: INT

0

- The object is updated.

-1

- Generic error.

-2

- Invalid parameter.

-10

- Object not found.

-11

- Object has the wrong type.

 

 

Declaration:

FUNCTION sosDoubleSet : INT;
VAR_INPUT
   key   : STRING;
   value : DOUBLE := 0.0;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
VAR
   rc   : INT;
   temp : DOUBLE;
END_VAR;
BEGIN
   ...
   // Create double object
   rc := sosDoubleCreate(key := "config.max_temperature", value:=24.5desc := "Largest temperature measured");
   DebugFmt(message:="sosDoubleCreate=\1", v1:=rc);
   // Update double object
   rc:= sosDoubleSet(key:="config.max_temperature", value:=26.7);
   DebugFmt(message:="sosDoubleSet=\1", v1:=rc);
   
   // Read double object
   rc:= sosDoubleGet(key:="config.max_temperature", value:=temp);
   DebugFmt(message:="sosDoubleGet=\1 => " + doubleToStr(v:=temp), v1:=rc);
   ...
END;
 
END_PROGRAM;