Cai Webcontrol as true thermostat

Have you querried your variables to see what they are?

This would isolate the time subroutines versus the outpout on/off subroutines.

If the variables are 0, then the time subroutine isn't working, if the variables are 650 (or whatever), then it is the output on/off that isn't working.

If you have loops in your programs that are taking so much time that the lines sepcifing time aren't getting run during that second, then the variables will never get set.

Please try putting in my original program again but change the name to "tempset" instead of "settemp". There are for sure no loops in my program. I can confirm that once I wrote a program with a subroutine named "email. . . " and that screwed things up, so I am sure "set. . . " can screw things up also.
 
Hello,

Thank you for your help.

OK, I tried this but has no effect what so ever. It's like it does not see the time at all.

I tried several combinations, like TSTGT CT 17:0:0, because I thought it would scan between midnight 0:0:0 and 17:0:0 so the Greater option appears to be more logical, but that didn't work either.

Please see attachment as I followed the example and changed the time period to the time I was working on this, as you can see from the capture that the OP2 should be on from the displayed temp and what the temp was set to.

I deleted all the other from the program, like the door opening feature to keep it simple in case there was some conflicts, but still not triggering op2.

Any ideas why this isn't working?

Maybe something to do with the firmware version I'm using?

Thanks again for your help.

The script I provided to you only have time from 5AM to 8AM working, if your clock was not between 5AM to 8AM, it will not work.
When you test, what is your clock time set on WebControl? I expect once you see how 5-8AM working, you can add other time section to the PLC code.
I tested on the current PLC firmware 3.2.7, which is same as 3.1.7 in funcitons and features. You are running 3.1.4 which should also work, since the PLC enginer is same between them.
 
Have you querried your variables to see what they are?

This would isolate the time subroutines versus the outpout on/off subroutines.

If the variables are 0, then the time subroutine isn't working, if the variables are 650 (or whatever), then it is the output on/off that isn't working.

If you have loops in your programs that are taking so much time that the lines sepcifing time aren't getting run during that second, then the variables will never get set.

Please try putting in my original program again but change the name to "tempset" instead of "settemp". There are for sure no loops in my program. I can confirm that once I wrote a program with a subroutine named "email. . . " and that screwed things up, so I am sure "set. . . " can screw things up also.


Hi Lou7,

How do I check the variable settings?
 
The script I provided to you only have time from 5AM to 8AM working, if your clock was not between 5AM to 8AM, it will not work.
When you test, what is your clock time set on WebControl? I expect once you see how 5-8AM working, you can add other time section to the PLC code.
I tested on the current PLC firmware 3.2.7, which is same as 3.1.7 in funcitons and features. You are running 3.1.4 which should also work, since the PLC enginer is same between them.


Hello Cai,

I changed the entry to reflect the time period I was working in, didn't you see in the attachment? Or is there something else I was to do about the time period that I missed

OK, as long as the version is OK, thats good. The reason I mentioned the version, is because We've noticed that some versions use different command.
 
Have you querried your variables to see what they are?

This would isolate the time subroutines versus the outpout on/off subroutines.

If the variables are 0, then the time subroutine isn't working, if the variables are 650 (or whatever), then it is the output on/off that isn't working.

If you have loops in your programs that are taking so much time that the lines sepcifing time aren't getting run during that second, then the variables will never get set.

Please try putting in my original program again but change the name to "tempset" instead of "settemp". There are for sure no loops in my program. I can confirm that once I wrote a program with a subroutine named "email. . . " and that screwed things up, so I am sure "set. . . " can screw things up also.


Hi Lou,

OK, I tried your program again, changed the name, but still would not switch on, please see image capture with the details.
 

Attachments

  • cai-temp.jpg
    cai-temp.jpg
    82.3 KB · Views: 10
Hello,

Thank you for your help.

OK, I tried this but has no effect what so ever. It's like it does not see the time at all.

