question

bnh-flexsim-for-masterthesis avatar image
0 Likes"
bnh-flexsim-for-masterthesis asked Jeanette F commented

Proximity detection on exit trigger Event - set up max. speed

Hey all,
in my model i want to implement a logic for proximity behavior for 2 task executers.
The agent system includes 2 zones of proximity. When task executer 2 is detecting the task executer 1 before it, its max speed is set to 0.5 and by further closing in and reaching the narrow zone the max speed is set to 0.05.picture-03.png
If task executer 1 is leaving the narrow proximity zone, the speed of task executer 2 should be set to 0.5 and respective for the broad zone to 2.

picture-04.pngIn my case, the exit proximity triggers do not fire when the zones are exited, but after task executer 2 reaches the queue and picks up an item, its max speed switches directly to 2. Am i missing some information in the code for the on exit event trigger?

picture-02.png

kind regards


Test_Proximity_Slow_Normal_2.fsm

FlexSim 23.0.5
astar navigatorproximity agent systemon exit
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @bnh-flexsim-for-masterthesis, was Kavika F's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Kavika F avatar image
0 Likes"
Kavika F answered

Hey @BNH_FlexSim_for_Masterthesis, from what I can tell, it seems that you cannot change AGV speeds while they are in the middle of a task. Maybe something you could try is preempting the Task Executer with the same TaskSequence it currently has to "reboot it" into using the new speed?

Here are some docs on preemption values and how you might make a TaskSequence. And here's some example code of how you could model your preempt function:

TaskExecuter TE1 = param(1);
TaskSequence ts = TaskSequence.create(TE1);
TaskSequence originalTS = TE1.activeTaskSequence;
TaskSequence.Task currentTask = originalTS.currentTask;
Array tasks = originalTS.tasks.toArray();
int i = 1;

// Skip tasks in the original Task Sequence that have already been completed
while (i <= tasks.length) {
  if (tasks[i].as(TaskSequence.Task) == currentTask) break;
  i++;
}

// Add current and remaining tasks to the new task sequence
for (i; i <= tasks.length; i++) {
  TaskSequence.Task task = tasks[i].as(TaskSequence.Task);
  ts.addTask(task.type, task.involved1, task.involved2, task.var1, task.var2, task.var3, task.var4);
}
//return [originalTS.tasks.toArray(), ts.tasks.toArray()];

ts.preempt = 2;
ts.priority = originalTS.priority + 1;
ts.dispatch();


I haven't done any major testing on this, but from a glance it seems to work fine. Simply add this to a User Command and call it in your Proximity Triggers, passing in the agent.object as a parameter.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.