Announcement

Collapse
No announcement yet.

Newbie General Programming Questions and timers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie General Programming Questions and timers

    I am completely new to the PLC world , Productivity Suite and P3000 series. I have gotten as far as setting up my hardware, generally understand the tags and general concept but have a few questions:

    1] I understand I have to scale (or should) my 4-20 mA inputs. What rungs do I put these on? Should my first number of rungs simply be all my scaling or do you put them on a rung prior to actually utilizing the data in the following rung? Does it matter? Or should I create a "New task" and put all my scaling in there to keep it out of my logic

    2] Am I understanding timers correctly? I'm using a Compare value to look at a temp vs setpoint with a greater than tag called "System Enable".
    On the next rung, I have a NO contact called "System Enable" before my timer to enable the timer.
    Does the "Done" value of a timer determine the state of a NO or NC contact? So if its NO the "Done" tag closes it and if it's NC then the Done opens it?
    I need a minimum off time on a fan.
    On my first rung I have a NO Fan Enable enabling my Min Off Timer. Using the Off delay of this I'm toggling a NC contact in the next rung.
    On my next rung I have a NO Fan enable and then a NC Off Timer
    My thought is that the NC would open for the off delay period and then return to the closed position. Is this correct?

    3] Speaking of compares, If I use the Compare Values that is in Data Handling, is this properly used in that it gives me a tagged point (s) to use as NO or NC contact blocks that I can use where I need in my logic to make multiple events happen as opposed to the compare contact which sits on a rung within my logic and can only be used on that rung? It also allows me to use the tag as a status of the result?


    4] As far as monitoring any of my inputs, do I need to create a rung for each input I want to view on a Cmore or HMI? For instance, we monitor the H-O-A switch. Do I need a NO contact for my Hand position to enable an Out Coil tagged Hand Position?

    I'll probably have a bunch more questions as time goes on but these are it for now,

    Hopefully my questions make sense.

    Thanks in advance

    Jack

  • #2
    I lay out my tasks like this:

    Click image for larger version  Name:	ProductivityTasks.png Views:	0 Size:	15.0 KB ID:	127018

    Scaling is part of my "continuous math calculations" I have running. Though in the case of this program I also have an analog output that I scale to in the "Final Step" task. I did it that way because I can manipulate the data in one of the tasks under certain conditions if I want before it gets to "final Task" and scales to the analog output. You dont have to do it that way b ut thats how I did it for this one program.



    I think you are understanding timers correctly. The way you described it seems correct when I think about it right now.



    I never use the compare values instruction, I just use compare contacts so IDK on that one.



    Your HMI can read the input point directly. You dont need to put it in the ladder area doing nothing just to monitor it on an HMI. You can find the address for the input poiint in the tag database. And in the HMI the tag should be told to use that address.

    Comment


    • #3
      1) As a general rule you want your first task to be inputs and your last to be outputs. That way the first thing the logic does is read the ins then you process everything and write the final outs and no other changes can be made to the output till the next scan. It is also a good practice to copy all direct inputs to an internal tag to de-couple. As in digital in 1 is a normally open tag that goes to an output for internal memory, then you use the internal memory one for all your logic and never directly read the input. Same for outputs where you have a normally open tag that is before the output. Same idea for Analog values. with scaling to human readable on in and scaling to 4-20 on out.

      2) Can you screen cap your logic? Easier to understand.

      3) Not quite sure what you are trying to ask here. Can you try that again?

      4) You can use the internal tags for display unless you need them protected and then you can use a different tag and move it around internally with a copy data.

      Comment


      • #4
        Thanks for the responses.

        So I now have this with my inputs scaled, outputs scaled and decoupled?

        Click image for larger version

Name:	2019-12-06_062111.jpg
Views:	282
Size:	11.7 KB
ID:	127027


        Just to be sure, is this what you meant by de-coupling?

        Click image for larger version

Name:	2019-12-06_062717.jpg
Views:	273
Size:	52.3 KB
ID:	127028





















        2] Timer Logic for Min off Time and Min On Time
        3] Rung 1 is what I am using to compare values as opposed to a compare contact (CMP). My assumption is that I have a tag as a result. In this case, "Enable System"


        Click image for larger version

Name:	Logic 1.jpg
Views:	272
Size:	130.4 KB
ID:	127029


        Thanks

        Comment


        • #5
          Look at the "Debounce Coil" (DBN) instruction which does all that timing for you.

          Comment


          • #6
            That is the de-coupling!
            The PID with the Enable rule looks redundant. If it is below SP the PID should be working, having it kick on at SP seems like it defeats the purpose. If you setup 2 timers, one controlled by a normally open "Fan Enabled" and one controlled by a normally closed "fan Enabled" You could use those to to toggle control.

            Comment


            • #7
              Originally posted by MikeN View Post
              I never use the compare values instruction, I just use compare contacts so IDK on that one.
              ^ Yeah. I don't use them either. For this instance, it is another box output instruction to do the same thing that the inlines ---]>=[--- or ---]>[--- can do.
              Even if I wanted the other status bits, I probably would use the numeric compare contacts anyway.
              If I had many places where I needed the comparison status bits, then maybe.

              Originally posted by MikeN View Post
              Your HMI can read the input point directly. You dont need to put it in the ladder area doing nothing just to monitor it on an HMI. You can find the address for the input poiint in the tag database. And in the HMI the tag should be told to use that address.
              ^ Yes. You are not hurting anything doing this, but if you change this input, you have three places to make the edits (2 in plc, 1 in hmi)
              In some cases, this can be useful: e.g., you want to flash the input status at an interval/color scheme other than what CMORE has built-in.
              Last edited by kewakl; 12-06-2019, 01:45 PM.

              Comment


              • #8
                Am understanding the the tag I use for "Done" in a timer could be an alarm as well as a NO contact in which to trigger something else?
                So If I wanted an on delay for my alarm I could do something like Temp --|>|---Setpoint----Simple Timer with Done being my Temp Alarm?

                Click image for larger version