I tried several combinations, like TSTGT CT 17:0:0, because I thought it would scan between midnight 0:0:0 and 17:0:0 so the Greater option appears to be more logical, but that didn't work either.

Please see attachment as I followed the example and changed the time period to the time I was working on this, as you can see from the capture that the OP2 should be on from the displayed temp and what the temp was set to.

I deleted all the other from the program, like the door opening feature to keep it simple in case there was some conflicts, but still not triggering op2.

Any ideas why this isn't working?

Maybe something to do with the firmware version I'm using?

Thanks again for your help.


In your picture, you have first two lines:
START
TSTLT CT 0:0:0

That means you want to see when current time is less than 0:0:0, that will never happen, thus the
subroutine will never be called. Please note the PLC code I posted have:

START
TSTLT CT 8:0:0

Which is always true before 8AM. If you current time is 17:00, then you need to test a time like 17:05:00 to watch if the
heater is turn on by that time.
 
In your picture, you have first two lines:
START
TSTLT CT 0:0:0

That means you want to see when current time is less than 0:0:0, that will never happen, thus the
subroutine will never be called. Please note the PLC code I posted have:

START
TSTLT CT 8:0:0

Which is always true before 8AM. If you current time is 17:00, then you need to test a time like 17:05:00 to watch if the
heater is turn on by that time.

Hello Cai

OK, I changed the time to fit between 5:00 AM and 8:00AM and the heat started. While the heat is on, the I put the time back to a range that was after 8:00 AM, but the heat still stayed on.

Is this mean that the program only checks once before 8:00 AM and 5:00 AM time slot for the temperature reading and does one trigger?
 
Hi Lou,

OK, I tried your program again, changed the name, but still would not switch on, please see image capture with the details.


Your problem is that var 1 never got set. The program sets the variable at the specific time (06:00:00, 09:00:00, 13:00:00). If the program isn't running at one of those times, the variable won't get set. Yours is 0 which means the program wasn't running at the designated time.

Did you have the program in operation during one of the setting times?
 
siafu,

After 8AM, you did not have any logic to control the heat.
You will need to add another section for the next period of time, in that you specify the temperature settings.

TSTLT CT 17:0:0
callsub thermo0817

Then you copy the thermo58 section and name that as thermo0817,
in that you check the start time if less than 08, just skip.
Also define the temperature range.

After 17:0:0, you can define another one before 23:59:59

If you have a period that is not defined, that means you don't care about that period of time, heater can be on forever, or off forever, depending on last time in the subroutine. If it was on, the heater will be continue on, if that was off, heater will be stay off. Since there is no logic to control it.
 
Your problem is that var 1 never got set. The program sets the variable at the specific time (06:00:00, 09:00:00, 13:00:00). If the program isn't running at one of those times, the variable won't get set. Yours is 0 which means the program wasn't running at the designated time.

Did you have the program in operation during one of the setting times?


Hello Lou,

OK, I changed the VAR to zero, and it trigger on. See attached

So it will only trigger once at a specific time? What I need it to do is to constantly check for temp range set during a period of time, if temp drops below a certain point it needs to trigger on, then if it goes above a set point it needs to turn of. This may happen many times during a set time period.

Also the var 2 is also used to trigger emails on and and ff, so I think there is a conflict with this type of programing, unless other vars can be used?
 

Attachments

  • cai-webcontrol.jpg
    cai-webcontrol.jpg
    85.4 KB · Views: 9
siafu,

After 8AM, you did not have any logic to control the heat.
You will need to add another section for the next period of time, in that you specify the temperature settings.

TSTLT CT 17:0:0
callsub thermo0817

Then you copy the thermo58 section and name that as thermo0817,
in that you check the start time if less than 08, just skip.
Also define the temperature range.

After 17:0:0, you can define another one before 23:59:59

If you have a period that is not defined, that means you don't care about that period of time, heater can be on forever, or off forever, depending on last time in the subroutine. If it was on, the heater will be continue on, if that was off, heater will be stay off. Since there is no logic to control it.

