Che-Wei Chou avatar image
Che-Wei Chou asked Che-Wei Chou commented

MTBF for different workstation in process flow


I've created machine breakdown (MTBF) for a workstation1 in process flow model. Is there a better way to set MTBF that refer to the same container (Breakdown WS) if I wanna build a large-scale factory simulation model.

Thank you very much for your kindly response.

Best regards,


MTBF in re-flow process.fsm

process flowmtbflarge-scale
5 |100000

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

1 Answer

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Che-Wei Chou commented

I would use the code below to find tokens to preempt instead of your code that looks at the Activity name (for which you have duplicates and only find one activity). This code looks at the class of activity in the process flow (in this case delay) and returns the array of any tokens in that class. You can uncomment further activity classes you wish to include.

(model attached).

treenode classrunsubflow=node("?RunSubFlow",library());
treenode classbatch=node("?Batch",library());
treenode classwait4event=node("?WaitForEvent",library());
treenode classdelay=node("?Delay",library());
treenode classpull=node("?PullFromList",library());

treenode instancelink=NULL;
for (instancelink=node("instances/1",stats(processFlow));objectexists(instancelink);instancelink=next(instancelink)) {
if (node("+/~",instancelink)==current)
Array tokens;
if (objectexists(instancelink)) {
treenode instancetokens=node("tokens",instancelink);

forobjectlayerunder(instancetokens) {
treenode thistoken=a;
if (objectexists(a)&&a!=token && (classobject(getactivity(a))==classdelay)) {  //||classobject(getactivity(a))==classpull)) {// not(classobject(getactivity(a))==classbatch||classobject(getactivity(a))==classrunsubflow||classobject(getactivity(a))==classwait4event)) {

return tokens;


· 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.

Hi Jason,

Thank you very much for your solution. One more question, I try to record the token information that try to track the breakdown workstation and down time. However, it doesn't work by save in the "recMTBF" table. Could you kindly help give the sugguestion that how to record the token's inforamtion connected the the down time situation, thanks.

Best regards,



mtbf-in-re-flow-process-jl_rec down time.fsm

0 Likes 0 ·

You're recording pointers to objects that are destroyed.

In the attached model I've added a label called tokenNames to the breakdown token.


1 Like 1 ·
Che-Wei Chou avatar image Che-Wei Chou Jason Lightfoot ♦ ·
Hi Jason,

Thanks, Flexsim support team really provides a strong platform for user who can develop a simulation model more powerful.

Thanks again.

Best regards,


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.