BookmarkSubscribeRSS Feed
Quentin
Super User

Hi All,

 

I think this might be a queueing theory problem, and maybe SAS/OR would be useful, but I haven't played with this before.

 

Suppose you have a manufacturing line that has 3 steps in series. You have been given an estimate of the mean time and SD for each step. From that, you want to estimate the production speed for the full process (parts manufactured per hour). At first I thought it would be simple simulation (simulate a bunch of data, and add up the steps). But then of course it's more complex because the manufacture time for each part isn't independent. It's a queue, where if step 3 runs slow for one part, all the parts behind it need to wait
 
I know there is fancy digital twin software for this sort of simulation. But wondering if anyone has done basic simulations of the speed of this sort of queue.  Obviously it's not just a manufacturing problem.  I have access to SAS/OR if that would be useful.  Or if someone has thoughts on how to simulate this in a DATA step, I'd be happy to hear them.  Or just links to basic papers (SAS or non-SAS), since I've never thought about this sort of problem before.
 
Maybe a simple DATA step approach wouldn't be crazy.  Perhaps simulate a dataset with one record per part, and an array of variables with the completion time of each step. For each record you simulate, the start time of a step is the maximum of (completion time of prior step, completion time of the step for the prior part).

Thx
The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
8 REPLIES 8
Quentin
Super User

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 ;
run ;

Which returns:

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.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
Reeza
Super User
My first thought is queuing distributions are usually Poisson distributed not normally.

I think you need a queue maximum size as well for each step, ie how many can be on the belt before it pauses or slows down the next step.
Quentin
Super User

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

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
Reeza
Super User

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. 

Quentin
Super User

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. : )

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
Reeza
Super User
lol. Or spend the rest of your life solving that problem. Yeah, sometimes a specialized solution is warranted for sure.
Ksharp
Super User
I think it is more like data simulation than OR problem.
Calling @Rick_SAS

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 8 replies
  • 1505 views
  • 11 likes
  • 3 in conversation