Hello Cai,

OK, will try this as well, but before I do can you let me know if during a time period block, such as 5:00 AM and 8:00 AM for example, does the program keep on checking every few minutes for changes because during a time block, the heat may need to go on and off several times, depending on the temperature change. If it only does it once between a time period block, then this will not work for me, as this needs to constantly check and trigger on and off several times, then move to the next time period and check again many times for temperature change, just like a wall mounted that has different time zones set throught the day would. Is this possible with the webcontrol board?
 
Hello Lou,

OK, I changed the VAR to zero, and it trigger on. See attached

So it will only trigger once at a specific time? What I need it to do is to constantly check for temp range set during a period of time, if temp drops below a certain point it needs to trigger on, then if it goes above a set point it needs to turn of. This may happen many times during a set time period.

Also the var 2 is also used to trigger emails on and and ff, so I think there is a conflict with this type of programing, unless other vars can be used?

The variable gets set at the specified time. It checks the actual temp and compares it to the variable like 100 times per second. The variable is the "set point". Once the setpoint is established, it only needs to be changed at the specified times. Just like you walked up to a manual thermostat and changed the temp.

If you look at your current values. Var1 is 730 and var2 is 750. As long as those variables are set to those numbers, it will turn on at 73.0 and turn off at 75.0. When the next time spot is hit, it will change var1 and var2 to new values and output 2 will turn on/off at the new values. If you want to manually override it, change var1 manually. It will then stay that way until the next time slot is hit.
 
Hello Cai,

OK, will try this as well, but before I do can you let me know if during a time period block, such as 5:00 AM and 8:00 AM for example, does the program keep on checking every few minutes for changes because during a time block, the heat may need to go on and off several times, depending on the temperature change. If it only does it once between a time period block, then this will not work for me, as this needs to constantly check and trigger on and off several times, then move to the next time period and check again many times for temperature change, just like a wall mounted that has different time zones set through the day would. Is this possible with the webcontrol board?


Hello Cai,

Please see below.

I added other time slots, and tested them, by changing my time zone making the internal webcontrol clock think it was that time slot. They appear to work. As you can see I've added a time slot ahead of the one you originally created, between 00:01:00 and 05:00:00.

What I don;t understand is the GOTO THE58SKIP section, as you can see I've left them the same as per your original, but I don't understand what they do.

START
TSTLT CT 0:1:0
CALLSUB THERM005
TSTLT CT 8:0:0
CALLSUB THERM58
TSTLT CT 17:0:0
CALLSUB THERM0817
TSTLT CT 23:59:59
CALLSUB THERM1723
TSTEQ OP2 1
CALLSUB MAILON
TSTEQ OP2 0
CALLSUB MAILOFF
TSTEQ OP1[1000] 1
SET OP1 0
TSTGT IP1 0 EM1
NOP
END

THERM005:
TSTLT CT 0:1:0
GOTO THE58SKIP
TSTLT T1 680
CALLSUB HEAT_ON
TSTGT T1 700
CALLSUB HEAT_OFF
THE58SKIP:
RET

THERM58:
TSTLT CT 5:0:0
GOTO THE58SKIP
TSTLT T1 710
CALLSUB HEAT_ON
TSTGT T1 720
CALLSUB HEAT_OFF
THE58SKIP:
RET

THERM0817:
TSTLT CT 0:0:0
GOTO THE58SKIP
TSTLT T1 690
CALLSUB HEAT_ON
TSTGT T1 700
CALLSUB HEAT_OFF
THE58SKIP:
RET

THERM1723:
TSTLT CT 23:59:59
GOTO THE58SKIP
TSTLT T1 710
CALLSUB HEAT_ON
TSTGT T1 720
CALLSUB HEAT_OFF
THE58SKIP:
RET

HEAT_ON:
SET OP2 1
RET

