Solved

Creating a Simulation in Aimms


Badge +3

Hi everyone, 

I need to make a simulation in Aimms to simulate the mechanism on the following picture: 

 

 Order Release Mechanism

 

I have no problem in declaring all the sets and parameters, but my main 2 problems are too make the periods pass correctly and repeat all processes in the periods and too update the loads and sets at the right points in time. 

 

I have too do this via simulation so without an objective function thats also something that throws me off cause i cant use a Mathematical Programm so solve this. 

 

Maybe the solution is simple but i havent ever worked with Aimms and that is a very big project for me, which is also very urgent so i really appreciate any help i can get. 

 

With kind regards

 

Alex

PS.: The programm i made so far is attached as a zip-file. Maybe u can tell me how i need to adapt it to make it work. 

icon

Best answer by deannezhang 28 July 2022, 03:36

View original

7 replies

Userlevel 4
Badge +3

Alex, since AIMMS supports procedural language, it should be no problem to implement the logic. 

Maybe more concrete about your questions? 😀

Badge +3

Hi @deannezhang ,

 

my bproblem is how to keep track of the current workload on each machine, update it correctly for the next period and how to simulate that an order after a certain amount of time periods moves on to another station, according to the routing of the order (which also influences the current workload on the stations.

 

I hope this makes my question a bit more clear :)

Userlevel 4
Badge +3

If workload(m,t) is the workload of each machine for each period, and you want to use the current period load to initilize the next period, you can use 

for t do:

    if ord(t)=0 then

        workload(m,t) := initialworkload(m,t);

    else

        workload(m,t) :=workload(m,t-1);

    endif

endfor;

 

for your second question,  you want to track the status of order, whichever way is convenient for you to implement the algorithm. for example:

  1. an element parameter range over period,  to track when an order starts on a machine: epOrderStartsOnMachine(o,m)
  2. an element parameter range over machine,  for each order’s machine at t: epOrderOnMachine(o,t)
  3. an element parameter, range over machine,  for the routing of the order: epOrderNextMachine(o,m)
  4. a parameter for the lengh of an order on machine: pOrderProcessTime(o,m)

 

Hope this is helpful.

Badge +3

Hey @deannezhang , 

 

Thank you very much for your answers so far, really helped a lot. However i have one last question, if you dont mind. 

 

When checking if an order needs to be shifted to the next Station, i have setup this For-Loop: 

 

for (j in OrdersInProduction) do 

if (TimeOfOrderOnStation(i,j) >= ProcessTimeOfOrder(i,j)) then  
OrderOnStation(j,t)  := OrderNextStation(j,i);
else
OrderOnStation ((j,t) | t >= '2022-07-01 02') := OrderOnStation(j, t-1);
endif;
 

I get the error message  Index i has not been specified, which is expected since i hadnt specified it, but i dont know where or how to specify it correctly in that case. (i is the index for my Workstations btw.)

 

Do you know where i made a mistake or how i can solve this error message ? 

Thank you once again for your time and patients.

Userlevel 4
Badge +3

At each t, an order is on one certain station, using an element perameter OrderOnStation(j,t) , ranged over set Station, to track the station. Then the code will be like:

for (j in OrdersInProduction) do 

if (TimeOfOrderOnStation(OrderOnStation(j,t),j) >= ProcessTimeOfOrder(OrderOnStation(j,t) ,j)) then  
OrderOnStation(j,t)  := OrderNextStation(j,OrderOnStation(j,t) );
else
OrderOnStation ((j,t) | t >= '2022-07-01 02') := OrderOnStation(j, t-1);
endif;

 

Deanne

Badge +3

At each t, an order is on one certain station, using an element perameter OrderOnStation(j,t) , ranged over set Station, to track the station. Then the code will be like:

for (j in OrdersInProduction) do 

if (TimeOfOrderOnStation(OrderOnStation(j,t),j) >= ProcessTimeOfOrder(OrderOnStation(j,t) ,j)) then  
OrderOnStation(j,t)  := OrderNextStation(j,OrderOnStation(j,t) );
else
OrderOnStation ((j,t) | t >= '2022-07-01 02') := OrderOnStation(j, t-1);
endif;

 

Deanne

Implementing this will give me the error:  scope of index t has not been specified. (for the if-Statement). I tried to use an ElementParameter CurrentPeriod with the Range HourCalendar to fix this. This helps to remove the error, but the data for parameter OrderOnStation(j,t) is completly empty then.

 

For reference: If an order gets released i assign the first station in the routing of order j to that order. That works but then i have this bit of code before i go into the next period and then the parameter data is completly empty. 

 

Do you have any idea why that could be the case?

 

Kind regards

Alex

Userlevel 4
Badge +3

I assume t is the iterator in the algorithm? Then you will initialize the first t, such that the order is on the first machine. in case there is not enough machine initally, you may need a virtual machine to make sure all orders can be assigned. Then as the iteration goes on, result of t+1 will be generated based result of t.

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator