3/2/2016 9:46 PM | |
Joined: 3/16/2015 Last visit: 10/10/2021 Posts: 1250 Rating: (173) |
|
3/3/2016 10:42 AM | |
Posts: 5225 Rating: (1194)
|
Putting personality profiles aside.. Step by step: (a little flawed but helpful) - - - let us start there for now |
3/3/2016 12:16 PM |
|
Posts: 1529 Rating: (202) |
Agreed, I just don't have the patience that you have. |
Last edited by: Jeff Casagrande at: 3/3/2016 12:33:49 PM |
|
3/3/2016 12:43 PM |
|
Posts: 5225 Rating: (1194)
|
Patience comes with age... |
3/5/2016 9:04 AM | |
Posts: 5225 Rating: (1194)
|
SOFTWARE: TIAP (TIA Portal) Updating the software is a good idea. https://support.industry.siemens.com/cs/document/109311724/ Step7 and WinCC is handled together (even if x2 components of TIAP), but the PLCSIM components needs to be installed on its own. For the simulator you have to have PLCSIM V13 SP1 Update 1. The bad news: Hardware related functions (HSC / PTO / PWM / communications / ++) cannot be simulated. For your purposes for the HSC (high speed counter) the simulator will not help you. But it will be helpful for the general coding. ENCODER HARDWARE It is likely that the encoder you have is "quadrature" type. But is can easily be the type where the A phase gives pulses when turning forward and B phase give pulses when turning reverse. The way the signal is given out also differs. There are differences in NPN and PNP signalled encoders. For the project sake you will have to know what it is. I will assume (because of not having enough info): quadrature PNP connected encoder where only A+ and B+ is connected to the PLC. It is your responsibility to make sure by looking at the specification sheet of the encoder or getting the "client" to tell you. The Z phase is triggered once per rotation. I will not spend time on this aspect. It will not be used now. As a bonus note.. if the actual encoder counts in the opposite direction as you want it - swap the wires A+ and B+. |
3/5/2016 9:58 AM | |
Posts: 5225 Rating: (1194)
|
Yes. |
3/5/2016 12:21 PM | |
Posts: 5225 Rating: (1194)
|
Much of the stuff is done by memory by now. What will also help you two guys.. If you do like my style of teaching... Request the system to show posts I was involved in by my user name. You can then narrow the search by "motion control" or "HSC" or something like that. w |
This contribution was helpful to1 thankful Users |
3/5/2016 7:55 PM | |
Joined: 3/16/2015 Last visit: 10/10/2021 Posts: 1250 Rating: (173) |
If you're not using the Z output don't worry about gated or ungated. That just describes the relationship between Z and A&B pulses. If it's an open collector then it's NPN and you will need to do as William mentioned in his post, add a pull-up resistor. |
3/5/2016 8:39 PM | |
Joined: 10/8/2015 Last visit: 9/5/2024 Posts: 62 Rating: (3) |
Ah! I see... This puts things on a different angle. I honestly wasn't expecting an NPN encoder. Nevertheless, I'll have to use a pull-up resistor, indeed as William_B aformentioned. For this type of signal input, I'm guessing the resistance should be around 0.5 W, 1k or 2.2 kohms. Some sources proposed 3.3 khoms even. Because I checked some forums, and they were usually referring to pull down, and not pull-up resistors. Which makes me wonder about the admittance and how easily it would be affected by outside noise, stray capacitance, and electromagnetic compatibility. Another thing that came to mind is about a interesting read I made some time ago. It's about using NEGATIVE resistance. It does completely oppose ohm's law, but there are diodes that are used for negative resistance, such as the Tunnel diode, and the Gunn diode, which are used for high speed microwave oscillations. Could reach about 100 GHz transition frequency if need be, though I'm not certain it would help my application. Another question: If I am to use the pull up resistor, should I connect them to both pins? (In this case it's I1.0 and I1.1, but I am reconsidering after what you guys told me.) For now the inputs are still the same. How many ohm resistance should I add, and how may I determine it in case it is highly variable? Note that I'm still using 20 us speed for the pulse detection on input. Since it is starting from IB1000, I'm assuming both inputs are actively working between addresses 1000 and 1003. I may need the CTRL_HSC, because it seems that the high speed counter MAY change its value during the operation automatically. Basically, instead of a user coming in and putting the new addressed value, the high speed counter will automatically change it into a predetermined value, and the process goes into an endless loop until stopped by the user. These values will be of course converted from distance to pulse, depending on the application, and will automatically be applied as the new value for the high speed counter. So, my questions:
(Thank you note: Thank you all for the information that you are all providing me. It is helping me immeasurably, and the links are indeed helpful (but I'm just stating the obvious here XD) |
3/5/2016 8:39 PM | |
Posts: 5225 Rating: (1194)
|
Pyrus - I am reacting still on the old post... You will cause yourself problems if you use I'll leave it to another person now to tell you why. |
3/5/2016 8:56 PM | |
Joined: 10/8/2015 Last visit: 9/5/2024 Posts: 62 Rating: (3) |
Oh... I see what you mean. I believe your concern is the response time from the High Speed Counter. In that case, I may have to use the CTRL_HSC after all, then. But it remains to be seen. I'll wait for the next responses |
3/5/2016 9:48 PM | |
Joined: 3/16/2015 Last visit: 10/10/2021 Posts: 1250 Rating: (173) |
Sorry, it's a Saturday and it's sunny out. The idea of using an open collector output is to source more current than a sourcing output can. The question is, did they choose it for that reason and the encoder is going to be placed a considerable distance from the CPU or is it just what was available. |
Last edited by: Kal.A at: 3/5/2016 9:49:43 PM |
|
3/5/2016 10:23 PM | |
Joined: 10/8/2015 Last visit: 9/5/2024 Posts: 62 Rating: (3) |
Oh hey. I'm only responsible for the programming wiring, but I would still like to know how to wire it from outside. Now, William_B said that using the comparison arithmetic operator is a bad choice, and left it for others to answer for its reason. Now, I'm assuming that it is possible that the comparison may not occur on time, and the high speed counter is too fast, and the condition may become bypassed, and will continue counting, reach the highest possible value, restart from the lowest possible value until it reaches the desired value once again and MAYBE stop this time. This is what I deduced. The programming part is most important for me however, which is why my focus is tending towards it. But again, it doesn't mean I should not know how to connect it on my own. So, here is basically how I want this program to work, and hopefully, I'll be able to draw the optimized and correct form of the ladder diagram I'm trying to get:
Programming part:
|
3/6/2016 12:55 AM | |
Joined: 3/16/2015 Last visit: 10/10/2021 Posts: 1250 Rating: (173) |
Hi pyurus, My apologies for not remembering all the details of you project and I will go back to read it thoroughly. AttachmentOrganization blocks of a CPU 1200.pdf (492 Downloads) |
Last edited by: Kal.A at: 3/6/2016 1:00:15 AM |
|
3/6/2016 1:15 AM | |
Joined: 3/16/2015 Last visit: 10/10/2021 Posts: 1250 Rating: (173) |
What are the details of the driver you mentioned? You may not need resistors at all. |
3/6/2016 1:40 AM | |
Joined: 3/16/2015 Last visit: 10/10/2021 Posts: 1250 Rating: (173) |
|
3/6/2016 8:46 AM | |
Posts: 1529 Rating: (202) |
Yikes, looks like you are doing Feed Roll Control/Cut to Length using start/Stop. What are you using to drive your feed roll? As William_B alluded to, your cut command must be issued when your product is stopped at the proper place, which means you need a proper position control. If you trigger your stop solely on length, then there is additional distance traveled during the deceleration. Whether your are stopping by brake or by using a drive on your motor, you can't change this. Cut-to-Length applications are not trivial. You may want to give this a little bit more thought as to how it is executed. Trust me, 90% of what I do is cut-to-length is some form. |
This contribution was helpful to1 thankful Users |
3/6/2016 10:32 AM | |
Joined: 10/8/2015 Last visit: 9/5/2024 Posts: 62 Rating: (3) |
I see what you mean. Even with the brake on the motor, it may still be too slow. Very well then. Is it possible to use the High Speed counter hardware interrupt to stop both motor and trigger the break simultaneously to make it on time? |
3/6/2016 10:49 AM | |
Posts: 1529 Rating: (202) |
What are you using to drive the motor on your conveyor or feed roll? Motor with drive or simple contactor control? |
This contribution was helpful to1 thankful Users |
3/6/2016 5:39 PM | |
Posts: 5225 Rating: (1194)
|
Hi Team, Much conversation has taken place.. good! Thank you Kal and Jeff for your contributions. First to keep with the original topic and @Pyrus: 1. Encoder wiring Your employer can handle the wiring of the encoder. Using quadrature (A/B phase) mode is important to you. And yes.. keep to that. Many methods are available to convert open-collector to PNP. One should be careful for not distorting the encoder pulse. A pull-up resistor or negating buffer is the most simple. Go ahead and use <Kal.A> recommendations - it is what I do. ---- 2. Code: Target reached As mentioned --| == |-- will cause problems. Very good - you have correctly identified why. (A) You could simply use --| >= |-- to counter the problem. The "BUT" in this are: * Reset the HSC to zero at the start of each length feed. You can use the CTRL_HSC to do this zeroing (reset). * The requested length should not be more than +MAX (+2147483647) of what DINT can give. * The "error" you make in your measurement should not influence the process. (B) The alternative is configuring interrupt routines as <Kal.A> explained. A good solution which I rarely follow. Triggering of physical outputs rarely benefits the accurate trigger. Being fair.. I also use multiple triggers which is a pain to configure. (C) If you are not zeroing the HSC then you have to employ another idea. (Code segments in SCL for ease of text.. LAD also possible) Before beginning feed: (triggered once per feed) startPosition := myHSC; //start position is captured endPosition := startPosition + targetDistance //calculate end position While running the evaluation is done: positionReached := (endPosition - myHSC) <= 0; ----- Now we are morphing to what your application requires. What follows next is not to the original topic,,,,,, w |
3/6/2016 5:39 PM | |
Posts: 5225 Rating: (1194)
|
dummies!! |
3/7/2016 1:12 AM | |
Joined: 10/8/2015 Last visit: 9/5/2024 Posts: 62 Rating: (3) |
Wow... This really isn't as simple (in system design) as I thought it would be. The problems are slowly being revealed like moths to a flame, and it worries me. I don't even know what the speed of the motor is, o consider if the breaking system would indeed be safe or not. Exactly as you guys mentioned: "Crash test dummies". Specially if there are stacks of paper, they will definitely fall in given at a high speed. What I'm thinking about is motion control. I do hope this works though. I will have to define an offset to the counter so that the motor stops on its own, due to the weight of the papers. Let's say (depending on the size) it should be 1500 pulses, I'll give it an offset of 100 pulses, so that it reaches 1400 (and due to some inertia, may cross a bit a more, but that is to be expected). Now, the next step that I'm thinking is always using comparison instructions so that the motor slowly and with many triggers and stops covers the last pulses it's supposed to cover. For example: Let's say it reached 1462 pulses. 38 pulses remaining. I use comparison instruction to give immediate start and stop responses to the motor so that it covers the needed pulses. I'll put multiple stops for most possible accuracy, and the data to compare will always be updated ones from a global data block in which the counter value is. So, 10 + 10 +10 +5 + 2 +1... Meaning I'll need a comparison instruction for 10 pulses, 5 pulses, 2 pulses and 1 pulse, each triggering the next if condition is true, otherwise it will keep on repeating. After all steps are complete, manual or automatic input may be executed to trigger the negative transition of the blade (when it cuts and goes back to its place) that indicates the cut is complete and the system is ready for another sequence. Now, I really am hoping that the motor is slow, in which case the breaking system may not be of much affect in shock or sudden stop forces. I hope I am understanding you guys well, and taking the correct methods to solve this issue. The only thing I'm worried about is about an entire system change (should the client desires)... I do hope it does not come to that though |
3/7/2016 5:11 AM | |
Posts: 5225 Rating: (1194)
|
I don't care how good a hacker someone is -
Mr. Jeff summed it up very nicely.. straight to the point. If you do have speed control ability https://support.industry.siemens.com/cs/ww/en/view/24104802 Also.. These articles aims on using the previous generation's S7-200. It would be easier to use the Siemens provided library and S7-200. Coding for the S7-1200 is possible by working with the theory that is detailed in the documents. w |
This contribution was helpful to1 thankful Users |
3/7/2016 7:27 AM | |
Posts: 1529 Rating: (202) |
I think you need to focus a little more on the system design at this point and a little less on how to process encoder signals. That will turn out to be the simple part. You need to know how you are moving the product. If you have a drive system, and if you have an encoder on the motor, then the built in Motion functions should work fine for what you are doing. Depending on your tolerance and dynamic requirements, a standard AC should work fine. Use your other encoder to measure the actual length and close your position loop. Use In_Position and 0_Speed signals to control your shear. Brake really is not needed except for holding with no power. |
This contribution was helpful to1 thankful Users |
3/25/2016 9:10 PM | |
Joined: 10/8/2015 Last visit: 9/5/2024 Posts: 62 Rating: (3) |
Hello again! I just wanted to log in to tell you that the encoder with the program worked! Believe it or not, I STILL didn't see the client's machine to take the proper measurements to know the factor to multiply with (or divide) depending on the high speed counter. I put a suggestive constant (x100 multiply) and making it the goal of the high speed counter. (Basically, if I need 25 (units), the encoder has to count 2500 pulses to reach). I have also manually created an automatic position control to control those extra counts the motor includes due to inertia when the power should be off. The HMI and PLC code both are working perfectly. Thank you all for your help! Strangely enough, when I did the online simulation, there was no need for a cable shield or anything. It worked out on its own. Dunno how exactly. I just used 2 wires for power, and 2 wires for the A/B quadrature phase. |
This contribution was helpful to3 thankful Users |
11/13/2017 9:29 PM | |
Joined: 4/28/2015 Last visit: 2/25/2024 Posts: 3 Rating: (0) |
You will only need to hook up the following provided that the inputs are open, and using HSC 1 enabled. A+ to I0.0 B+ to I0.1 Then monitor ID1000 under the HSC, Dont forget to change your input channel 0 and 1 filters to the respected rate of your encoder. |
11/14/2017 12:31 PM | |
Joined: 6/24/2013 Last visit: 10/31/2024 Posts: 1645 Rating: (422) |
this is an perfect example why I hate FBD ;-) it looks like a web and I think after a year you will not be able to understand what the thing is about! you need write code in a way others can understand and follow it EASILY for your own benefit and for benefit of your service / maintenance staff! |
Follow us on