HEAT_OFF:
SET OP2 0
RET

MAILON:
SET VAR2 0
TSTEQ VAR1 0
GOTO MAILON1
RET

MAILON1:
EMAIL EM2
SET VAR1 1
RET

MAILOFF:
SET VAR1 0
TSTEQ VAR2 0
GOTO MAILOFF1
RET

MAILOFF1:
EMAIL EM3
SET VAR2 1
RET
 
Hi Lets look the code:

Let me first explain how PLC logic works, then we can go through portion of your code to see how that works.
When you saved your PLC program into WebControl, WebControl will execute the PLC program from start to the end, one line at a time.
If it runs into "callsub" or "goto", it will brance to there and continue. When it finished all the code, it will go back to the
beginning to execute the first line after start again.

Now, lets see your code, from "start" to "end", you have these code:

START
TSTLT CT 0:1:0
CALLSUB THERM005
TSTLT CT 8:0:0
CALLSUB THERM58
TSTLT CT 17:0:0
CALLSUB THERM0817
TSTLT CT 23:59:59
CALLSUB THERM1723
TSTEQ OP2 1
CALLSUB MAILON
TSTEQ OP2 0
CALLSUB MAILOFF
TSTEQ OP1[1000] 1
SET OP1 0
TSTGT IP1 0 EM1
NOP
END


So after start, it will run the first line:
TSTLT CT 0:1:0 <--- which check if current time is less than 0 hour, 1 minute and 0 second.
If true, it will execute next line
CALLSUB THERM005
If it is not true, it will skip this line and execute next line, which is
TSTLT CT 8:0:0

You can see if time is after 0 hour 1minute, you don't have any logic to cover that period of time.
I think you actually want to check if the CT is 5:0:0, isn't it?

I wrote this sunroutine for you earleir based on your specified temperature range between 5AM to 8AM:
THERM58:
TSTLT CT 5:0:0
GOTO THE58SKIP
TSTLT T1 710
CALLSUB HEAT_ON
TSTGT T1 720
CALLSUB HEAT_OFF
THE58SKIP:
RET

You can see if time is before 5AM, this subroutine will simply skip control the temperature and return.
It expect your have another subroutine to take care that time period.

In your
THERM0817:
TSTLT CT 0:0:0
GOTO THE58SKIP
TSTLT T1 690
CALLSUB HEAT_ON
TSTGT T1 700
CALLSUB HEAT_OFF
THE58SKIP:
RET

You check if time is less than 0 hour 0 minute and 0 second, then just jump to THE58SKIP. That is wrong,
since you don't want to handle any time before 8AM, you should use "TSTLT CT 8:0:0" instead.
You have several label use same THE58SKIP, which is not allowed. You have to define your own label for
each subroutine. If this routine is handle from 8AM to 17PM, then you may name your label in this routine
as SKIP817, or something unique.


At the end of main function, you correctly added a NOP:
TSTGT IP1 0 EM1
NOP
END

Since if you do not have the NOP, when TSTGT is not true, it will skip next instruction. When the next instruciton
is "END", it will skip the first line of the main program after "START".


Hope this helps.
 
Hi Lets look the code:

Let me first explain how PLC logic works, then we can go through portion of your code to see how that works.
When you saved your PLC program into WebControl, WebControl will execute the PLC program from start to the end, one line at a time.
If it runs into "callsub" or "goto", it will brance to there and continue. When it finished all the code, it will go back to the
beginning to execute the first line after start again.

Now, lets see your code, from "start" to "end", you have these code:

START
TSTLT CT 0:1:0
CALLSUB THERM005
TSTLT CT 8:0:0
CALLSUB THERM58
TSTLT CT 17:0:0
CALLSUB THERM0817
TSTLT CT 23:59:59
CALLSUB THERM1723
TSTEQ OP2 1
CALLSUB MAILON
TSTEQ OP2 0
CALLSUB MAILOFF
TSTEQ OP1[1000] 1
SET OP1 0
TSTGT IP1 0 EM1
NOP
END


