Koyo and numbers/math?????

XtremeIN

Member
Join Date
Jun 2005
Location
Indiana
Posts
217
Hello all,

I have been working on a progam for some time now. I have been here a few times and have always been lead in the correct direction, for that thank you. It is that time again..... I have some questions about Koyo (AD) and math with large numbers. I am using a D0-06DR-D PLc. What I am trying to do is calculate the % of gallons that can be treated in a pretretment softner before it has to be regenerated. I hope you got that....lol The math is rather easy, just large numbers, I cannot get the answers to come out correct. Most of these numbers are stored in a Vmem location and change depending on system perameters. Here are some of the numbers that will be used to help out. 17,700 X 2 = 35,400. 35,400 / 5 = 7080. 7080 - 273 = 6708. 6708 / 7080 = 0.96. 0.96 X 100 = 96% charge left. I keep getting 0 for an answer.

Thanks,
Micheal
 
What format are you using? Are you using Real Numbers?

If should look something like this

LDR V1000
MULR R2
DIVR R5
SUBR R273
DIVR R7080
MULR R100
OUTD V1002
 
Any type of integer format will give you an answer of zero.
You can either use floating point as CroCop suggests, or long integer if the PLC will support it. In long integer, you should multiply the neumerator by 100 before the divide to get 1% accuracy.
 
With Koyo integer math the input and results must be between 0 and 9999, although intermediate results may be larger.

You have two choices. You can use real numbers, or you can scale the values to stay within the limits. For example, you could use units of hundred gallons or thousand gallons.
 
Thanks guys, as always you advice gave me what I needed to solve my issue. I ended up scaling the numbers to fit within the processors limits. Now I have another question. I need to write some logic that assigns preference to up to five events that "might" try to happen at ther same time. I can have up to five valves trying to turn on at the same time. I am trying to set it up so only one at a time comes on and if it two need to come on at the same time the one with priorty will come on first then when it is finished the second one. As always I look forward to the advice and if you need more information ask away. THANKS!!!!!

EDIT.........After posting and going back and working on it some more, I think have it worked out. Feel free to post suggestions, yours may be better than mine. And I may not have it right....lol

Later,
Micheal
 
Last edited:
Let's say your 'events' are X0 through X4. And the associated outputs are Y0 through Y4.

Your lines then are


X0 Y0
---| |----------------------------------------( )--

X1 X0 Y1
---| |--|/|-----------------------------------( )--

X2 X0 X1 Y2
---| |--|/|--|/|------------------------------( )--

X3 X0 X1 X2 Y3
---| |--|/|--|/|--|/|-------------------------( )--

X4 X0 X1 X2 X3 Y4
---| |--|/|--|/|--|/|--|/|--------------------( )--



Of course an occurance of X0 while X1 is turning on Y1 will turn off Y1 and turn on Y0. Is this what your want?
 

Similar Topics

I need this screen creator for GC-53 software to get an program from GC-53 MHI KOYO , Please help me.
Replies
0
Views
90
I have a c-more micro with a three digit input box on one of the screens. This is being written to a memory location in a DL05. I don't have the...
Replies
3
Views
104
Hey, I am entirely new to PLC's and am trying to help my friend with a project. He wants to take the signal from a PNP photoelectric sensor as...
Replies
12
Views
2,228
I have an OPC Server (Kep) pulling tags from an AB 1769-L36ERM and a few different Koyo PLCs (450, 454). On the HMI (FTV SE) there's one screen...
Replies
4
Views
1,484
One of our Therm-O-Seal splicers has an issue and we are trying to access the PLC to help troubleshoot. The PLC is password locked and...
Replies
1
Views
1,323
Back
Top Bottom