RSLogix 5000 Creating a Triangle pulse Ladder Logic

Thanks. How about the tag for the "RampingOn" input should I make the tag my timer1 from the flasher program or make it a bool and toggle the bit manually.

Also when I do finally create a trend which tag do I use? RampTimer.ACC?
 
Yes, it can produce the slope you show in the picture. Zoom in on it, what do you see? At some level there will be these steps.

1010101: bernie_carlton already made the comment, but you cannot create a "perfect slope" using a PLC without another dedicated card to do so. You are limited to scan time, and when it updates the next value. There will always be a sawtooth ridge to it.

As for trending, according to your program, you are looking to trend RampSetpt
But be careful, if you found that program on the forums, and intend on submitting it for your lab, that would be plagiarism (n)
 
It's okay, I've shown the program to my professor and mentioned where I got it. He said that was fine and I think he was actually happy that I was researching the lab outside of class.

I know my cpt equation is wrong but right now when I create a trend for RampSetPt it is just a flat line. Is that because of my cpt equation?

Also still curious about the RampingOn tag
 
I am still working out the CPT equation. I made my Begin_Point 0 and my End_Point 100. Right now I have the "RampingON" XIO tag with my Timer1.DN [ON_OFF]. The problem is that the the begin point starts at 0 then goes up to 100 and never goes back to 0 so the ramp only goes up
 
Last edited:
back in the atari days i did zig zags with the modulo function. i was very performance concerned on that little thing. i always tried to pack as much code and data as possible into the smallest space. Using modulo with a continuously increasing value causes a repeating ramp (sawtooth) and then you offset it by half and take the absolute value to invert the part below zero like Troy showed. This lets you use a continuously increasing source value, no need to keep track of direction or reset it at the period, just make sure the rollover is a multiple of the period. I don't remember exactly how it ended up just throwing a distraction at you...
 
Last edited:
Hey guys I got this program running. i am taking the trend at RampTimer.acc, it is a ramp, but a saw tooth not triangle. is there anyway to modidy this into an actual triangle? Can I take the second rung and invert it to make the ramp down?

Edit:I think I am creating the trend with the wrong tag?

To answer your first question: yes.

If you look carefully at the piece of code you found, and read the comments, you will see that it is designed to ramp either direction, based on the limit checking in rungs 2 and 3.

You are on the right track with your second question, thinking of inverting the 2nd rung (rung 1). But you don't need another rung, and you don't need to modify it, just modify the information you are feeding into it.

What is the relationship of Begin_Point to End_Point if ramping up? End point is higher, no? So how should that relationship change, if you want to ramp down?

Now, how do you know that it is time to change your ramp direction? What is your trigger? Remember, Troy's code was not designed to fulfill your lab requirements. It was simply intended as a ramp generator. It certainly has the capability of generating a triangle pulse, but you have to help it along.

I'll give you a hint. Whenever you want your triangle pulse outputting, your timer needs to run continuously, and self-reset when timed out. Now let's make a list of steps of operation for our program (This is the most important step in writing code)

Step 1: Start RampSetpt at Begin_Point.
Step 2: Begin Timer
Step 3: As timer times, RampSetpt increases from Begin_Point to End_Point
Step 4: Timer completes
Step 5: Reset Timer
Step 6: Invert Begin_Point and End_Point
Step 7: As Timer times, RampSetpt decreases from Begin_Point to End_Point.
Step 8: Timer completes
Step 9: Reset Timer
Step 10: Invert Begin_Point and End_Point.
Step 11: Rinse, Repeat. Go to Step 1

Try to turn these steps into ladder. You should only need a couple more rungs added to what you already have. You're going to need a couple of holding registers for your Begin_Point and End_Point as they swap places. Post back with your results when/if you get stuck.
 
Also still curious about the RampingOn tag
I don't mean to seriously butt in here, but! RampingOn is simply a switch that tells the PLC that you want the Ramp to go ON. In other words, hook something to the RampingOn bit that will turn on RampingOn....wait for it....when you want the Ramp On!
Right now I have the "RampingON" XIO tag with my Timer1.DN [ON_OFF].
You definitely should not do that.
 
