Resource preemption and task resumption

32 views
Skip to first unread message

David Custódio de Sena

unread,
Jun 28, 2025, 8:11:08 PMJun 28
to Jaamsim Users Discussion Group

Dear colleagues,

I hope this message finds you well.

I am currently working on a simulation project using JaamSim and would like to inquire whether it is possible to implement a behavior in which an ongoing operation performed by an entity is temporarily paused so that the resource involved can be released and allocated to serve another entity with a higher priority. After completing the service for the second entity, the same resource would then return to the original task, resuming the interrupted operation from the point at which it was paused.

If anyone has experience modeling such behavior in JaamSim or can suggest an effective way to achieve this logic, I would greatly appreciate your insights or any references you might be able to share.

Thank you in advance for your time and support.

Cristiano Silva

unread,
Jun 28, 2025, 11:17:09 PMJun 28
to David Custódio de Sena, Jaamsim Users Discussion Group
It's still not the expected result. But maybe it will help in some way. attachment

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'


--
You received this message because you are subscribed to the Google Groups "JaamSim Users Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jaamsim-user...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/jaamsim-users/CAGMpZSHbu%2BgWB7teFyJ3fVuaSw8-GQCLPCyCsvCh0_A8zhtCqA%40mail.gmail.com.
david.cfg

David Custódio de Sena

unread,
Jun 29, 2025, 1:58:26 PMJun 29
to Cristiano Silva, Jaamsim Users Discussion Group
Excellent, my friend. It was a very elegant solution, because it uses the same ResourcePool. It will be very useful!
--
Prof. Msc. David Custódio de Sena
Engenharia de Produção
Universidade Federal Rural do Semi-Árido - UFERSA
Doutorando em Engenharia de Produção
Membro do Núcleo de de Estudos Avançados para Auxílio à Decisão - NEAAD
Universidade Federal de Itajubá - UNIFEI

Cristiano Silva

unread,
Jun 29, 2025, 3:31:39 PMJun 29
to David Custódio de Sena, Jaamsim Users Discussion Group
Hi, my friend David. I couldn't deallocate a resource in the middle of a process, even if that process is paused. I don't know how to do it.

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'

KlausH

unread,
Jun 29, 2025, 5:58:13 PMJun 29
to JaamSim Users Discussion Group
Hello,

Please find attached my proposal to solve this problem.
It is using the resource "Worker" with capacity of 2.
The entities have 2 attributes. One for the Priority and one for the later used service time.
Normal entities with the attribute "Prio" = 1 are directed via branch to EntityProcessor1.
Urged entities with attribute "Prio" = 2 are directed to EntityProcesso2.
As soon an urgend entity arrives at EntityProcessor2 the ExpressionThreshold1 becomes closed and therefore the EntityProcessor1 will immediately interrupt his work by finishing the current entity and the seized resource willl be released.
Hope this helps you to solve your model.
Best Regards,
Klaus
Seize Resource and interrupted.cfg

Cristiano Silva

unread,
Jun 29, 2025, 6:25:07 PMJun 29
to KlausH, JaamSim Users Discussion Group
Excellent solution. One question: what if the job has not yet been completed, and you need to return later to continue the job you stopped? Example: you cut 40% of a piece and need to stop to go to urgent work. Then you come back and cut the 60% of the piece you had stopped. I tried to do this. Thank you.

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'

Klaus Holstein

unread,
Jun 30, 2025, 4:47:48 AMJun 30
to jaamsi...@googlegroups.com
Hello Cristiano,
currently the job on the current entity is completed. Based on the assumption the urgend job allows to finish them.
You mean the current entity service time takes too long and therefor the urgend entity does not allow to wait for the completion of the that.
Do I understand this correct?

Regards,
Klaus
Mit freundlichen Grüßen,
Klaus Holstein

Cristiano Silva

unread,
Jun 30, 2025, 7:01:30 AMJun 30
to Klaus Holstein, jaamsi...@googlegroups.com
Hello Klaus.

Yes.

Sample:

Server 1 completed only 10 minutes, and a service arrived on Server 2, which is urgent.

The task is interrupted on Server 1, in 10 minutes to serve Server 2.

The resource goes to Server 2.

After Server 2 finishes, it returns to Server 1 and finishes the remaining 20 minutes.

I tried to represent this in the attached model (previous email).

But I couldn't do it with just 1 resource.


Thank you!

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'

David Custódio de Sena

unread,
Jun 30, 2025, 8:00:53 AMJun 30
to Cristiano Silva, Klaus Holstein, jaamsi...@googlegroups.com
Hello.

That's it. That's exactly my problem now, how to resume later a time that was interrupted.

KlausH

unread,
Jul 1, 2025, 5:14:01 PMJul 1
to JaamSim Users Discussion Group
Hello David,
Attached my updated model.
The job now is interrupted and the entity is moved back to the EntityProcessor, but now with a priority to ensure this job will be finished before a new one will be started.
Please take a look.
Currently I am reworking the model with a submodel technic.
Hope this works now and you can finish your model.
Best Regards,
Klaus
Seize Resource and interrupted.cfg
Reply all
Reply to author
Forward
0 new messages