Name:	Alarm Timers.jpg
Views:	244
Size:	67.3 KB
ID:	127346


                I also have a math question, how do I get the math editor to return an absolute value? I need to alarm when our valve position feedback doesn't match the actual command.
                Given that this is non critical and trying to account for minor variations between the two, I am using a deviation setpoint.
                So I'm using the Math Editor to subtract my feedback value from my command value but I need the output to be absolute to account for any negative values.
                Is this possible? I only see the ability to use the ABS function within the formula.


                Thanks

                Comment


                • #9
                  Originally posted by JackW View Post
                  Am understanding the the tag I use for "Done" in a timer could be an alarm as well as a NO contact in which to trigger something else?
                  Sure. You can use it however you want. Some people dont even use the done bit and instead use current value greater than or less than to trigger stuff and just let the timer keep running for long periods. Whatever works for your situation and style of coding is fine.

                  Here is an example of not even using the done bit to do things all on the same timer:

                  Click image for larger version

Name:	example.png
Views:	194
Size:	15.2 KB
ID:	127380



                  Originally posted by JackW View Post
                  I also have a math question, how do I get the math editor to return an absolute value? I need to alarm when our valve position feedback doesn't match the actual command.
                  Given that this is non critical and trying to account for minor variations between the two, I am using a deviation setpoint.
                  So I'm using the Math Editor to subtract my feedback value from my command value but I need the output to be absolute to account for any negative values.
                  Is this possible? I only see the ability to use the ABS function within the formula.
                  Couple ways you can probably get around this issue.
                  You could make two lines with math instructions doing the same thing. Run a check to find which tag is a larger value and activate the correct math instruction with your formula set up so that you always result in a positive number. That is how I do it on my machines and it is probably the most difficult method to do it now that I am really thinking about things.
                  There is also a data statistics instruction that has a standard deviation output type. I dont remember the specifics of this instruction but you may be able to simply feed your tag values into this and it may always result in a positive value of the deviation between your values.
                  A third way is to do your math, check the result and if it is a negative number (run a contact for the result is less than 0) then feed it into a second math instruction and invert your negative number into a positive.

                  Honestly on that last suggestion, you may even be able to write your initial math expression in a way that it checks for being negative in the expression and then if so multiplies by -1. Im not sure if Productivity can do that but I bet Do-More could. Ive honestly never tried it.
                  Last edited by MikeN; 12-31-2019, 12:50 PM.

                  Comment


                  • #10
                    Concerning how to check for setpoint deviation, the following two lines should accomplish what you're trying to achieve. Click image for larger version

Name:	EXAMPLE.PNG
Views:	166
Size:	7.5 KB
ID:	127388
                    Attached Files

                    Comment


                    • #11
                      Thanks for the responses guys!

                      MikeN: Thanks for the clarification In my case, I wanted to have my point be in alarm for a specific period of time before initiating the alarm and figured with the "done" i wouldn't to create another rung for the alarm itself given that it was simply a datapoint and not a physical output.

                      RBPLC: So in your example, the abs is basically declaring that the following formula will be absolute? I was wondering if that would work. Just curious why there's 2 sets of parenthesis? When I insert the tags I only get one.

                      Once I get some hardware I'll be able to test this stuff.

                      Thanks

                      Comment


                      • #12
                        Originally posted by JackW View Post
                        Thanks for the responses guys!

                        RBPLC: So in your example, the abs is basically declaring that the following formula will be absolute? I was wondering if that would work. Just curious why there's 2 sets of parenthesis? When I insert the tags I only get one.
                        I'm not sure I exactly understand your question. The MATH statement is simply the absolute value of the difference between the setpoint and your feedback. 1 set of parenthesis is all that is needed. It is equivalent to saying: SETPOINT_DEVIATION = ABS(ACTUAL_SETPOINT-FEEDBACK_POSITION).
                        Last edited by RBPLC; 01-06-2020, 05:28 PM.

                        Comment


                        • #13
                          RBPLC - he was noting that in your graphic of the MATH command two sets of parentheses surround the argument for the ABS function.
                          thePLCguy

                          Bernie

                          Comment


                          • #14
                            Try this code below. I tested and it works real well. Very easy to read. Also look at rung 6. Instead of using the compare instruction this is much more readable also.

                            Click image for larger version

Name:	Capture.JPG
Views:	108
Size:	101.2 KB
ID:	127677

                            Comment

                            Working...
                            X