Computer Forums Arena 12 Rockwell: Create Module
 Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 12-07-2013, 06:36 AM #1 Beta Member   Join Date: Dec 2013 Location: Germany Posts: 5 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! __________________
 12-07-2013, 12:57 PM #2 ..m.0,0.m..Site Team     Join Date: May 2010 Location: USA Posts: 3,671 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 weekendDays = new List { 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. __________________ __________________ Humans are the only creatures that won't live up to the their potential. Give everything your all. When you die, die on E. So I ask you, what do you intend to do now?
 12-17-2013, 05:34 AM #3 Beta Member   Join Date: Dec 2013 Location: Germany Posts: 5 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?
 12-17-2013, 08:33 AM #4 Site Team     Join Date: Jun 2009 Posts: 4,868 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!" ****************************************
 02-13-2014, 02:47 PM #5 Solid State Member   Join Date: Feb 2014 Location: Brazil Posts: 11 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.

 Tags arena, if-statement, rockwell