Syntax error

is there something wrong with this line of code?
I keep getting syntax errors…

120 P = CONPROP ( 1 , PID1PB )

Check the line above this one.

PID1 and PID2 are defined

these are the lines above

100 PID1OUT = PID1
110 PID2OUT = PID2
120 P = CONPROP ( 1 , PID1PB )

Looks OK. Save it, clear the program and reload?
I had some issues with those so I just wrote my own PID loop…

jim, i am about to… this has been troublesome from the beginning. I actually pulled the code originally from another program but it also errored out

Have you used it before? CONPROP shows up as a local variable on my system.

List of Statements

CONPROP FUNCTION Allows a Basic program to up date the proportional term in a particular PID controller

Listed in the Help File as a Statement

from another post

Aleksei

Feb '20

Hi @wsf2w,
Below is an example code that can help you.
In the example, we pass the PID coefficients to the PID1 controller using the external variables of the controller:
10 REM *** PID1 SETTINGS ***
20 P = CONPROP ( 1 , VAR1 )
30 I = CONRESET ( 1 , VAR2 )
40 D = CONRATE ( 1 , VAR3 )
50 END

Yes, I saw it before. However does not mean it exists…
I tried all three statements and none work.

oh my! guess I should have stuck to my original plan. write my own PID
thanks Jim for your help!

Try this.
The wait at the bottom is the scan time.
Line 50 Contains the actual calculation.
10 if ctrlint < 1 then ctrlint = 1
20 ctrlerr = sp - rmtmp
30 if 90 < 1 then maxout_o = umax - umin else maxout_o = ( umax - umin ) * ctrlint / stk_t
40 if 50 > 0 then goto 50 else goto 70
50 calcout = P * -1 * ( ctrlerr - lsterror + 1 * ctrlerr / I )
60 if calcout > 0 then thispid = min ( calcout , 100 ) + tsig else thispid = max ( calcout , -100 ) + tsig
70 calcout = 10 * -1 * ctrlerr + ( 100 - 0 ) / 2
80 lsterror = ctrlerr
90 tsig = thispid
100 wait 00:00:01

What are we working on here actually. I have been programming buildings a long time and have to confess I never used these PID commands myself, I just build a PID using the usual setpoint and feedback point, then do a one liner for each PID:
10 DAMPER = PID1
20 VALVE = PID2
and so on.

I’ll get the team to get the PID statements mentioned above working, do give us a heads up when you are seeing things that don’t work as expected.

Jim, line 40 up there looks like it has a typo, this will always jump to line 50.
40 if 50 > 0 then goto 50 else goto 70

When these systems are attached to enterprise level controls systems it is sometimes necessary to map the Proportional Band, Integral Term to the supervisory level and make the BACnet Discoverable. However as I noted above P = CONPROP, I = CONRESET and D = CONRATE were not compiling today and code could not be saved to the controller. My apologies for causing any confusion.

Jim,
Thank you for your help today! I will look over what you’ve shared! I appreciate what you’ve done here!

Hmmm.
Try again.

