DL06 - Rookie In Need of Division Help

DL06

Member
Join Date
Feb 2006
Location
Canada
Posts
87
Hello all. I have been reading this forum for some time now and was hoping to get some help. I just received a DL06 today and am having some issues with the divide function. I basically have two counters, 'total time' and 'run time'. I want to divide the two to get an uptime, but all I get is a value of zero. I was thinking that the problem might be that the result is less than one and it is only showing the integer portion. I tried to multiply the numerator by 100 to correct this, but didn't have any luck.

I am attaching my file. If someone could help me out, it would be appreciated. I'm sure that I am missing something that will be obvious to the gurus out there đź‘Ľ.

Thanks in advance.
 
What are your values for TA0 and TA1? because unless I'm wrong in your program they are 0 and when you divide by 0 the result is always 0. in rung 17 TA0 gets loaded to the accumulator and then out to v10003. in rung 18 you LD v10003 which is 0 because TA1 is 0.

Hope this helps
 
Thanks for your reply tinfoil.

Unless I am misunderstanding things (I'm new with the DL06) TA0 and TA1 are simply the accumulative values for timers 0 and 1. T0 and T1 are the bits that tell if the timers are enabled or not.

Basically, the 'total timer' that I have will be enabled whever the machine is on (i.e. the entire shift). The 'run timer' will be enabled whnever the main motor is running. So, there wil only be division by zero before the machine is powered on.

The problem is that when I turn on the machine and the motor, I see the associated timers counting up but the division always nets out to zero. Your argument that the division is netting zero would be true upon startup, but why is it not changing as the timers both become nonzero?

Any ideas?
 
I dont have the DL06 software on this computer so could not look at the program but I am not sure why you need to use Divide...total uptime should be the "difference" between total time and run time UNLESS you are looking for a percentage...ie total time is 8 hrs and run time is 6 hrs then you would divide 6 by 8 or 3600 minutes by 4800 minutes etc, this will equal .75

IF you are trying to obtain a percentage then you are technically obtaining a zero, the actual number will be a decimal less than zero...ie .75 in the example above. You will need to read the manual an develop the equation for floating point.

Elevmike and others will be able to tell you the exact procedure for developing floating point decimal numbers as I mentioned I do not have the software loaded. If I remember correctly you have to allocate double words...ie V10003 and V10004 or similar and you may need to do a conversion to BIN (binary) before the divide, not positive about that last part though.

Someone may have already answered this while I was typing.
 
First of all your calculations should be activated with an SP1, (always on), not the X4 contact...

I've got to go get a DL-06 and see why it donst work, but in the mean time remove the X4 contacts and replace them with just one sp1 contact in rungs 54-88.
 
Rung 36 starts with a not X4, so the update to v10000 & 10001 doesnt happen unless the machine is off any you press the reset. Is this intentional??
 
DL06 said:
Basically, the 'total timer' that I have will be enabled whever the machine is on (i.e. the entire shift). The 'run timer' will be enabled whnever the main motor is running. So, there wil only be division by zero before the machine is powered on.

16 minutes shifts??? That all the timer is good for.. Then back to 0. The timers count in 1/10 sec increments from 0 to 999.9 seconds..
 
DL06,

Ok so to show values less then 0 you have to use REAL numbers (aka floating point). If not then the result will be an integer and as we all know from grade school intigers are all whole numbers greater then 0.

So the instructions are LDR, & DIVR.

Now MY question is what is this good for? Dont you want UPTIME? Wouldnt that be an accumulation of "power on" - "motor on" or something like that. What's your definitation of "uptime?
 
rsdoran - sorry fo not being clear. Yes, you are right, I am looking to find an uptime percentage. Uptime would, as you pointed out, be available through the counter tied in to the main motor. I will look into using the double words and conversion to binary before the division like you suggested. Thank you.

elevmike - The reason that the calculations are triggered by X4 were for testing purposes only. The PLC is just hooked up to a few switches right now so I can simulate the inputs. When I implement this the SP1 will be used. I am not sure what you mean by 16 minute shifts. The total timer and run timer are TMRA functions (or at least they are supposed to be, I don't have the software at home, so I am going by memory here...) which are said to allow values to a maximum of 9999999.9 in 0.1 second intervals which is ~11.5 days. The takt timer does not need this range because it will be incremented every couple of seconds. Note that the time presets are just for test purposes at this point.

All of this is besides the point, however. I just need to figure out how to divide the numbers. I will put some more time in tomorrow and hopefully figure it out. If you have any ideas of how to do this, I am all ears. My first few hours programming the system were not as productive as i would like them to be since I am more familiar with AB and Omron.

Thanks again.
 
I stand corrected, I didnt notice they were accumulating timers..

The answer to your question is that you need to use real numbers to get results showing less then 0 or floating point.

I'm just courious why your using the division. Are you trying to get a percentage of uptime as your result?

Edit: never mind you already answerd that...
 
If indeed you are using accumulating timers and you are using T0 and T1, that is a problem. Accumulating timers consume two timer locations so you would have to use T0 and T2.

Andy
 
Thanks for pointing that out Andy, that makes sense.

Using the LDR and DIVR functions like Elevmike mentioned earlier, do I need to do a conversion or anything special before doing this function? Is there a way to set what 'type' the number is (binary, octal, BCD, etc.) or is that simply handled by which load function you use?

Thanks again to those who have helped. I just got into the office and will be doing some tinkering on it this morning.
 
One more thing...

If I want to post example files on this forum again, are all of the files necessary, there were about 10 associated with the project.

If not, which extension(s) do I have to include?
 
If you post your program the best thing to do is zip up everything you have with your program file name and post the zip file. There are some restrictions on file types you can post and zip files are allowed.

As for the load, assuming you are loading what you know to be a real you don't need to do any conversion. If you are loading a double integer you will need to do a type conversion before you perform any math functions. If I remember right the timer accumulators are BCD values. So you would need to do a LDD followed by a BIN followed by a BTOR to get it as a real.

To the more experienced AD guys out there, is there any difference between a LDD and an LDR if you are loading a v-memory location? It seems to me they should do the same thing.

Keith
 
Last edited:
Thanks for the advice keith.

I moved the timers like andy suggested. T0 and T1 were accumulators, so I assigned the first one to T0 and left T1 blank. T1 now became T2 and I left T3 blank. For the rest of them I used T4, T5, T6, etc since they are not accumulators and only require one memory location (is this correct?)

I got the percentage calculation to work out (sort of...) but a few more questions popped up. The percentage now calculates based on run time divided by total time, which is good. I noticed that the calculation is a bit jumpy due to the quick scan time and displays incorrect values sometimes, so I put a timer to update the percentage every 2.5 seconds.

I would like to add text in front of the number like "Uptime: " but it won't let me since the real number requires too many digits. Is there a way to truncate the digits and turn the fraction into a percentage. Ideally I would like it to truncate after the last whole number and show "Uptime: 97" on the screen. Anyone have some pointers?

Oh, and another odd thing is happening. I turned on the "machine power" and "motor power" inputs so the "total time" and "run time" both increment. I watch the time go to 9999 in the monitor window for both. The TA1 then goes to 1 as expected and TA0 continues on from 0. For some reason the run timer TA2 resets to 0, but it doesn't set the TA3 value to 1. Therefore my percentage goes from close to 100 down to under 1.

I will post the current version of my program. Please have a look and let me know what I am doing wrong.

Thanks.
 

Similar Topics

Hi, Mostly AB guy here with a little Koyo experience, but all of its digital. I get handed three analog I/O cards and asked to prove that they...
Replies
6
Views
497
Hi all, I am making a test rig to be able to wire in any DL06 (or DL05) And create a HMI in red lions crimson 3.1 to test all the inputs and...
Replies
4
Views
931
I have a Cmore screen which is communicating to the DL06 in BCD and need to create a timer that works in real numbers for a test, I simply need to...
Replies
3
Views
2,133
I have a client that has many Automation Direct DL06 PLCs for a municipal water/wastewater system. When there is a power outage, one of the sites...
Replies
4
Views
2,441
Hey everyone, Working on a system with a Koyo DL06 processor and it's my first experience with them. I have DirectSoft 6 and we got the program...
Replies
5
Views
2,329
Back
Top Bottom