Sign in to follow this  
Followers 0
CanaanP

Need some advice on logic please....

5 posts in this topic

If anyone can recommend a way to solve this I would be very appreciative: I am working on a project for an automated double band saw machine. We will use an ultrasonic scanner to measure the height of a board before it comes to the blades. There are two blades, each one is on a ball screw motor that can adjust the height of the blade. The operator console will have the ability to program three preset measurements. The operator chooses a preferred preset. When each piece is scanned, the plc must "decide" which is the most efficient way to position the blades to get any combination of the preset measurements. The first blade must make the lowest cut, the second makes the other. The customer expects the PLC to contain truth tables that control the blade settings based on the incoming measurement. There is a tolerance of +/- 1mm. The operator can also specify the saw kerf, which is the material lost with each cut due to the thickness of the blade. All measurements are in mm. I have never done this before, but I was pretty certain this can all be done "on the fly" instead of having to make tables for this. Here is an example of a scenario: Presets are 58, 70, and 83 Incoming board is 142.4, preferred preset is 83. First blade should move to make a 58 mm cut, second blade moves out of the way, the remainder should be 83mm. In this example, which was provided by the customer, I am able to get my program to work fine. After taking into account a 2.4 mm kerf, I get an 83mm piece and 57, which is within tolerance. However, I cannot get this example to perform correctly in my program: Incoming board is 202.8, preferred preset is 83. This should yield two 58mm pieces and one 83mm piece. My program says that there will be two 83mm pieces with 32mm of waste. Obviously they would rather have only 1 83mm piece and two 58mm pieces so that those pieces could be used on another job or something, instead of throwing away 32mm of material. But I cannot seem to figure out how to make this work. I am attaching my 5000 file for anyone to look at. Any advice would be greatly appreciated, thanks! EDIT: I forgot to mention, this is of course a very rough test program that I made so I can test things out. I have this project running on the 5000 emulator program, and a test HMI screen in FT VS. I do not have the scanner hooked up obviously, so I am just directly inputting a measurement into the measured_height tag, then hitting a button on the screen that toggles the scan_process.start tag to get my results. I also wanted to mention that the problem in the second example I provided, where my program fails to come up with the desired results, is occurring on rung 5 of the test routine. This is because I'm looking to match up the remaining material with the largest of the presets to create a second piece. But I'm not sure how else I could handle this to have as little waste as possible. Thailand_Test.ACD Edited by CanaanP

Share this post


Link to post
Share on other sites
Well, the PAC does what it is supposed to do according to the programmed logic. It will try to get as many "prefered" dimensions out of the given incoming board dimensions. I would logically approach this subject by defining "Minimum Waste" as the Lead Dimension instead of the "Prefered Preset" logic. The processor should try to get as many "Presets" out of the full piece reducing the waste to a minimum. Since there are only three Presets and you probably know the Min./Max. incoming board dimensions, the permutations of the three preset dimensions combinations could be reasonably easily handled via recipes. Edited by dmargineau

Share this post


Link to post
Share on other sites
I can see using a minimum waste figure to help this program, but I really didn't want to do recipes... there is actually a 4th preset that I have yet to put in. They wanted it to be there, but not yet activated, then they also wanted the ability to go in later and add new tables... as I said - I would rather not use tables and would like to just do it with math on the fly if possible... I'm very close, just not quite there.

Share this post


Link to post
Share on other sites
If you always look for the largest piece you can cut first it should work better. Do they have a preference on order of size? or just that scrap is minimum. try statements for: Blade 1: if input (board size) is greater than max value and less than min value X 2 then cut at max size subtract max size + kerf = remainder a if input is <max >med then cut at med size subtract med size + kerf if input is <med >min then cut at min Blade 2: if remainder a is > max and < min X 2 then cut subtract max size + kerf cascade the functions this way and it should work

Share this post


Link to post
Share on other sites
The best way to use tables that are generated by a PC and downloaded to the PLC. The method I used 30+ years ago was to pass the dimension of the wood to a optimizing subroutine. It would try removing each of the different sizes from the piece of wood. The left over wood was passed to the same optimzing routine. Yes it was recursive. Eventually there was not enough wood to remove a piece so the left over was returned as waste. The optimizing function then chose the combination with the least waste. I doubt you can do recursive calls in a PLC so you will need to use 3 for next loops because that is the maximum number of pieces you have have with two saws. Each for next loop tries each one of the sizes in you preferred cut list and lets the inner loop work with the left over wood and if there is stil left over wood the inner for next loop tries the different sizes. You must initialize a waste variabe with a big number like 1000. Each time you find a new minimum waste value you update the best cut list and the new minimum waste value.

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