Cancel
Showing results for 
Search instead for 
Did you mean: 

Routing Based on statistical failure percentages attributes

Creator
Creator

Hi ,

I'm trying to use attributes of my MUs in order to change the exitcontrol (random or percentage)

 

Each MU has an attribute X. A method is used to find the corresponding percentages of the attribute X  from a tablefile and the method should consequently change the exitstrategy.

 

My model is attached. It is not working properly. Does anybody know why?

 

My method code is:

 

var a: integer;
var b: integer;

var i: integer;

i:=0

while i <= 115
 i:=i+1
 print "round" + i
 if ReworkPercentage[1,i] = @.attributeX
  a:=ReworkPercentage[2,i]
  b:=ReworkPercentage[3,i]
  sorter1.ExitStrategy := "random";
  sorter1.ExitStrategyPercentageValues := makeArray(a,b);
  i:=116
  print "attribute found"
 elseif i=116
  a:=87
  b:=13
  sorter1.ExitStrategy := "random";
  sorter1.ExitStrategyPercentageValues := makeArray(a,b);
  print "attribute not found - average used"
 end
end



Thanks. .

4 REPLIES 4

Re: Routing Based on statistical failure percentages attributes

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
what effect should have the while loop ?
the simulation time is stopped while running through the loop, at the end the setting of i=116 will remain in the exit strategy for each call of this method
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Routing Based on statistical failure percentages attributes

Creator
Creator
Thanks for your Reply,

The effect of the while loop should be that if a certain percentage is not listed in the tablefile, the average values a:=87 b:=13 will be used. So my idea was that the via the while loop attribute X is compared with each line of the table file and if after the last row still no value is found the value 87 and 13 are used.

Re: Routing Based on statistical failure percentages attributes

Valued Contributor
Valued Contributor

I have v12 so I can't open your model, but the problem probably doesn't have to do with your code. If your sorter calles this method every time a mu enters, then the exit strategy is constantly getting reset and the first mu after a reset always goes to the predecessor with the larger percentage.

 

In short, don't use the build-in "random" exit control. Instead, try calling this in the exit control of sorter1:

 

var a,row : integer

//set starting point for searching the routing table
ReworkPercentage.setCursor(1,1)
//check if attributeX exists in routing table
if ReworkPercentage.find({1,1}..{1,*}, @.attributeX)
	//found: read in routing
	row := ReworkPercentage.YDim
	a := ReworkPercentage[2, row]
	print "attribute found"
else
	//not found: set default routing
	a := 87
	print "attribute not found - average used"
end
//execute percentage exit strategy
if z_uniform(1,1,100) <= a
	@.move(1)
else
	@.move(2)
end

 

Also see attached.

Re: Routing Based on statistical failure percentages attributes

Creator
Creator

Great! That worked Smiley Happy

Thanks a lot!