I think this might be a queueing theory problem, and maybe SAS/OR would be useful, but I haven't played with this before.
I'm not sure I like the idea of hand-coding this, but I'm imagining something like:
data want ; call streaminit(12345); start=0 ; do partid=1 to 5 ; do step=1 to 3 ; if step=1 then dur=int(rand('normal',5,1)) ; else if step=2 then dur=int(rand('normal',10,5)) ; else if step=3 then dur=int(rand('normal',5,1)) ; end=start+dur ; output ; *Calculate start time for next step ; SameStepEnd=lag2(end) ; if step=3 then start=min(SameStepEnd,end) ; else start=max(SameStepEnd,end) ; end ; end ; format start end datetime. ; run ;
proc print ;
var step start dur end ;
by partid ;
id partid ;
partid step start dur end 1 1 01JAN60:00:00:00 5 01JAN60:00:00:05 2 01JAN60:00:00:05 15 01JAN60:00:00:20 3 01JAN60:00:00:20 5 01JAN60:00:00:25 2 1 01JAN60:00:00:05 4 01JAN60:00:00:09 2 01JAN60:00:00:20 17 01JAN60:00:00:37 3 01JAN60:00:00:37 3 01JAN60:00:00:40 3 1 01JAN60:00:00:09 4 01JAN60:00:00:13 2 01JAN60:00:00:37 15 01JAN60:00:00:52 3 01JAN60:00:00:52 5 01JAN60:00:00:57 4 1 01JAN60:00:00:13 6 01JAN60:00:00:19 2 01JAN60:00:00:52 9 01JAN60:00:01:01 3 01JAN60:00:01:01 5 01JAN60:00:01:06 5 1 01JAN60:00:00:19 3 01JAN60:00:00:22 2 01JAN60:00:01:01 7 01JAN60:00:01:08 3 01JAN60:00:01:08 4 01JAN60:00:01:12
And I think is doing what I want.
Thanks @Reeza ,I had posted this question before I had read anything. Yes, it looks like Poisson is the way to go. I hadn't thought about limiting the queue size, but that makes sense. Seems like these simulations can be as complex as you want to make them. Looks like there is plenty of expensive software for this sort of manufacturing digital twin for simulation. Other than queueing, are there other key words I should search for? Someone mentioned job shop problem as something similar: The Job Shop Problem | OR-Tools | Google Developers
No more suggestions, except to search lexjansen as always to see what others have done if published.
I did something, not as complicated when designing a clinical trial in SAS about a 15 years ago. I remember it made my head hurt via data step. We started looking into SAS Simulation Studio but didn't get far and the data step worked so no time to redesign something that worked in the end.
Thanks again @Reeza . I worked on this a bit today, based on an email I received presenting the high-level idea. Then toward the end of the day I had a meeting with the actual product owner and quickly realized that the question was much more complex than was conveyed in the introductory email... : )
In this case, I think they would really need a tool like SAS Simulation Studio to do what they want. My company's parent company actually has a division that builds software to help manufacturers by developing "digital twins" of the manufacturing process, so that they can play with parameters and simulate the impact. Even if I managed to use a DATA step to build a simulation of the current complex process, it wouldn't have the flexibility to do all the 'what if' stuff they will want to ask. I think I'm going to have to recommend looking into an existing simulation tool, and hopefully someone who is experienced with using that tool. Apparently there is a a reason software companies can charge $$$ for simulation tools.
This was a fun thought exercise when it was a simple straight-line process manufacturing process. And I basically said "yeah, I don't really know this stuff, but maybe I could help." Then when I was 10 minutes into the meeting where they presented the details of their current process, and the challenges they're facing, I kind of wanted to just slowly back out of the room. : )
Not SAS but perhaps helpful to the process:
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.