question

Eamon O avatar image
0 Likes"
Eamon O asked Jason Lightfoot commented

"absolute resume" for an Object on Conveyor

Conveyor Absolute Resume Example.fsmIs there a clean way to do an absolute resume on an object on a conveyor?

** edit

The Stop on Conveyor default option in the Process Flow uses a deprecated method. See the attached screenshot and model. Unfortunately the two solution you gave me don't quite fit, sorry, i've given more information now.

end edit **

As far as I understand: running Object.stop() adds +1 to the Object.stopCount property, and puts it into a stop state. Running Object.resume() puts the object into its previous state and -1 from the stopCount. Usually this is fine, but I want to use stop() generously in a part of my Process Flow to catch some edge cases. However, these stops can be "layered," and so when I use resume() it only returns the Object to its previous state, which is also stopped.

I've tried getting around this by using Object.setProperty to set the stopCount to zero, then resuming, but it seems to corrupt the state history. I've tried looping until stopCount == 1 then resume() but this is messy. Is there an easier way to do this that I'm missing?

Thanks in advance.

FlexSim 22.2.2
stop and resume
· 3
5 |100000

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

Jacob W2 avatar image Jacob W2 ♦ commented ·

Hi @Eamon O, was Jeanette 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 ·
Eamon O avatar image Eamon O Jacob W2 ♦ commented ·

Unfortunately none of these solutions worked for me, even Jason's last solution. See errors below. However, this is not a serious issue and I don't think it needs an answer. For this model, I brute forced it by using multiple conveyorresume(item) commands. Going forwards I'll work to avoid using the default stop on conveyor option, and write custom code that uses the Conveyor.resume() command.

exception: FlexScript exception: Label property itemData retrieved on /StraightConveyor1. Label does not exist. at MODEL:/Tools/ProcessFlow/ProcessFlow/AbsoluteResume>variables/codeNode

Conveyor.Item convItem=token.conveyor.itemData[token.item];
convItem.resume(1);  
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Eamon O commented ·
0 Likes 0 ·

1 Answer

·
Jeanette F avatar image
0 Likes"
Jeanette F answered Jason Lightfoot commented

Hello @Eamon O,

What if you had a decide activity that checked to see if the object was still stopped if it was then it sends it an activity to resume and then it loops back to the decide activity?

1664398786222.png

Here is a sample model demonstrating what I mean.

Stop and Resume Object.fsm


· 8
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

In a single custom code you can put:

Object proc=token.proc;  //or  Model.find("Processor1")  if the label is not set
while(proc.stopCount) 
    proc.resume(1);

not sure why this seems messy...

0 Likes 0 ·
Eamon O avatar image Eamon O Jason Lightfoot ♦ commented ·

Hi Jason,

Thanks for the quick reply. Turns out its messy because the stop method I'm using seems like a deprecated function that got left in the process flow tools. Please see the model example I attached, apologies for not attaching one earlier.
2022-09-28-15h04-59.pngHow should I stop an item on a conveyor in the future until you can fix this in the next update?I wasn't able to find documentation online about conveyorstopitem(obj item), it just says "Deprecated, use Conveyor class. "
https://docs.flexsim.com/en/21.2/Reference/CodingInFlexSim/CommandReference/Commands.html#conveyorstopitem

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Eamon O commented ·

Use the Conveyor item syntax described Here

0 Likes 0 ·
Show more comments
Eamon O avatar image Eamon O commented ·
Thank you Jeanette,

I'd tried a loop myself but your version is definitely a bit better :) The state check works way better than checking the stopCount. Much appreciated!

0 Likes 0 ·
Eamon O avatar image Eamon O commented ·
After trying both yours and Jason's solutions, I realized I didn't define my problem well enough, apologies. Please see the attached model, but unfortunately the solution you gave doesn't fit my problem.
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Eamon O commented ·

It looks like I attached the wrong model - here's the working version (also updated in the above post)

conveyor-absolute-resume-example_jl.fsm

0 Likes 0 ·

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.