sosDoubleSet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.52.00


sosDoubleSet will update the value of an existing DOUBLE object.

 

Input:

key : STRING

The key for the object to update.

 

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.5, desc := "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;