Arena 12 Rockwell: Create Module

Chess

Beta member
Messages
5
Location
Germany
Hi guys,

I have a problem with Rockwell Arena 12.

I'd like to create a "Shopping model" for a supermarket, with an Entrance (create), shopping process (delay), n different cash points(process) and an exit(dispose).

To determine the distribution of the arrival times I divided the arrival rates in 15 minutes time intervals (8:00 am, 8:15am, 8:30am...22:00pm) for each weekday (monday, tuesday.. saturday).

Now i want to write an expression in the create module which should "check on/search for" the actual weekday and time interval.
here an example(not an arena expression!):

IF(weekday(TNOW)=="monday" && Time Inverval(TNOW) >=08:00am && Time Interval(TNOW) <=08:15) THEN normal distribution (0.7,0.15)

IF(weekday(TNOW) == "monday" && Time Interval(TNOW) >= 08:15am &&Time Interval(TNOW) <= 08:30) THEN normal distribution (0.6,0.15)

..

IF(weekday(TNOW)=="saturday"&&Time Interval(TNOW)>=21:45pm &&Time Interval(TNOW) <= 22:00pm) THEN normal distribution (0.4,0.05)

I hope u guys understand what i am trying to achieve with that statement and somebody can help me to find a solution.

Thanks for your help! :)
 
Caught me on a lazy Saturday :).
Here's a C# example of how I would accomplish this. Hopefully you can understand, modify, improve for whatever Arena is...

Code:
using System;
using System.Collections.Generic;

namespace TestApp
{
    class Program
    {
        public static int timeIntervals = 56; //four intervals per hour
        public static double weekdayDistribution = .15; //I assumed these were based on weekdays
        public static double weekendDistribution = .05;
        public static DateTime timeNow = DateTime.Now;
        public static TimeSpan openingHours = new TimeSpan(8,0,0);
        public static DateTime startTime = timeNow.Date + openingHours;
        public static TimeSpan closingHours = new TimeSpan(22, 0, 0); //10pm close time
        public static DateTime finishTime = timeNow.Date + closingHours;
        public static double[] finalDistribution = { 0, 0 };
        public static string MessageToShopper; //Demonstration only
        public static List<DayOfWeek> weekendDays = new List<DayOfWeek> { DayOfWeek.Sunday, DayOfWeek.Saturday };

        static void Main(string[] args)
        {            

            if (timeNow >= startTime && timeNow <= finishTime) 
            {
                if (weekendDays.Contains(timeNow.DayOfWeek))
                {
                    finalDistribution[0] = FindTheFirstDistributionInFifteenMinuteIntervals();
                    finalDistribution[1] = weekendDistribution;
                }
                else
                {
                    finalDistribution[0] = FindTheFirstDistributionInFifteenMinuteIntervals();
                    finalDistribution[1] = weekdayDistribution;
                }

                MessageToShopper = "You get " + finalDistribution;
            }
            else
                MessageToShopper = "We're freaking closed!";

            //TODO: Something with the MessageToShopper or the finalDistribution
        }
        public static double FindTheFirstDistributionInFifteenMinuteIntervals()
        {            
            double distribution = 0;

            bool foundIt = false;

            for (var i = timeIntervals; !foundIt; i--)
            {
                var reverseCounter = timeIntervals - i;
                DateTime windowOfTime = startTime.AddMinutes(reverseCounter * 15);

                if (timeNow >= windowOfTime && timeNow <= windowOfTime.AddMinutes(15))
                {
                    distribution = DetermineFirstDistribution(reverseCounter);                    
                    foundIt = true;
                }
                
            }

            return distribution;
        }
        public static double DetermineFirstDistribution(int reverseCounter)
        {
            //This is where you determine the first distribution value
            //based on the number of 15 minute intervals that have passed. 

            if (reverseCounter > 50)
                return 7;
            else if (reverseCounter > 40)
                return 6;
            else if (reverseCounter > 30)
                return 5;
            else if (reverseCounter > 20)
                return 4;
            else if (reverseCounter > 10)
                return 3;
            else
                return 2;
        }
        
    }
}

EDIT: The goal here was to separate the calculations of the two return numbers. You could then simply evaluate on whether or not it's a weekend day and truncate the code even more.
 
Last edited:
yeah thanks mate, but i need it for ARENA, its a simulation software..


does anyone else know how i could do that without a DECION module?
 
I bet there are more specific forums for this software. I doubt anyone here has any experience with it.
 
I can help you, you have to use 1 Create module for each day of the week. Choose the option "Schedule" and enter Duration = 1 and the specific arrival rate.
 
Back
Top Bottom