PMC Forums  

Go Back   PMC Forums > Simulation > Simulation Analysis
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Simulation Analysis simulation software (Arena, AutoMod, Enterprise Dynamics, ExtendSim, PlantSim, ProModel, SIMUL8, WITNESS), input and output analysis, experimental design, optimization, simulation model verification and validation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-23-2012, 01:12 PM
lthoa lthoa is offline
Member
 
Join Date: Jun 2011
Posts: 28
Default Arena - Creating new variable on the fly

Hi all,

I'm using VBA make my Arena model somehow more flexible. I'm now stuck at one simple thing, how to create a variable dynamically? For example, I have a variable called Scenario whose value I read from a Excel file. If Scenario == 1, I'd like create variable 1; if Scenario == 2, I'd like to create Variable 1 and Variable 2. It seems that creating a variable dynamically is impossible in Arena.

Does anyone have suggestion?

Thank you in advance.
Reply With Quote
  #2 (permalink)  
Old 01-31-2012, 03:00 PM
ewilliams ewilliams is offline
Moderator
 
Join Date: May 2007
Location: Detroit area, Michigan, U.S.A.
Posts: 218
Send a message via Skype™ to ewilliams
Default Create new variable dynamically?

I doubt this can be done. Others with news of how it can? Meanwhile, you might create an array (one-dimensional) with subscripts accommodating the largest "name" desired, and use that for storage of values.
__________________
E. Williams, PMC
Reply With Quote
  #3 (permalink)  
Old 02-02-2012, 11:13 AM
lthoa lthoa is offline
Member
 
Join Date: Jun 2011
Posts: 28
Default

Actually I don't get your idea of one-dimensional array but thank you very much William.

To me it's really weird because at least with the VBA, we can create e.g. station or even model... but it cannot create a variable! I need this dynamic creation because it make my model flexible and I can put data stuffs to Excel which is more comfortable to work with.
Reply With Quote
  #4 (permalink)  
Old 02-03-2012, 05:20 PM
Hirotaro Hirotaro is offline
Senior Member
 
Join Date: May 2011
Location: Europe
Posts: 37
Default

I believe that E. Williams is right - you cannot create a new arena variable during a simulation run. However, there might be a way to go arround this -can you be a bit more explicit about how you are going to use the variables with connection to excel?

Last edited by Hirotaro; 02-09-2012 at 06:00 AM.
Reply With Quote
  #5 (permalink)  
Old 02-04-2012, 06:30 PM
lthoa lthoa is offline
Member
 
Join Date: Jun 2011
Posts: 28
Default

Thank you. Hirotaro.

Actually my situation is a bit different than what I described(I'd like to make the question short). I'm simulating a railway network. I have a list of stations and the distances between 2 connected stations. To represent the distances between stations, I use a 2D array says Distance(source station, destination station), so if station A and B are connected, the corresponding entry will be Distance(station A, station B). The size of this 2D array will be NumberOfStations*NumberOfStations.

The data of this Distance array is read from a corresponding named range in Excel which is also 2D. I'd like to test my model first with a small dataset, i.e. small number of stations and then bigger datasets. Assuming I don't know in advance how big my dataset will be, I'd like to create the Distance array dynamically , and the size of Distance will be the square of the number of stations in the dataset. That way I can avoid changing the Distance array in Arena each time I change the dataset. In my model, I have some parameters similar to Distance, so a solution to this problem will help me a lot.
Reply With Quote
  #6 (permalink)  
Old 02-09-2012, 06:14 AM
Hirotaro Hirotaro is offline
Senior Member
 
Join Date: May 2011
Location: Europe
Posts: 37
Default

I see your point. I find adjusting arena to different scenarious quite tricky and difficult myself. There is a number of instances in which dinamic arrays would be very helpfull. Unfortunately I do not know the way of doing this in Arena. Maybe it is worth asking Arena technical support about this matter?

Cannot you just create an arena variable of size e.g. 400x400 and then just use the part of it that you need? I know that it looks quite bulky and it is not a good programming practice, but if you do not have other options... ?

Last edited by Hirotaro; 02-12-2012 at 10:16 AM.
Reply With Quote
  #7 (permalink)  
Old 02-09-2012, 10:10 AM
lthoa lthoa is offline
Member
 
Join Date: Jun 2011
Posts: 28
Default

Thank you.
Actually I asked Arena tech support but got no answer. I'm afraid that they didn't know how to do it themselves. For now I think I will do according to your suggestion.
Reply With Quote
Reply

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 Off
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:28 AM.



Content Relevant URLs by vBSEO 3.0.0