question

Julian Sundermeier avatar image
0 Likes"
Julian Sundermeier asked Julian Sundermeier commented

How to duplicate / clone a flowitem with all labels due to a breakdown?

Hi everyone,

I don't know how to simulate the following issue:

A machine processes a flowitem until a breakdown occurs. The OnBreakdown-trigger should duplicate / clone the flowitem and place it in a buffer next to the machine. The cloned flowitem should have all labels and their current values. After the duplication is finished, the original flowitem should be deleted.

I hope you understand my problem and can help me?

FlexSim 7.5.4
flow itemscloneduplication
· 6
5 |100000

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

tannerp avatar image tannerp commented ·

Would you be willing to upload a sample of your model with the scenario you described so that we can better understand it? Or are you attempting to create what you mentioned from scratch?

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel tannerp commented ·

@Tanner Poulton, the Version is 7.5, there doesn't exist Process Flow.

2 Likes 2 ·
tannerp avatar image tannerp Joerg Vogel commented ·

@Jörg Vogel You are correct. I simply suggested that they look into updating the software so that they have access to Process Flow.

1 Like 1 ·
Show more comments
Julian Sundermeier avatar image Julian Sundermeier tannerp commented ·

I try to create it from scratch but you can use the model attached.

Maybe i just dont know the corrects comannds to use for the OnBreakdown-trigger or, if there are no commands to solve my problem, I dont get the right idea for a 'workaround'.example-duplication.fsm

0 Likes 0 ·
tannerp avatar image tannerp Julian Sundermeier commented ·

Thank you for the demo model. After looking at it, here are my two suggestions/thoughts:

1) You could insert a few lines of custom code in the "On Break Down" and "On Repair" boxes that would save the object's progress in the processor, move it to the buffer area, then move it back and resume the process.

2) The newer versions of FlexSim have something called Process Flow that are much more intuitive and helpful for controlling visuals like what you are trying to do. I would highly recommend looking into newer versions and learning Process Flow. This will allow you to do much more with simulation and with a lot less custom code.

If you'd like to go the first route and insert code, let me know and we can come up with something that would achieve your desired parameters.

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
2 Likes"
Joerg Vogel answered Julian Sundermeier commented

There is a problem with the item on the processor. There are existing events in the event list, for example the Process finish event. If you delete this item the event occurs and causes an error in the engine, because the item it is pointing to doesn't exist anymore. You can try to fetch those events and delete them. If the original item can finish the processing and you send it to a sink at a special output port or by the command moveobject, the events won't interfere.

If you think you need an object, that behave like a processor but only storing an item and changing states, you can use a queue. The behavior is controlled by delayed messages. You hold the item in the queue by not sending the item (Do Not Release Item). If the item should leave you call on the item the command releaseitem(obj item, num output port number). Even if there occurs a delayed message that manipulates an item not existing in the queue you can check if it exists in the queue and ignore the action.

If you need a supporting operator you implement the utilize tasksequence on your own.

To copy an item you can try the commands createcopy(...) or insertcopy(...).

· 7
5 |100000

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

Julian Sundermeier avatar image Julian Sundermeier commented ·

Excuse me for my late response.

I've tried a little with the commands but it does not work properly yet.

If I execute the createcopy command with two buffers, the model creates a duplicated flowitem at the position i mentioned.

But if I try to execute the command on the "OnBreakdown"-trigger, nothing happens.

Then I tried to do a workaround using Messages:

The OnBreakdown-trigger should send a message to the involved machine, which then executes the createcopy command, using the OnMessage-trigger. Unfortuniatly this doesn't work either.

Attached you see my model with the three approaches.

Maybe you have an other idea?

example-duplication-v2.fsm

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Julian Sundermeier commented ·

Ok, there is a bug in the engine. I had to insert a timetable for the processors. After that I had to delete the source code in the triggers and write the code anew. Then you can delete the timetable under tools again.

There are missing some references, too.

"item" isn't enough for a declaration.

treenode item = last(involved);

or

treenode item = last(node("Processor3",model());

instead of the function "last(treenode node) " you can use "first(treenode node)" or "rank(treenode node,num [order number of the item])"

If there aren't any items at a processor you can't copy nothing which contains a NULL reference. Therefore you test the existance of items by the code

if(objectexists(item)) 

or

if(content(current))

or

if(content(involved)) //On Breakdown<br>

The reference "itemcurrent(current)" doesn't work in the function On Break Down. Please try a suggestion from above instead.

example-duplicate-jv.fsm Flexsim Version 7.3.6

1 Like 1 ·
Julian Sundermeier avatar image Julian Sundermeier Joerg Vogel commented ·

Thank you very much so far!

But I got one more question: Your attached model behaves the same way as I imagine when the first breakdown on the processors occur (after 10 secs). However, the second breakdown (after 25 seconds) will not create a copy of the flowitem. Where does it come from? @Jörg Vogel

0 Likes 0 ·
Show more comments

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.