Guidance required in Temp and Humidity calculation - PLC

nitin100

Member
Hello
Please guide in achieving the following(controlling only TTL1, TTL2)
 
Temp Sensors 1-5, Humidity sensor H1.
TTL1 and TTL2 should never be on simultaneously.
 
/Logic-
 
If H1>80, TTL1=0, TTL2=0 don't process below and wait for H1 <80
If H1<80
Then
T0=(T1+T2+T3)/3
If T0-T4>0, TTL1=1, TTL2=0
If T0-T5>0, TTL2=1, TTL1=0
Pause 60Sec
 
/EndLogic
 
TTL1 and TTL2 drive motors, therefore 60Sec pause.
Am I missing something?(like bouncing etc) I believe bouncing protection required when Humidity is 80%
 
Edit = Bouncing is hysteresis (ie, the motors donot switch on and off)
 
START
CHECK_HUMIDITY:
SET VAR1 H1 #VAR1=HUMIDITY
TESTLT VAR1 80 # CHECK IF HUMIDITY IS GREATER THAN 80 -IF YES DONT MOVE FROM HERE
GOTO CHECK_HUMIDITY
CHECK_AIR_TEMP:
SET VAR2 T1 # T1 IS LEFT SIDE
SET VAR3 T2 # T2 IS RIGHT SIDE
SET VAR4 T3 # T3 IS TOP
T1 ADD T2 VAR5
VAR5 ADD T3 VAR6
VAR6 DIV 3 VAR7 # VAR7 IS AVAERAGE TEMP OF 3 SENSORS
CHECK_LEFT_EXHAUST:
SET VAR8 T4 #VAR8 IS LEFT EXHAUST
CHECK_RIGHT_EXHAUST:
SET VAR9 T5 #VAR9 IS RIGHT EXHAUST
MOTOR_LEFT_ON:
TESTGE VAR8 VAR7
SET OP1 1
DELAY 4000
TESTGE VAR8 VAR7
GOTO CHECK_HUMIDITY
MOTOR_LEFT_OFF:
TESTLE VAR8 VAR7
SET OP1 0
DELAY 4000
MOTOR_RIGHT_ON:
TESTGE VAR9 VAR7
SET OP2 1
DELAY 4000
TESTGE VAR9 VAR7
GOTO CHECK_HUMIDITY
MOTOR_RIGHT_OFF:
TESTLE VAR8 VAR7
SET OP2 0
DELAY 4000
END


 
 
 
 
 
RANT
Why does cocoontech uses forum software written by monkeys? This is the worst ever possible forum software I have ever seen. No pasting, linking etc
/RANT
 
Also(unrelated to this)
I want to record number of starts + hours run on each motor, which should persist through reboots.
In the manuals, I cannot see variables which can be incremented and persist through reboots.
 
Is it possible?
 
You can have an external EEPROM chip to store value you don't want to lose over the I2C bus.
We have some example code in this sub forum about how to talk to that EEPROM chip.  The module is not expensive at all
 

http://www.ebay.com/itm/111222845936


 
Please refer to this thread of discussion:
Code:
http://cocoontech.com/forums/topic/27001-ds1307-i2c-rtc-and-nvm/
 
nitin100 said:
Also(unrelated to this)
I want to record number of starts + hours run on each motor, which should persist through reboots.
In the manuals, I cannot see variables which can be incremented and persist through reboots.
 
Is it possible?
 
You could use webset commands to write to the 4 UROM variables, which will survive through a powerdown/reboot.
As they are 32-bit registers, you could use (say) upper 16-bits for time and lower 16-bits for counter, giving you 65535 starts + 65535 minutes before they wrap, * 4 motors.
Or use 2 UROMs for each of 2 motors and get 2^32 starts and 2^32 seconds run time!, only updating the counters periodically (perhaps each time they turn off?)
 
Some of your labels are too long, it is limited to 8 bytes.
Also, ADD  a   b    d
similar to a + b  = d
 
 
We limited UROM read only in PLC, because UROM is part of the EEPROM on board with 100,000 write cycles.
If a bug in PLC code kept writing to EEPROM, it could ruin it in few minutes. 
If the EEPROM is on external module, then you can replace that easily without losing configuration or program.
 
CAI_Support said:
We limited UROM read only in PLC, because UROM is part of the EEPROM on board with 100,000 write cycles.
Yes, but can't it be webset??
So if you set up a webset command with the webcontrol itself as the target, you could call webset within your PLC code and have it set its own UROM?
Or are you saying it can ONLY be set from the web interface itself, directly?
 
 
Edit:  From the manual:

from 3.02.17 firmware, WebControl supports manually set a UROM value from outside: http://192.168.1.15/api/seturom.cgi?varid=1&value=23456789
 
So if you set a local webset to talk to the boards own IP address, with this URI, surely it would allow the board to "set its own UROM values"?
Not withstanding the potential to damage the board, if used properly, it would be a useful feature.
 
Yes, Ross, it can be set on this path:

api/seturom.cgi?uromid=1&value=1234

However, the EEPROM has write cycle limit that can be a lot of mouse click by hand, but done with it in PLC in very short time.
 
Labels = MOTOR_RIGHT_OFF etc?
 
ADD command - Yes  - It will be corrected.
Any other mistakes you can find (can save me huge amount of time in debugging as I have no background in PLC kind of thing)
 
START
CHECK_H:
SET VAR1 H1 #VAR1=HUMIDITY
TSTLT VAR1 80
SET OP1 0
TSTLT VAR1 80
SET OP2 0
TSTLT VAR1 80 # CHECK IF HUMIDITY IS GREATER THAN 80 -IF YES DONT MOVE FROM HERE
GOTO CHECK_H
AIR_T:
SET VAR2 T1 # T1 IS LEFT SIDE
SET VAR3 T2 # T2 IS RIGHT SIDE
SET VAR4 T3 # T3 IS TOP
ADD T1 T2 VAR5
ADD T3 VAR5 VAR6
DIV VAR6 3 VAR7 # VAR7 IS AVAERAGE TEMP OF 3 SENSORS
LEFT_E:
#T4 IS LEFT EXHAUST
RT_E:
#T5 IS RIGHT EXHAUST
M_L_ON:
TSTGE T4 VAR7
SET OP1 1
DELAY 4000
TSTGE T4 VAR7
GOTO CHECK_H
M_L_OFF:
TSTLE T4 VAR7
SET OP1 0
DELAY 4000
M_R_ON:
TSTGE T5 VAR7
SET OP2 1
DELAY 4000
TSTGE T5 VAR7
GOTO CHECK_H
M_R_OFF:
TSTLE T4 VAR7
SET OP2 0
DELAY 4000
END


Final Code
 
You mentioned you want to store some user data, Ross recommended to use UROM.
I don't know if that fit your needs.  If you want to not modify the program, but only modify your temperature range, you can set UROM for your upper limit and lower limit.
In that way, when you change settings, you don't have to tweak the program, only modify the UROM value, using Ross' method or from browser in general tab.
 
Back
Top