Cancel
Showing results for 
Search instead for 
Did you mean: 

Prioritize Setting-up Tasks

Creator
Creator

Hi guys,

I am encountering a problem when assigning "Services for Setting-up" in tab Importer. I have 2 steps to setup, step A takes 10sec by Worker_1, then step B takes 3sec by Worker_2. I input data in table "services for setting-up", then assigned to workers. However, both worker operates simultaneously. How can I set it in order of A first, then B.

Thank you very much.

10 REPLIES

Re: Prioritize Setting-up Tasks

Gears Phenom Gears Phenom
Gears Phenom

Hello.

 

Got me courious on how to do this and I have now found a method that works.

 

I have added in a bit of code to the release control and the reset method to do this. It will change the worker and also change the amount of time taken for the setup after the first worker has finished and then will reset it back to normal after it has finished.

 

Release Control:

param type: integer -- Importer type (0=failure, 1=setup, 2=processing, 3=transport)

if type = 1
	var setUpTable : Table[string, integer, string]
	self.~.setupImp.releaseExporters
	self.~.setupImp.getServices(setUpTable)
	if setUpTable[2, 1] = 1
		setUpTable.writeRow(1, 1, "A", 0, "")
		setUpTable.writeRow(1, 2, "B", 1, "")
		self.~.setupImp.setServices(setUpTable)
		self.~.SetupTime := 3
		self.~.setupImp.Import(self.~.cont)
	else
		setUpTable.writeRow(1, 1, "A", 1, "")
		setUpTable.writeRow(1, 2, "B", 0, "")
		self.~.setupImp.setServices(setUpTable)
		self.~.SetupTime := 10
	end
end

Reset method:

var setUpTable : Table[string, integer, string]
setUpTable.create
self.~.setupImp.releaseExporters
setUpTable.writeRow(1, 1, "A", 1, "")
setUpTable.writeRow(1, 2, "B", 0, "")
self.~.setupImp.setServices(setUpTable)
self.~.SetupTime := 10

Hope this is of some use.

 

JamesM

Re: Prioritize Setting-up Tasks

Creator
Creator

Hi James, 

I appreciate your help. The release control is great, however i am concerning if using reset method, i cannot collect proper statistic report. The concept is building a model of ten stations running repeatedly that operate by 2 workers, and examine if any slack happens.

I am going to dig deeper into how to "reset" the setuptable. Will update if i come up anything.

thank you.

Re: Prioritize Setting-up Tasks

Gears Phenom Gears Phenom
Gears Phenom

Hello.

 

From what I uderstand the reset method should not impact the statics genrated at all. The reset method is their to help to reset your modal to a set state ready for it to run so is good to be used to reset posistions or values for items.

 

In this case, it is ensuring that if you press the reset button when the second person (for set up task "B") then when the system is next run it will still do task A and not just task B.

 

In this case due to the 'self.~' referances then the reset method should be made on the single proc that you are working with ensuring your system is modular.

 

JamesM

Re: Prioritize Setting-up Tasks

Creator
Creator

Hi James,

I have tried with your code but it seems i have made a mess. Not sure if I create proper Reset method or not. And my Exit Strategy stops function. Keep working on this.

 

Re: Prioritize Setting-up Tasks

Valued Contributor
Valued Contributor

I think that is what James meant..

Re: Prioritize Setting-up Tasks

Creator
Creator

Hi Beeinfluser / James,

 

Thank you guys! It works perfectly.

Re: Prioritize Setting-up Tasks

Gears Phenom Gears Phenom
Gears Phenom

Hello

 

Have had a look at the first model you posted and have managed to find the issues with the system.

 

Firstly, the reset method. When the reset button is pressed the event controller will scan the frame for all methods named 'reset' and will run them, so just creating the method and giving it that name is enough for it to be used by the system. This is also the same for the 'init' method which is wrn when you start the simulation. 

 

I can see from your model you have tried to trigger the reset yourself through the controls, which is not needed and is having the effect of cancling the effects of the release control's changes to the single proc.

 

Secondly, the line 'self.~.setupImp.Import(self.~.cont);' must be in the condition of the if statment where you set it to the second import task. This line of code will tell the system to set of the single proc ready for the part that we give it, so in this case I am using it to make it run the set up again after we have changed it to match your second stage.

 

Lastly, have found that having 'Only when empty' enabled on the set up tab of the single proc means that the system dose no work properly and the second stage is halted as their is a part in the way. If you want to change this on the fly so when the station is cleaned it is empty and the the second task works, then you can also change the 'SetUpOnlyWhenEmpty' flag within the single procs to make this happen. I decided to do the system this way to ensure that your statstics at the end dont count all of the parts more than once, but through locking the enterance you might be able to change it so it will let you keep the station empty until the set up is fully finished.

 

Now as for the modfied version of this with the code as seperate methods. I personally do not like this as then the system is not modular anymore, if you were to move or delete the single procs then the code to go with it will not follow. Through using the user defined attributes you have more blocks of code which makes editing harder but everything is now more seperated making it easier to modfie and reuse. If you were to want to make it easier to edit then you can make a cope of the single proc class in the class library and change that, and then where it is used in the model with have the same user defined attributes.

 

Hope all of this is of some use.

 

JamesM

Re: Prioritize Setting-up Tasks

Creator
Creator

Thank you for your explaination.

I still dont get how the reset method works, and if we don't put separate methods, how can we combine them in 1 method? Moreover, it needs to be clicked twice on the reset button to get the model really be "reset". 

I started using this software about 2 months and not very good at programming. Thank you guys for supporting.

Re: Prioritize Setting-up Tasks

Valued Contributor
Valued Contributor

You need to see the help file (Reset >> EventController).

The simulation reset a calls all methods named reset at the frame and at subframes where the eventcontroller is placed. I'm not sure if there a any restriction, but I think just the string "reset" has to be part of the methods name. The same way the EventController "init" works.

 

At your model it is a good idea to have a class object "station_" - like James told you.

 

You just have to do once all configurations like proctime, setuptime, importer config, and so on. Then you could drop this class element serveral times at your modell.

The benefit compared to your solution is that every change concerning all stations has to be done just once at the class. The same way you can use the releaseCtrl as user defined attribute at singleProc. Beside with active inheritance you can be sure that every station has the same configuration.

 

I have canged your modell. At the class-library you could find the "station_" object. Compareable you could create for workplaces "a" and "b" two class elements.