Below is how I got this to work. The InputPortID wants the actual PortID of the RTD element not the "name"
Code:
new string "RTDID"
"RTDID" = "NAME OF RTD" ID
"PIDELEMENT" InputPortID = "RTDID"
Substituting the actual name of your RTD device you want to use for "NAME OF RTD" and the actual name of your PID device for "PIDELEMENT" in the code above.
Observations:
Playing with both ID and InputPortID:
Every Element has an ID. This is a Hexadecimal Number and is surely unique and assigned internally when an Element is created. It is also likely the "under the hood" how the program "works" with the Element.
Generally, the ID is not important and is a "read only" property and cannot be changed.
The single case where it becomes important is for a Temperature Type Element associated as a Input Device with a PID, Hysteresis, or Deadband Element.
While you may select an Input on the PID, Hysteresis, or Deadband Element on the Property Page of the Element by name of a Temperature Element
you must use the ID to set it in a script.
First you need to read the ID of the desired Temperature Element
In this example I am using my "Mash Return °F" 10kNTC Probe.
new string "Temp_ID"
"Temp_ID" = "Mash Return °F" ID
print "Temp_ID"
This returns a hexadecimal number as a string: 09431096-0ca3-450e-aafe-970139b9cd9d
You can now assign this to the InputPortID of a PID, Hysteresis, or Deadband Element.
With a big
BUT: You must assign the hexadecimal number
via a variable or string Global Element.
You
cannot assign the hexadecimal directly:
"Radiator PID" InputPortID = "09431096-0ca3-450e-aafe-970139b9cd9d"
or
"Radiator PID" InputPortID = 09431096-0ca3-450e-aafe-970139b9cd9d
result in a ERROR: Unknown Type.
You
must use a string variable or a string Global element to the the set the InputPortID.
1.
new string "Temp_ID"
"Temp_ID" = "Mash Return °F" ID
"Radiator PID" InputPortID "Temp_ID"
or (this is really not a good option as you must already know the hexadecimal ID of "Mash Return °F" probe)
2.
new string "Temp_ID"
"Temp_ID" = " "09431096-0ca3-450e-aafe-970139b9cd9d"
"Radiator PID" InputPortID "Temp_ID"
or create a string Global Element named gblTempID
3.
"gblTempID" value = "Mash Return °F" ID
"Radiator PID" InputPortID = "gblTempID" value
I like to use Global Elements for variables and rarely declare a variable. I do this because they are persistent(do not die when the script or program is shut), usable across scripts, and do not have to be declared. They may also be used again and again for different values (all of the same type).
All three work.
One other thing of note:
If you try to assign an InputPortID to
other than a PID, Hysteresis, or Deadband Element, it will throw an Error.
[ERROR: No property found with name 'InputPortID']