Jump to content

Recommended Posts

Posted
Hi, I have a motor outputting 30pulses/rev at the encoder. With output shaft measured I get a calc of 0.1295mm/pulse. I made up a function block with st: Length_x = dint to real (raw_x) Length_x = raw_x * 0.1295 Length_x_mm = real to dint (length_x) when added to the program my scan rate jumps from 3.2ms cycle time to 7.ms as the shaft is moving all the time. I was wondering if I can do the calc in ST but simply bring in raw_x * 0.1295 = length_x_mm without the dint to real/real to dint conversion in a hope that cycle time will decrease? Thanks in advance
Posted
Is there an alternative in ladder logic that I can: Take a dint, convert to real, multiply with constant and convert back to dint for 'mm' output? What I have works but it's running slower than I wish.
Posted
I created a scaling block to do the same conversion and dumped it into a CJ2H PLC. I don't know what PLC you are using, but a CJ2H with 3 instances of the scaling block has a scan time of about 0.5 ms. I know that you are using a slower PLC, but it should still not add that much time. I think that your code does not look correct. Here is what I wrote (image monitoring inside of one instance): Here is the actual .cxf file if you want to import it to CX-Programmer: Scale FB.zip If you attach your code, I can look at it / modify it here and respond.
Posted
I am using a CP1L taking input from High speed Counter. This is a copy of the actual code: Thanks for the above Sergei but the calculation overspilled as the count is actually: *10296 / 100000 The sum is required to cope with 300M conveyor, after 21M the counter overspilled as the calculation was massive.
Posted
Just do it the old fashioned way - with ladder. I just ran the following test: With one simple rung of ladder (no scaling) as shown below: The scan time values were as follows: Mean: 0.4ms Max: 0.8ms Min: 0.3ms With the function block method that we have been discussing: Mean: 3.0ms Max: 3.6ms Min: 2.7ms With the following ladder rung (which does the same thing as your FB): Mean: 0.4ms Max: 0.8ms Min: 0.3ms Very little difference when adding your scaling function using good ol' ladder. I would just use the ladder.
Posted
Ohhhhh - now that looks like it would work a treat. I will give it a shot first thing, test on test bed first. ........a/w the dawn

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...