Showing results for
Do you mean
Solved!

# process sequence control and manipulation

[ Edited ]

Hello,

I just started modeling in plant stimulation. I couldn't find a similar post to my question so I decided to make a new post.

To estimate the production lead time, I need to model my factory production. Suppose my production consist of 5 departments A,B,C,D,E. Each department has 3 stations with the same processing time, input and output.

I need to make a product with component comp1, comp2, comp3, and comp4

• comp1 uses department sequence A, B, C, E (department D skipped)
• comp2 uses department sequence A, B, D, C, E (department C and D reversed)
• comp3 uses department sequence A, B, C, B, D, E (comp3 use department B twice, think it as repeating step B, not to confused with doubling the resource in department B)
• comp4 uses department sequence A, B, C, D, E, however due to quality issue detected at department D, rework is needed from department B onward (ie sequence would be A, B, C, D, B, C, D, E)

Finally all these component are assembled to the finished product.

If I try to connect the desired sequence with connector, I found myself need to connect every station in a 2 way manner, this model doesn't work. Can anyone guide me through this in a simple way?

Thanks

lanette

10 REPLIES
Solution
Solution
Accepted by topic author lanette
‎09-18-2016 11:38 PM

## Betreff: process sequence control and manipulation

Hi Lanette,

I'm afraid I don't see a *very* simple solution here without doing a little bit of programming in SimTalk-Methods. As you say, there would be a lot of connectors required and it would become very crowded and easy to make mistakes.

So here's what I'd do:

