Go Back   Computer Forums > General Computing > Software and Operating Systems
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-07-2013, 07:36 AM   #1
Beta Member
 
Join Date: Dec 2013
Location: Germany
Posts: 5
Default Arena 12 Rockwell: Create Module

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!
__________________

Chess is offline   Reply With Quote
Old 12-07-2013, 01:57 PM   #2
..m.0,0.m..
Site Team
 
iPwn's Avatar
 
Join Date: May 2010
Location: USA
Posts: 3,870
Default Re: Arena 12 Rockwell: Create Module

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.
__________________

__________________
Me: You'd think as the dominant species we wouldn't be so effing stupid.
J: We're just intelligent enough to be completely effing stupid.
iPwn is offline   Reply With Quote
Old 12-17-2013, 06:34 AM   #3
Beta Member
 
Join Date: Dec 2013
Location: Germany
Posts: 5
Default Re: Arena 12 Rockwell: Create Module

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?
Chess is offline   Reply With Quote
Old 12-17-2013, 09:33 AM   #4
Fully Optimized
 
jmacavali's Avatar
 
Join Date: Jun 2009
Posts: 4,867
Default Re: Arena 12 Rockwell: Create Module

I bet there are more specific forums for this software. I doubt anyone here has any experience with it.
__________________
****************************************
Don't take life too seriously -- no one gets out alive. Plus, who wants to arrive to the hereafter in pristine condition wearing a suit and tie?
I want to slide in sideways, worn out, used up, hair a mess, clothes tattered, & screaming, "Whooo! What a ride!"
****************************************
jmacavali is offline   Reply With Quote
Old 02-13-2014, 03:47 PM   #5
Solid State Member
 
Join Date: Feb 2014
Location: Brazil
Posts: 11
Default Re: Arena 12 Rockwell: Create Module

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.
pedromss is offline   Reply With Quote
Reply

Tags
arena, if-statement, rockwell

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 01:05 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0