![]() |
|
|||||||
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
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. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|