PL7 Pro Programming Fast Counting Card

Mantis78 Posted messages 7 Status Member -  
Mantis78 Posted messages 7 Status Member -
Hello,

I come here seeking help because I'm working on a project for my second year of BTS where I need to do programming in PL7 pro.

Let me explain: I need to display the speed of a motor shaft (1500 rpm max, 2 rotation directions) on a Magelis screen using a 1024-point per revolution encoder (model RI58-D/1024ED.371B).
The API used is a TSX 3722 along with a high-speed counting card TSX CTZ 2AA because the API cannot count such a high frequency (f = 25.6 kHz for 1500 rpm).

As this is my first time working with PL7 pro, I am asking for your help to find out how to successfully complete this part of my project.

Thank you in advance
Configuration: Windows XP Internet Explorer 7.0

5 answers

bigburns Posted messages 21 Status Member 15
 
To solve your problem, you have no choice,
since your card only accepts 500KHz.
The only solution is to use an encoder that does not exceed
200 points per revolution.

Why do you want to use a 1024-point encoder?
2
Mantis78 Posted messages 7 Status Member
 
Hello,

The coder I have was imposed on me, the quick comtage card as well. By the way, are you sure it only accepts 500KHz? Isn't it rather that it accepts up to 500KHz?
My biggest concern is mainly the programming :-(

Thanks
0
bigburns Posted messages 21 Status Member 15
 
I don't know where you found %ID3.11.0? Rather try: %ID3.0 if encoder on channel 0 or %ID3.1 if encoder on channel 1. Your calculation principle is good, provided that your step X14 lasts only one polling cycle. Otherwise, you will make your calculation as long as %S6 is equal to 1, which could be for 0.5 seconds. Your value will always be in motion. Since the magelis will retrieve this value in the background, you won't know when. So it will display anything. I don't understand your %MW24 magelis display. When you configure the magelis, you create a dialogue table. For example, parameters in the magelis. %MW20 = Page number displayed XBT -> API %MW21 = Page to process XBT <-> API %MW22 = Alarm table XBT <-> API In the PLC, you just need to put in %MW21 the page number where there is the message containing your speed variable (%MD2), and it will read it automatically. For your calculation, it's better to use a double word. Because it's not a calculator, it won't tell you if there's an overflow and you'll end up with anything. Note that if you use %MD2, it gives %MW2 = low word of %ID2 %MW3 = "high word of %ID2. If you just need to display the speed, why bother with a grafcet?
2
Mantis78 Posted messages 7 Status Member
 
I tried %ID3.0 and it works.

Actually, I use the grafcet just for starting my motor, and %X14 corresponds to the step where it starts.
For the Magelis, you are indeed right, %MW24 has no place there, I will take %MD2.

For the calculation of %S6, I wanted the programmable logic controller to count for 0.5 or 1 second but restart when it finishes, this way I would have a pretty good refresh rate for the speed. So if I understand correctly, it might keep counting over and over again?
0
bigburns Posted messages 21 Status Member 15
 
Yes, that's good up to 500KHz. I'm sorry, but I made a calculation error; your counting card is more than sufficient. Since it accepts 500,000 pulses/s and the encoder will give 25,600 pulses/s at 1500 RPM. To convert encoder pulses into speed, you just need to take the system bit %S6, which has a time base of one second between two rising edges. You set a preset encoder value of 0. - Rising edge %S6 validates the preset bit to have the current encoder value = 0 - Falling edge %S6, load encoder value %IDx.0 into %MD1 depending on the direction of rotation; %MD1 will be positive or negative, if negative multiply by -1. From there, you know the number of pulses in 0.5s. Then you just need to convert it to RPM, which you place in %MD2. In the display, you just need to retrieve %MD2.
1
Mantis78 Posted messages 7 Status Member
 
A response like that is pleasing, tomorrow morning I'll tackle PL7 pro ^^


Thank you very much bigburns
0
Mantis78 Posted messages 7 Status Member
 
I worked on it today and I had some understanding issues.

For the encoder preset value, I set it to 0, but afterward for the rising edge %S6 I don't know where we validate the current value of the encoder.
For the falling edge it's the same, I don't know where we change the encoder value %IDx.0 in %MD1.
0
bigburns Posted messages 21 Status Member 15
 
In trying to add a second computer to my network at home, I messed things up and lost connection. But here I am again. In the preliminary: - Transforming the system bit %S6 into an internal bit (to allow the use of edges) - Validation counting card - If the measurement is invalid (%Iwx.i.2:X7), load the preset value on edge %S5 with a time base of 100ms - Load the preset value on the rising edge %S6 - Load the encoder value on the falling edge %S6 into %MD1 - Calculation Example: Knowing that x = rack position in the PLC i = encoder channel (0 or 1) %S6 |---| |------------------------------------------------------(%M6)-| |----------------------------------------------------------(%Qx.i)-| %IWx.i.2:X7 %S5 |----| |-----------| |---+-------------------------------(%Qx.i.1)-| | %M6 | |----|P|-----------------+ %M6 operation |--|N|-----+----------------------------------------[%MD1:=%IDx.i]-| | comp operation +--[%MD1<0]-----------------------------[%MD1:=%MD1*-1]-| For the calculation, knowing you have 25600 pulses/s for 1500 rpm, for a time base of one second. As in the example we are in a time base of 0.5s, we will therefore have 12800 pulses for 1500 rpm. Then just do the rule of three, but to avoid calculation overflow 12800 ==> 128 1500 ==> 15 This gives: operation |------------------------------------------[ %MD2:=(%MD1*15)/128 ]-| For the display, just add a field and place the variable %MD2 and that's it. It should be noted that I am proposing a solution here, and not the solution. Each programmer has their own tricks.<code>
</code>
1
Mantis78 Posted messages 7 Status Member
 
Hi,

Thank you for your response, it's much clearer.

Ultimately, I was thinking of programming this:

%X14 %M6 operation
|--| |-----------| |------------------------------------[%MW24:=(%ID3.11.0*1500)/6400]---|

%X14 corresponds to the step of the grafcet where the speed should appear.
%MW24 corresponds to the display of the Magelis.
ID3.11.0 corresponds to the input variable of the encoder signals, but even like that PL7 Pro doesn't want to validate it for me, even though I put the correct rack (3) and .11.0 is written in the PL7 help...
Then for the formula, I applied the rule of three.
For the setting, I just put counting because if it only counts, the direction of rotation will matter little as long as there are rising edges.

My teacher told me that it was fine, but since he checked it quickly, I have some doubts...

What do you think?

I will study your suggestion well because tomorrow I have the oral exam and I will try to finish this part :-)
0
bigburns Posted messages 21 Status Member 15
 
The problem is not there. Since it takes you 0.5s to know the motor speed, and in your example %MD2 will vary during 0.5s. And you cannot know when the Magelis will take it. Your displayed value will be random. In this case, you must necessarily use a front. Apparently, you have a problem with fronts!!! Example: %S6 |--| |-----------------------------------------------------(%M6)-| %M6 %X14 |--| P or N |-------| |-------------[ %MD2:=(%ID3.0*1500)/6400 ]-| As long as step X14 is active, the calculation will be done. So refreshing every second in the TSX. The Magelis has a refresh rate of about every second, so there's no point in going faster. I set M6 to rising or falling edge because I don't know when you load the preset value. Be careful, it must be reloaded at each edge.
1
Mantis78 Posted messages 7 Status Member
 
Oh yes, me and rising fronts are two different things... :-)

I wanted to thank you so much Bigburns because I passed my oral exam and thanks to your advice and remarks I had no issues in front of the jury.
Even though I couldn't get the Magelis mode to work because the API was acting up, I was able to explain how it works via PL7 pro.
In any case, I am very happy that at the last moment, someone like you helped me with the coder.

Thanks again!!

Sincerely,
Alex
0