Allows the setting of the raw value, the calc value, and the calc message along with the optional firing of any triggers of Analog device types.
Integer. Returns 0 if successful. Returns 1 if the ID cant be found and 2 if an error occurs while updating the analogio table
Use this function to directly set the values of an analog device type without using a controller
The al_flags parameter is the sum of individual flag values. These flag values are:
1 - Update the raw value with the supplied al_value raw value. This flag will override a flag 32
2 - Update the calc value with the supplied as_calcvalue value. This flag will override a flag 64
4 - Update the calc message with the supplied as_calcmsg message
8 - Update the Device Status screen and any Remote DS clients with the new values
16 - Fire any triggers associated with the updating of the specified analog device type
32 - Apply the calctoraw formula to the supplied as_calcvalue and set the raw value to the result. A flag 1 will override this flag
64 - Apply the rawtocalc formula to the supplied al_value and set the calc value to the result. A flag 2 will override this flag
128 - Apply the averaging settings for the Analog device to the supplied al_value parameter. This happens before flags 1, 64, and 256 take effect
256 - If the Analog device has a user range specified, this flag will take the supplied al_value parameter and do a lookup in the range table and update the as_calcvalue parameter will this value
512 - Set the raw value to the original raw value currently stored in the Analog I/O table
1024 - Set the calc value to the original calc value
currently stored in the Analog I/O table
2048 - Set the raw value to the value in system variable RAW
4096 - Set the calc value to the value in system variable CALC
8192 - Set the foreground color for the Analog device to the value in system variable FORECOLOR
16384 - Set the background color for the Analog device to the value in system variable BACKCOLOR
32768
- Set system variable ORIGRAW to the original Analog raw value currently stored for the Analog device. If this flag is not set, system variable ORIGRAW will be set to the supplied al_value parameter
65536 - Update the raw value with the value in system variable ORIGRAW
Certain flags will counteract other flags and some combinations of flags will not make sense. Understanding the order in which the flags are applied will allow you to combine flags to achieve the desired results. The flags are executed in the following order: 32768, 128, 256, 32, 64, 512, 1024, 2048, 4096, 65536, 8192, 16385, 1, 2, 4, 8, 16
The proper flags value to update an analog device's raw
value, calc value, and update the Device Status screen would be 11 (1 + 2 + 8).
No triggers will be fired and the calc message will be unchanged.
The following examples demonstrate typical syntax/usage for this function.
• ph_setanalogvalue("TEMPERATURE",78,"","degrees F",1 + 4 + 8 + 16 + 64 + 32768) - This example updates the TEMPERATURE Analog I/O device by first storing the original analog I/O raw value in system variable ORIGRAW. The new raw value is set to 78. The rawtocalc formula is executed using the raw value of 78 and the new calc value
is set to the result. The calcmsg is set to "degrees F". The Device Status screen is updated and triggers are fired