Programing Help temp alarm for generator

Hello i just finished wiring up my web control to my generator. Output 1 goes to the start circuit on the generator, Output 2 goes to my alarm Buzzer, Input 1 goes to dry contacts to tell that the generator is running, and i have 2 temp sensors to measure air temp and oil temp... I would like to program the plc so that if input 1 is on and  temp  sensor 1 reaches 110 degreess or sensor 2 reaches 90 degrees  it will close the contacts on output 2 and sound the alarm and will do so untill input 1 dry contacts open again.
 
 
i have this much so far :
 
Start
End
 
 
would apreciate some help i an new to this type of plc programing Thanks Rob
 
this is what i have so far please let me know how it looks
 
START
CALLSUB checkOP1

OP1 1
TSTLE T1 400
CALLSUB ALARM_OFF
TSTGT T1 433
CALLSUB ALARM_ON
EMAIL EM1

OP1 1
TSTLE T2 400
CALLSUB ALARM_OFF
TSTGT T2 433
CALLSUB ALARM_ON
EMAIL EM2

END

ALARM_ON
SET OP1 1


ALARM_OFF
SET OP1 0
 
 
START   
LOOP:
    CALLSUB ALARM_OFF  
    TSTNE IP1 0 
    CALLSUB ALARM_OFF  
    TSTLE T1 300 
    TSTGT T1 VAR1 
    CALLSUB ALARM_ON  
    EMAIL EM1  
    CALLSUB ALARM_OFF  
    TSTLE T2 300 
    TSTGT T2 VAR2 
    CALLSUB ALARM_ON  
    EMAIL EM2
CALLSUB LOW_FUEL
EMAIL EM8 
    END
  

ALARM_ON:
    SET OP2 1 
ALARM_OFF:
    SET OP2 0    
LOW_FUEL:
TSTNE IP2 1

GOTO LOOP
 
 
HERE IS SOME IMPROVEMENT LET ME KNOW WHAT I CAN DO TO MAKE BETTER
 
is this the hole code? will look it over today but you need to end each callsubs with     ret 
 
LIKE THIS ?
 
START   
    CALLSUB ALARM_OFF  
    TSTNE IP1 0 
    CALLSUB ALARM_OFF  
    TSTLE T1 400 
    TSTGT T1 VAR1 
    CALLSUB ALARM_ON  
    EMAIL EM1  
    CALLSUB ALARM_OFF  
    TSTLE T2 400 
    TSTGT T2 VAR2 
    CALLSUB ALARM_ON  
    EMAIL EM2  
    CALLSUB FURNACE  
    EMAIL EM8  
    CALLSUB ALARM_ON  
    TSTNE IP3 1 
    TSTNE IP1 1 
    EMAIL EM3  
    END   

ALARM_ON:
    SET OP2 1
RET
ALARM_OFF:
    SET OP2 0
RET
FURNACE:
    TSTNE IP4 1
RET
 
will not work
 
email will be sent and will not stop
 
when temp get to hi do you want it to stop generator
 
 
what is on 
ip1
ip2
ip3
ip4
 
After playing around with this setup i decided to make some changes here is the current and final configuration
 
input 1 generator runing using dry contacts and relay to signal
input 2 exaust fan running signal using dry contacts
input 3 fuel low via dry contacts
input 4 furnace malfunction via dry contacts
 
output 1 is to turn the generator on via 5 volt relay
output 2 is a ssr to sound alarm and light
output 3 is a ssr that controlls the fan
 
temp sensor 1 is for room temp
temp sensor 2 is for engine block temp-air cooled engine
temp sensor 3 is for outside
 
em1 high room air temp
em2 high engine block temp
em3 fan failure
em4 furnace issue
em5 Generator high temp shutdown
 
analog 1- amp meter
analog 2-amp meter
 
here is what iam trying to accomplish
when the generator is running i want the fan to come on when the room reaches 100 degrees and shut off when it reaches 80 and i only want the fan to run when the generator is running, i would like to sound the alarm and sent a email if the fan fales to turn on,furnace trouble, the room tempature exceeds 140 or the engine block reaches 125 but i want to be able to change these temps via the varibles in the browser rather than in the code if posssible ? i would like to have the generator shut off if the temp exceeds 160 and send an email as well
 
i will be starting the generator via web browser manually on op1
 
if you could could you make
urom1- fan on temp
urom2-fan off temp
urom3- room alarm temp
urom4-block alarm temp
urom5-generator shutdown
it would make it easy to change the temp settings
thank you i have been trying to get this project done for almost a year i live off the grid and i need to manage my generator from work for the wife when iam not home
 
 
thanks Rob
 
thats a good idea then i would use the first 4 and not worry about generator shutdown as a varible, i spent a couple hours last night fooling with the programing but still having no progress
 
Pittmon,  UROM can only be set through two ways, gui, or from CGI call like set VAR, please see the readme section or user guide last section for details. We do not allow set UROM in PLC, that may not convenient for some, but UROM is on an EEPROM only allow couple thousand write cycles. If someone made mistake in PLC code, it would ruin the EEPROM in no time.
 
Robert,  PLC program runs from START to END, Then repeat again, over and over, never stop. You may consider to have a section of initialization after the START, then set a label LOOP or something, then before your normal running code reaches to the END, you can GOTO LOOP, so that you don't initialize all your variables in every loop.
 
Your first line after START is calling alarm off, that should be removed, since that will make alarm turn off in no time.  Then each time you turn on or off alarm and email, by checking the range. 
 
This forum blocked us from paste anything or upload anything to the board, for reason we don't know. So I can not modify your code and paste change on this reply.  Maybe you can change your code and paste up again, we can discuss.
 
Happy New Year and Thanks  to all customers and this forum!
 
something bizzar started happening today , i hooked up 2 new tempature sensors and now when i shart the generator it wipes out the web control programing completly and i have to restart it, could an em field effect the temp sensors causing a crach ?
 
WebControl during running, always do checksum for information read back from the EEPROM, to make sure its data is valid.  If it found the EEPROM checksum is not correct during start up, it will do an EEPROM check, that could cause the EEPROM being wipe out, if that check is failed.  Sound like your temp sensor is picking up a lot noises, those noise caused the CPU to restart and reading EEPROM faulty.  We have noticed WC8 boards temp sensor wire is very sensitive to environmental electrical noise, because the temp sensor 1-wire bus is directly connected to the CPU input pin.  Please pay great attention when running the 1-wire bus. Please do not run that 1-wire bus in a bundle of other power lines, if possible, do not even run in parallel nearby to other wires. Use cat5 cable for 1-wire bus, and having the signal wire in a pair with ground wire to reduce induced electrical noise.
 
If those steps are not able to fix the problem, you may need to add fast clamp diode to the 1-wire bus to filter the noise. Or change to use WC32 board, that board has dedicated 1-wire bus controller from MAXIM-IC to filter the noise.
 
Back
Top