10 rem measured value
20 rem mv = rmtmp
30 rem setpoint
40 sp = sp
50 rem mode ( 0 = off, 1 = normal control, 2 = control
60 rem mode = 1
70 gain = 10
80 rem itime = 50
90 tderv = 0
100 dz = 1
110 ctrlint = 1
120 umin = 0
130 umax = 100
140 rem stk_t = 90
150 rem lasterr = lsterror
160 rem tsg = tsig
170 rem actn = -1
180 if ctrlint < 1 then ctrlint = 1
190 ctrlerr = sp - rmtmp
200 if StrokeTime < 1 then maxout_o = umax - umin else maxout_o = ( umax - umin ) * ctrlint / stk_t
210 if Intergal > 0 then goto 220 else goto 250
220 calcout = gain * -1 * ( ctrlerr - lsterror + 1 * ctrlerr / intergal )
230 if calcout > 0 then thispid = min ( calcout , 100 ) + tsig else thispid = max ( calcout , -100 ) + tsig
240 goto 290
250 calcout = 10 * -1 * ctrlerr + ( 100 - 0 ) / 2
260 if calcout > 100 then calcout = 100
270 if calcout < 0 then calcout = 0
280 if calcout > tsig then thispid = min ( calcout , 100 ) + tsig
290 if thispid >= calcout then thispid = calcout else thispid = min ( calcout , -100 ) + tsig
300 if thispid <= calcout then thispid = calcout
310 thispid = max ( thispid , 0 )
320 thispid = min ( thispid , 100 )
330 if abs ( ctrlerr ) < 2 then thispid = tsig
340 if mode = 0 then thispid = tsig
350 if mode = 2 then thispid = 100
360 if mode = 3 then thispid = 0
370 lsterror = ctrlerr
380 tsig = thispid
390 wait 1

Chelsea will check the CONPROP and other PID statements. Thanks for the heads up…

We’ll get those statements working and expose them over bacnet. Thanks again for the heads up about the statements not working, good suggestion to make them visible over Bacnet as well.

~WRD255.jpg

…!

This looks pretty complex, I am worried about the next guy that comes along to maintain the system in 10 years or so. They are going to be scratching their head. What is this program actually accomplishing?

~WRD255.jpg

Maurice,

In my career I have worked in some pretty critical environments. Tight/exact control of static pressure, hot water, discharge air, room pressurization, humidity and other media require the use of the whole PID loop. Thankfully it has been mostly Proportional and Integral but those values are important to be visible, stable, adjustable and tunable. One of the things that control code and programs must do for me to make them “usable” in the markets and disciplines where I’ve worked in the field of Building Automation and Direct Digital Controls, is be accurate, repeatable, and stable. I am testing the T3000 in some pretty rigorous ways to see if the controller will fit in where I play. There are a couple of challenges that have come up, but all in all the challenges seem to be challenges that can be overcome. In regards to PID control and accuracy, in my areas where I am. The “I” term is critical to getting a 100 ton Chilled Water Airhandler with Hot Water Preheat and Damper Economizer to maintain 55 DegF +~ 0.5 DegF at 1.5”wc +~0.2”wc. In a unit that serves a surgery center it is not only vital, it’s critical. When a doctor calls for and needs a room to go negative and be at 64 DegF the controls have to respond quickly, accurately and with stability. I am excited as to what I can already do with this controller. There are some things I have to get used to like UI’s programmed as DI’s where closed contacts turn off the LED on the controller input and indicate a “0” value. Closed contacts to me on a PE-Switch, Airflow Switch, Current Switch mean whatever equipment I’m monitoring is “On” with the DI input LED lit on closed contact. But it’s an adjustment I am willing to make. Learning that the IF+ statement may execute twice but, if you put in a single WAIT Statement at the beginning of your code or use an IF TIME-ON Statement that concern is mute. As with all controls whether yours, TRANE, JCI, Schnieder, Honeywell, Siemens etc they all have their own idiosyncrasies and formats and I learn them and play well with them. So, hopefully this doesn’t seem too “complicated “ of a response but in my “world” I’ve learned that sometimes the more complicated the “program” the simpler it is for the end user. In my world the BAS/DDC TECH has to be on their game and understand their controls and programs. Canned doesn’t work in my world. Engineers love to turn that on its head. Between ASHRAE, JCHO and other organizations like them I’ve got to stay on my toes! You would think that after 38 years in the field I would have seen it all. I haven’t, it won’t, change is inevitable, there will always be a “new and improved” way! Thank you to all who have been kind, helpful, responsive and open here on this forum! You are a blessing! Maurice thank you for your patience.

Regards,

Dave

What about pumping, IAQ, Humidity control,AHU SAT control, Cooling Towers. There are many PID loops used in a typical Building HVAC system these days. Of course you could get away without using any but your power bill will be much more and your IAQ would suffer. Most states in the USA have Building code requirements in which there is no way to meet without using PID loops. Some are Very, very complicated. To complicated in my opinion. Most of the HVAC Jobs I do these days are re-comissionings, IAQ issues, code violations or Energy efficiency requirements. Most require design and SOO by either a licensed engineer or contractor to be submitted to the local building authority, then project completed and inspected by a third party commissioning agent. Its a big pain.
However Ive done office building and school jobs where they saved 100,000’s of thousands of dollars in utility bills every year and Industrial Jobs here they saved millions.
PID loops are very important.

1 Like

There is only one line that is the actual loop. Most of the rest is about keeping the output signal between 0 and 10.
Also most other controllers have a fixed 1 second program cycle. Yours do not. Which is a good thing. The 1 second program cycle was a leftover from really slow MCU’s.

1 Like