1. I assume that we can use ParallelProc to model your departments, each with a 1x3 capacity representing 3 parallel stations (each MU may use any of the 3 stations in a department and only needs to use one of them); then I would place 5 such ParallelProc into the model and call them A,B,C,D,E.
2. I would also put 4 buffers in the model, one for each component-type to collect them and have them wait for assembly; those I would call comp1,comp2,comp3,comp4 (and give them unlimited capacity).
3. I would use no connectors for the source(s), departments and buffers!
4. Create your own "comp"-MU-class in the class library (duplicate the "Entity"-class) and add 2 user-defined attributes to it:
1. myDepartmentSequence, type list (of strings)
2. myNextDepartment, type string
5. Derive this "comp" class 4 times to create sub-classes comp1..4; for those you can fill the myDepartmentSequence as required by you! This also allows you to use different colors for each component, so it's easier to tell them apart in the animation!
6. Now you need to insert a method into your model, call it "GetNextDepartment" and fill it with code to find out, to which department this MU must go next:
```is
do
-- determine the next department for this MU
if @.myDepartmentSequence.empty then
@.myNextDepartment := "finished";
else
@.myNextDepartment := @.myDepartmentSequence.cutRow(1);
end;
end;```
7. Now I would use a 2nd method and call it "GoToNextDepartment". I would set this method as ExitCtrl of the comp-Source(s) and the departments (make sure it's FRONT-activated and ONLY CALLED ONCE). There you need this code:
```is
do
-- update which department is next
GetNextDepartment;

-- finished part or go to next department?
if @.myNextDepartment = "finished" then
-- (try to) move to buffer for this component-type
@.move(str_to_obj(@.name));
else
-- (try to) move to target department
@.move(str_to_obj(@.myNextDepartment));
end;
end;```
8. Now your components are "teleported" between the departments in the right sequence without connectors and after the last processing step collected in separate buffers.
9. Adding an assembly to the finished product should be straightforward.
10. Adding your special requests for comp4 can also be added easily with a bit of programming. The thing about comp3 and department B I did not understand

Sorry for the German screenshots, btw Also, it's a lot of text, but actually it should be quite simple to implement

Regards,

Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
This answered your question? Please mark it as "Accepted Solution", thank you!

## Betreff: process sequence control and manipulation

[ Edited ]

Hi Alex,

Thank you for quick response and solution.

To clarify your doubt:

10. Adding your special requests for comp4 can also be added easily with a bit of programming. The thing about comp3 and department B I did not understand

The comp3 needed to use department B twice during the production, think it as a repeat step B after step C and then continue on. You actually got the sequence right.

I replicated your solution completely, the comp1 (skip sequence) and comp2 (reverse sequence) works perfectly. However, I faced a problem with the comp3 (repeat sequence), with the sequence A,B,C,B(repeat),D,E. The comp3 stopped at department C, when it suppose to go back to B again and continue D and E. Here's the problem:

Comp3StoppedAtC

I think the stoppage happens because the comp3 at department C could not go back to department B because B was fully occupied, likewise comp3 at department B cannot move forward to C because C was also fully occupied. So I found the solution by creating a "RepeatBuffer" to temporarily store the the output of department C and then feed them back to B again to continue the sequence B,D,E. Likewise I apply it to comp4 to model the rework sequence A,B,C,D,B,C,D(repeat/rework),E.

repeatBuffer

Later I will implement this into my main model and hope it will work.

Thanks

Regards

lanette

## Betreff: process sequence control and manipulation

[ Edited ]

Hi Alex,

In reality, every station in a department has different processing time, I make a department F with 2 stations, F1 and F2. The processing time for F1 and F2 is 1 min and 2 min respectively. I model the department with hierarchy. I created a new component: comp5 with department sequence from A,B,C,D,E,F. The test run stop when comp5 reach department E and unable to go to F. May I know how to make it work?

Thanks

lanette

Solution
Solution
Accepted by topic author lanette
‎09-19-2016 05:59 AM

## Betreff: process sequence control and manipulation

Hi Lanette,

actually I was afraid such deadlocks might occur in your problem setting, but wanted to keep the steps simple first I'll answer to your other post, where you have already started to build your own department-network.

I saw some older messages that seem to have been removed/edited now; so you figured out how to use the ProdSequence table in combination with the source, I guess

Regarding the rework sequence for comp4, I assume it does not happen for *each* comp4 part, but only sometimes. So here's what I would add to the GoToNextDepartment method at the beginning:

```is
myRandomNr	: real;
do
-- for comp4 on department D, there maybe rework required!
if @.name = "comp4" and ?.name = "D" then
-- get a random number between 0 and 100
myRandomNr := z_uniform(1,0,100);

-- in 10% of parts, rework is required:
if myRandomNr < 10 then
-- insert rework-sequence B-C-D next
@.myDepartmentSequence.insert(1,"B");
@.myDepartmentSequence.insert(2,"C");
@.myDepartmentSequence.insert(3,"D");
end;
end;
...
...```

Regards,
Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
This answered your question? Please mark it as "Accepted Solution", thank you!
Solution
Solution
Accepted by topic author lanette
‎09-19-2016 05:59 AM

## Betreff: process sequence control and manipulation

Hi Lanette,

I guess the problem is that until now, there was an object named A,B,...E that could directly hold MU's. A network as such cannot directly hold MU's, you need some material-flow objects like Buffer or SingleProc for that. In the method GoToNextDepartment, the MU tries to move to "F" now, which is only the network:

`@.move(str_to_obj(@.myNextDepartment));`

I would suggest to use the structure you have created for department F for *all* departments (this can also help to avoid your deadlock in the other post). My network would look like this:

Please note that BufferIn should *not* have unlimited capacity unless you change your source-behavior (or the source will produce infinite amount of parts at time 0, which is like an infinite loop)!

Now you need to adjust the GoToNextDepartment slightly, because now we will always move the components to B.BufferIn, for example. You need to change 3 lines:

1. if @.name = "comp4" and ?current.name = "D" then
2. @.move(str_to_obj("root."+@.name));
3. @.move(str_to_obj("root."+@.myNextDepartment+".BufferIn"));

The "root." is necessary, because now your objects are in different networks and inside "B", the object "C" is not known directly.

If you like, you can also create animation of what's happening inside your network. Open the symbol-editor of myDepartment in the class library (right-click, edit symbol), then select the "Animation" tab on the ribbon bar. Insert 3 points and 1 line, then connect them with the SingleProcs and Buffer:

Now you can also add department "F" and delete the 3rd connector and/or SingleProc to make it a 2-station-department. Looks like this for me:

Regards,

Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
This answered your question? Please mark it as "Accepted Solution", thank you!

## Betreff: process sequence control and manipulation

Hi Alex,

I saw some older messages that seem to have been removed/edited now; so you figured out how to use the ProdSequence table in combination with the source, I guess

Certainly

Everything is now working perfectly, except I find the rework mechanism for comp4 is not working as expected. The buffer statistics for the rework sequence B,C,D for comp4 should be slightly higher due to rework. I even increased the source input amount of comp4 to 150, the buffer statistics for B,C,D show the same amount. (expected a 10% higher)

I tried to make a change from this:

`if @.name = "comp4" and current.name = "D1" then`

to this:

`if @.name = "comp4" and (current.name = "D1" or current.name = "D2" or current.name = "D3") then`

Clearly it doesn't work. I am absolute newbie in Sim Talk, can you show me how?

Where would you recommend to go for a good Sim Talk tutorial for beginners?

Thanks again

lanette

## Betreff: process sequence control and manipulation

Hi Lanette,

In case you are using networks for all departments now, you should stick with

`current.name = "D"`

not "D1" as you wrote here.

You can set a breakpoint in the method where the rework-sequence is inserted (open the method, select the target line and press F9. Then when the model is running and a comp4 has to do rework, the debugger will open and you can watch that part slowly, as it goes back through B-C-D (press "Stop" on the eventcontroller, go back into the debugger, press F5 or close the window, then press "Start" on the eventcontroller again with slower speed).

So either your rework-method was not working, or the buffers are always filled completely by the source already, whether or not you have rework active. I expect it was the former.

As for SimTalk, I don't know whether I can put "advertisement" here, but I used a book by Stefan Bangsow (@Steffen_B)

Regards,

Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
This answered your question? Please mark it as "Accepted Solution", thank you!

## Betreff: process sequence control and manipulation

Hi Alex,

Thanks for responding.

So either your rework-method was not working, or the buffers are always filled completely by the source already, whether or not you have rework active. I expect it was the former.

Here is my current code:

```is
myRandomNr	: real;
do
-- for comp4 on department D, there maybe rework required!
if @.name = "comp4" and current.name = "D" then
-- get a random number between 0 and 100
myRandomNr := z_uniform(1,0,100);

-- in 10% of parts, rework is required:
if myRandomNr < 10 then
-- insert rework-sequence B-C-D next
@.myDepartmentSequence.insert(1,"B");
@.myDepartmentSequence.insert(2,"C");
@.myDepartmentSequence.insert(3,"D");
end;
end;
-- update which department is next
GetNextDepartment;

-- finished part or go to next department?
if @.myNextDepartment = "finished" then
-- (try to) move to buffer for this component-type
@.move(str_to_obj("root."+@.name));
else
-- (try to) move to target department
@.move(str_to_obj("root."+@.myNextDepartment+".BufferIn"));
end;
end;```

I put a F9 flag on

`@.myDepartmentSequence.insert(1,"B");`

nothing pop up.

I have also included my model in the attachment.

thanks

lanette

Solution
Solution
Accepted by topic author lanette
‎09-19-2016 10:17 PM

## Betreff: process sequence control and manipulation

Hi Lanette,

I can only open your model in viewer-mode, so I can't look into the models or debug it.

I placed the GetNextDepartment and GoToNextDepartment methods also inside each department-network. You only placed them in the model-root-network. Please use "@.location.location.name" instead of "current.name", then I think it should work.

Regards,

Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
This answered your question? Please mark it as "Accepted Solution", thank you!