Last edited:
Or, since you are in a laboratory and have Logix5000 connected and are online, right click on RampingOn and pick toggle bit to turn the bit on and start ramping. Its a tag name for a boolean, not some special instruction.
 
Or, since you are in a laboratory and have Logix5000 connected and are online, right click on RampingOn and pick toggle bit to turn the bit on and start ramping. Its a tag name for a boolean, not some special instruction.

This is what I ended up doing

To answer your first question: yes.

If you look carefully at the piece of code you found, and read the comments, you will see that it is designed to ramp either direction, based on the limit checking in rungs 2 and 3.

You are on the right track with your second question, thinking of inverting the 2nd rung (rung 1). But you don't need another rung, and you don't need to modify it, just modify the information you are feeding into it.

What is the relationship of Begin_Point to End_Point if ramping up? End point is higher, no? So how should that relationship change, if you want to ramp down?

Thank You for the help bmacattack33. The steps you wrote were very helpful. With my professors help I was finally able to get it. We also now have the task of making the same rampup/down with function blocks. I found the RMPS, but i need to look up more info. I'm not sure how to implement it yet.
 
Last edited:
RMPS is a PITA to use. It is so much simpler to use the y=mx+b line equation.

I can use the linear line equation with function blocks? Could I also just use a SCL block to do the same thing. I have no specific values I need to use, just up and down ramp.
 
Is this the result you are looking for (in the attachment).

I liked the idea of making an AOI. The input parameters are Amplitude and Time period in seconds. You can widen and lengthen your triangle as much as you want here.

This is running in a periodic 5 ms task. The faster the scan period, the "smoother" your triangle is going to look. The Trend is also sampling at 5ms. You want your defined time period T*1000/scan_period to be a whole number to not miss the "peaks". Interpretting timer.acc values are at the mercy of your scan period.

The internal code is in structured text, uses two line equations one for the positive part and one for the negative. The timer is cyclical, resets after completion of one period and repeats.

There is another very elegant way to do this without line equations using the integrator function block which is also an instruction that is available in structured text and function blocks but not in ladder. You would put in the rate of change as input to the integrator. Positive for the first half of the period and negative for the second.

Can you tell more about your class? Is this undergrad or graduate level. I never had a class like that although I did have a couple of PLC classes in school.

Triangle.jpg
 
Last edited:
Is this the result you are looking for (in the attachment).

I liked the idea of making an AOI. The input parameters are Amplitude and Time period in seconds. You can widen and lengthen your triangle as much as you want here.

This is running in a periodic 5 ms task. The faster the scan period, the "smoother" your triangle is going to look. The Trend is also sampling at 5ms. You want your defined time period T*1000/scan_period to be a whole number to not miss the "peaks". Interpretting timer.acc values are at the mercy of your scan period.

The internal code is in structured text, uses two line equations one for the positive part and one for the negative. The timer is cyclical, resets after completion of one period and repeats.

There is another very elegant way to do this without line equations using the integrator function block which is also an instruction that is available in structured text and function blocks but not in ladder. You would put in the rate of change as input to the integrator. Positive for the first half of the period and negative for the second.

Can you tell more about your class? Is this undergrad or graduate level. I never had a class like that although I did have a couple of PLC classes in school.

undergrad-industrial automation. It's the first and only PLC class I have taken in my EE undergrad. I hate not having the RSLogix5000 program on my laptop so I can practice.


So did you say I could use the integrator function block to make the ramp? If possible how?
 

Similar Topics

I only have one machine here with a ControlLogix PLC. It uses firmware 20.04 and I have RSLogix 5000 Full Edition. I am experienced with RSLogix...
Replies
13
Views
10,284
Hi guys I have been working at the same company for 10years , and I would like to try and make the engineers job easier in the fault finding plc...
Replies
1
Views
1,469
In function block programming I am wanting to be able to select from 4 different flow meter tags to point to an equation depending on the mix tank...
Replies
1
Views
2,835
I was just wondering if someone might be able to help. I am trying to create a new Structured Text routine in RSLogix 5000. However when I go to...
Replies
3
Views
4,015
Hello, I am trying to read a barcode scanner input using a cognex dataman 280 barcode reader, store it another string, the compare with another...
Replies
1
Views
62
Back
Top Bottom