So after start, it will run the first line:
TSTLT CT 0:1:0 <--- which check if current time is less than 0 hour, 1 minute and 0 second.
If true, it will execute next line
CALLSUB THERM005
If it is not true, it will skip this line and execute next line, which is
TSTLT CT 8:0:0

You can see if time is after 0 hour 1minute, you don't have any logic to cover that period of time.
I think you actually want to check if the CT is 5:0:0, isn't it?

I wrote this sunroutine for you earleir based on your specified temperature range between 5AM to 8AM:
THERM58:
TSTLT CT 5:0:0
GOTO THE58SKIP
TSTLT T1 710
CALLSUB HEAT_ON
TSTGT T1 720
CALLSUB HEAT_OFF
THE58SKIP:
RET

You can see if time is before 5AM, this subroutine will simply skip control the temperature and return.
It expect your have another subroutine to take care that time period.

In your
THERM0817:
TSTLT CT 0:0:0
GOTO THE58SKIP
TSTLT T1 690
CALLSUB HEAT_ON
TSTGT T1 700
CALLSUB HEAT_OFF
THE58SKIP:
RET

You check if time is less than 0 hour 0 minute and 0 second, then just jump to THE58SKIP. That is wrong,
since you don't want to handle any time before 8AM, you should use "TSTLT CT 8:0:0" instead.
You have several label use same THE58SKIP, which is not allowed. You have to define your own label for
each subroutine. If this routine is handle from 8AM to 17PM, then you may name your label in this routine
as SKIP817, or something unique.


At the end of main function, you correctly added a NOP:
TSTGT IP1 0 EM1
NOP
END

Since if you do not have the NOP, when TSTGT is not true, it will skip next instruction. When the next instruciton
is "END", it will skip the first line of the main program after "START".


Hope this helps.

Hello Cai,

Yes, this makes sense, thank you for the explanation.

Please have a look, but I believe I have everything set correctly.

START
TSTLT CT 5:0:0
CALLSUB THERM005
TSTLT CT 8:0:0
CALLSUB THERM58
TSTLT CT 17:0:0
CALLSUB THERM0817
TSTLT CT 23:59:59
CALLSUB THERM1723
TSTEQ OP2 1
CALLSUB MAILON
TSTEQ OP2 0
CALLSUB MAILOFF
TSTEQ OP1[1000] 1
SET OP1 0
TSTGT IP1 0 EM1
NOP
END

THERM005:
TSTLT CT 0:0:1
GOTO THE05SKIP
TSTLT T1 680
CALLSUB HEAT_ON
TSTGT T1 690
CALLSUB HEAT_OFF
THE05SKIP:
RET

THERM58:
TSTLT CT 5:0:0
GOTO THE58SKIP
TSTLT T1 710
CALLSUB HEAT_ON
TSTGT T1 720
CALLSUB HEAT_OFF
THE58SKIP:
RET

THERM0817:
TSTLT CT 0:0:0
GOTO TH817SKIP
TSTLT T1 690
CALLSUB HEAT_ON
TSTGT T1 700
CALLSUB HEAT_OFF
TH817SKIP:
RET

THERM1723:
TSTLT CT 17:0:0
GOTO T1723SKIP
TSTLT T1 710
CALLSUB HEAT_ON
TSTGT T1 720
CALLSUB HEAT_OFF
T1723SKIP:
RET

HEAT_ON:
SET OP2 1
RET

HEAT_OFF:
SET OP2 0
RET

MAILON:
SET VAR2 0
TSTEQ VAR1 0
GOTO MAILON1
RET

MAILON1:
EMAIL EM2
SET VAR1 1
RET

MAILOFF:
SET VAR1 0
TSTEQ VAR2 0
GOTO MAILOFF1
RET

MAILOFF1:
EMAIL EM3
SET VAR2 1
RET
 
Back
Top