Author Topic: Program leverage  (Read 10108 times)

ghammer

  • Guest
Program leverage
« on: June 01, 2005, 09:48:50 AM »
As a new developer with this product, I have a need for a rather basic program, and was wondering if someone doesn't alreay have a similar program that I could "leverage" and generate a fast start with some minor mods.  I need a program that will take 2 AI's (wind speed and wind direction), and based on the direction, and speed, be able to turn on DO's to control solenoids.  Anything similar out there you might be willing to share??

Thanks
Gary

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Program leverage
« Reply #1 on: June 01, 2005, 12:49:59 PM »
First, have a clock pulse that periodically check the AI for value and make decision:


  Clk:1.0s      Fn_#1
|--||-----------{dCusF}


With Fn_#1, do the following:

S = ADC(1) * xxx/ yy   ' convert to your scale for speed
D = ADC(2) * aa/bb    ' convert to you direction

IF S > ??   THEN
    IF D > ???
            SETIO OUT1
    ELSE
             CLRIO OUT1
     ENDIF
ENDIF

You will have to fill in the formula for analog conversion to your unit (See FAQ forum) and the If then else statement will need to be modified to make a decision on what you want to do, e.g.  turn ON or OFF an output with label name OUT1.

The above may be the complete program to do what you said you want to achieve. It is unbelievably simple, but it is real.



 
   
« Last Edit: June 01, 2005, 12:51:30 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS