Applies To:
  • CitectSCADA 5.xx, 6.xx
  • CitectHMI 5.xx, 6.xx

Summary:
Yes. It is possible to perform a raw write using cicode. This may be necessary if you are mapping tags from an array, into tags which have raw and engineering scales already applied. Since the built in tagwrite() funtion will use the scaling defined, this will render values invalid. The only way to overcome this, is to perform a raw tag write.  

Solution:
The following Cicode can be used to perform a raw write:

FUNCTION
RawTagWrite(
STRING sTagName, INT iTagVal)

    STRING sRawZ = TagInfo(sTagName,2);
    STRING
sRawF = TagInfo(sTagName,3);
    STRING
sEngZ = TagInfo(sTagName,4);
    STRING
sEngF = TagInfo(sTagName,5);

    REAL rRawZ = 0.00;
    REAL
rRawF = 0.00;
    REAL
rEngZ = 0.00;
    REAL
rEngF = 0.00;
    REAL
rMultiplier = 0.00;
    REAL
rOffset = 0.00;
    REAL
rTagVal = 0.00;

    IF
sEngZ = "" THEN
        sEngZ = sRawZ;

    END

    IF sEngF = "" THEN
        sEngF = sRawF;

    END

    IF sRawZ = "" OR sRawF = "" OR sEngZ = "" OR sEngF = "" THEN
        TagWrite
(sTagName, iTagVal);
        RETURN
;
    END

    rRawZ = StrToReal(sRawZ);
    rRawF =
StrToReal(sRawF);
    rEngZ =
StrToReal(sEngZ);
    rEngF =
StrToReal(sEngF);
    rMultiplier = (rEngF - rEngZ) / (rRawF - rRawZ);
    rOffset = rEngZ - (rMultiplier * rRawZ);
    rTagVal =
IntToReal(iTagVal)*rMultiplier + rOffset;
    TagWrite
(sTagName, rTagVal);

END

 

Keywords:
 

Attachments