How to change max allocation capacity of a controlpoint on dynamically?

How to change max allocation capacity of a controlpoint on dynamically?

jkhedekar
Enthusiast Enthusiast
216 Views
5 Replies
Message 1 of 6

How to change max allocation capacity of a controlpoint on dynamically?

jkhedekar
Enthusiast
Enthusiast

So I have a taskexecutor which is delivering a material. It reaches a point and takes 300 sec to unload, I want to make the capacity of the allocation point 2 after 30 sec of unload has passed so task executor behind can technically overtake it, and then onces 300 sec are complete make the controlpoint's max allocation to 1.

 

 

I am doing the following, but I know its missing something:

Object te= so.forklift;
AGV agv = AGV(te);

Node cp = agv.currentCP.as(treenode);
cp.maxAllocations = 2;
return cp.maxAllocations;
0 Likes
Accepted solutions (2)
217 Views
5 Replies
Replies (5)
Message 2 of 6

moehlmann_fe
Advocate
Advocate
Accepted solution

"Node" should be "treenode" and you have to use ".setProperty()". Your syntax would set a label called 'maxAllocations' on the CP. Changing the allowed allocation count will not allow an already waiting AGV to continue automatically. You would need to make it restart its travel task.

Object cp = agv.currentCP;
cp.setProperty("MaxAllocations", 2);
AGV.AllocatableObject allocCP = cp;
if(allocCP.as(AGV.AllocatableObject).requests.length)
{
	TaskExecuter waitingAGV = allocCP.requests[1].allocator;
	TaskSequence preemptTS = TaskSequence.create(waitingAGV, 1000, 1);
	preemptTS.addTask(TASKTYPE_BREAK, NULL, waitingAGV.activeTaskSequence);
	preemptTS.dispatch();
}
0 Likes
Message 3 of 6

jkhedekar
Enthusiast
Enthusiast

For this line:

TaskExecuter waitingAGV = allocCP.requests[1].allocator;

Getting the following error:

Data type AGV.AllocationPoint does not support property allocator

Also, I am not using task sequence per say, I am using token.forklift after acquiring it throught  resource in process flow where I am using this token.

0 Likes
Message 4 of 6

jkhedekar
Enthusiast
Enthusiast

[Re posted by error] Refer to comment below

0 Likes
Message 5 of 6

moehlmann_fe
Advocate
Advocate

You must be using an older version then (23.2 or before). Try using this instead:

TaskExecuter waitingAGV = allocCP.requests[1].as(treenode).up.up.as(AGV).object;

Internally, a single task given through a task activity is still a task sequence, just with a default set of parameters (priority 0 and no preemption). It also actually contains two tasks, the given task itself and callback to let the token continue.

Message 6 of 6

jkhedekar
Enthusiast
Enthusiast
Accepted solution

What actually worked on 23.0 is this:

TaskExecuter waitingAGV = allocCP.allocations[1].as(treenode).up.up.as(AGV).object;