Sign in to follow this  
Followers 0
JeffKiper

Math Help

9 posts in this topic

I don't usually work on AD systems but this one is in house and has to have a small change done to it. This change is don't let the machine start until a minimum pressure is met. So I am one of those guys who has to understand what and how the original programmer did his system. In rung 17 and 18 of the program we are doing some math that is kicking my backside trying to figure it out. The values don't make since to me. We are taking the value from an Analog input card (4~20mA) and scaling it to get a rpm. The problem is when I follow the math I can't get it to work. Rumor has it that the original programmer was one of those guys who writes logic just to secure his place for support. I don't know the man so I can't comment on his intent, all I do know is I am having a less than fun time following his logic. We didn't get any prints or documented program. So this is all reverse engineering. Full scale on the card is 4095 V2036=2461 V2027=590 V2031=145 Sorry I got in a rush and forgot the files x2meltpump.zip Edited by JAK

Share this post


Link to post
Share on other sites
The math is: RPM Scaled = (RPM Raw * Speed Scale (from the display)) / 10000

Share this post


Link to post
Share on other sites
Bernie what are the MULD and DIVD for? I didn't think that it would have to use both Upper and Lower words. The math is almost the same as in their manuals but the double had me thrown for a loop. I am trying to get it to work in a step by step math and I must be screwing it up. I will be back at the shop in an hour or so and try to break it down better. If I create a rung with all that info in it as K values it works. If I break it up using LD K590, MUL K2447, OUT V2020 I get 3730. Then the next rung I LD V2020, DIV K1000, LD V2022 I get 3. What am I doing wrong? Thanks Edit don't type and ride down the road Edited by JAK

Share this post


Link to post
Share on other sites
I'm confused, you refer to V2020 but that doesn't occur until rung 58. Are you asking about what I commented on? You referred to rungs 17, 18 in your original post.

Share this post


Link to post
Share on other sites
Sorry Bernie I have a spare unit on my desk that I am playing with to learn what is happening.

Share this post


Link to post
Share on other sites
In that case I would say the double math was used because of possible math overflow when using just the single instructions. In your later test example you get '3730'. Have you wondered why, when you multiply 590 by 2447 you don't get 1443730? It's because the OUT V2020 only sends the lowest 4 digits to V2020. The math accumulator had the correct answer. Hence the double math. Try: LD K590, MULD K2447, OUTD V2020. Then the next rung LDD V2020, DIVD K1000, OUTD V2022 then look at V2022 (either single or double it should be the same, the upper part in V2023 should be zero) V2020 viewed as a double should have the full 1443730 Edited by b_carlton

Share this post


Link to post
Share on other sites
I have to run back to my house to get a better unit this 105 doesn't support MULD. A little small in the horsepower I guess what is why I had it at the house. I will get another 250 and start to play. I hope this is just a Rookie mistake. How do you do the BCD math? What calculator are you using? Thanks I will get anothe unit and hopfully all will go good with that one. Edited by JAK

Share this post


Link to post
Share on other sites
Don't get confused. BCD math is just ordinary math. It's how its stored in the PLC registers that counts. A single V register, when used to stor a BCD number, stores 4 decimal digits. Just use an ordinary calculator and realise that, starting from the lowest number and working backwards, counting off 4 at a time, is how its stored. Thus the 1443730 is stored as '144' and '3730'. When you use an OUTD the lowest 4 digits, '3730' in this case, get stored in that register and the upper ones, '144' in this case' get stored in the next register. (This method of storage is called 'little-endian' in case you ever hear that term.). In the case of OUTD V2020, V2020 gets the '3730' and V2021 gets the '144'. If you only do an OUT then V2020 still gets the '3730' but the '144' doesn't get stored anywhere.

Share this post


Link to post
Share on other sites
Bernie you saved the day. I found a 05 in the cobwebs of the back room and now my live is good I understand what and why this is working. I have not gotten half way down the program yet so I may be asking for more help later. Thank you for your time Jeff

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0