ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
Airport Simulation
Hi,
This is my first posting in this forum. I am quite new to FlexSim, using it since December 2007. I am currently building an airport simulation model for my Final Year Project at NTU. I've posted a few questions below, hoping that anyone of you could help me solve them. Question 1: Person FlowItem vs TaskExecuter FlowItem Is the normal Flowitem any different from the TaskExecuterFlowItem. From an airport security model demo I've got, the passengers (modelled as TaskExecuterFlowItem) are animated to walk. I've read the manual and it states that this can only be done to TaskExecuter FlowItem. Would it alter my model if I change my Passenger FLowitems to TaskExecuterFlowItem? This isn't that important to my model. But it would be nice to see my passengers walking. Question 2: Creation of New Flowitems Through Message Passing I'm currently trying to model the baggage claim conveyor belts for arrival passengers. , Upon passengers' disembarkation from the plane, I would like to create baggage(s) for each arriving passenger, which will then follow different route from the passengers. In order for them to be correctly matched with their owners, I've assigned special ID (assigned a label for each passenger called "ID") to each passenger. What I did was I created a Queue Object and connected it to the centerport of the Source Object. So everytime a Passenger Flowitem is created, the Source will send a message to the Queue to create Baggage Flowitems. It was documented that I am allowed up to 3 parameters to be sent to the centerobject. Therefore, first parameter would be the number of baggages to create (I used duniform(1,2)). Second parameter would be the rank of the flowitem to create(I specified it as int value 5, creating a texture coloured box). The problem is, I would like the Passengers' ID to be passed as the third parameter, so that the baggage can be assigned the same ID as the passengers. Below are the codes: OnExit (of Source Object): ================================================== ========= /**Declaration of Variables*/ double param1 = duniform(1,2); //randomly create 1 or 2 baggages per Passenger double param2 = 5; //create a Texture Coloured Box Flowitem double param3 = getlabelnum(item,"ID"); //unique ID of each Passengers int condition = true; /**Message sending*/ if(condition) { if(delaytime < 0) sendmessage(toobject,fromobject,param1,param2,para m3); else senddelayedmessage(toobject, delaytime, fromobject,param1,param2,param3); } ================================================== ==== OnMessage (of Queue Object) ================================================== ==== /**Create Flowitems*/ int numitems = msgparam(1); //number of items to create int flowitemrank = msgparam(2); //flowitem bin rank int PaxID = msgparam(3); //corresponding passengers' ID treenode destination = current; for (int index = 0; index < numitems; index++){ insertcopy(first(rank(node("/Tools/FlowItemBin",model()),flowitemrank)), destination); setlabelnum(item, "PaxID",PaxID); //setting an ID for this baggage similar to its owner } ================================================== ===== However, the PaxID label was never set to the passed parameters. A printing check such as pt(numtostring(param3)) did print out the IDs, indicating that the parameters were successfully passed. Are there any particular reasons why can't I set the IDs to each of the baggage? All the baggage has an ID of 0.00. Question 3: Baggage Claim Issues I've broken up the conveyors into 8 different segments. This is to achieve randomness, due to the fact that Passengers stand all over the baggage conveyor area to claim their baggages. Each passengers will then randomly proceed to any of the 8 segments to wait on their baggages and will be stored on floor racks. Where the baggage flowitems are concerned, on entry to these conveyor segments, each baggage will check whether its owner is already present in the racks placed at each conveyor segment. Therefore, I must make sure that the Passenger Flowitems are held in the racks until their baggages arrive. What I did was I set the Send to Port to "Do Not Release Item". My plan is to traverse through every node of the Rack tree, and try to match the Passengers ID with the Baggage ID. If that passenger is its owner, then their ID match. Lets just say I manage to solve the issue at Question 2, can I just use the releaseitem() method to release selected Passengers? I really have a whole lot of questions on FlexSim. Maybe I should attach my model on the next post, once I am done tidying it up. Regards, Fad |
#2
|
||||
|
||||
Hi Fad,
First off all, thank you for your lengthy and thorough explanation. That makes it a lot easier to understand what you are doing and how to solve it. Question 1: If you just changes them it probably wouldn't make any difference and you can easily test it yourself by just selecting the taskexecuter flowitem on the source and let your model run. But if you want to let the taskexecuter flowitem move like a passenger you have to give it a tasksequence by using the right "Request Transport From" rule (Task Executer as Flow Item) or create your own tasksequence, and create a pathnetwork where they can travel on. So I would try this first in a small test model before I would implement it in the model you are working on Question 2: If you want to set a value on a label, that label has to exist. There are 2 easy ways to get over this problem. First you can create the label on the object in the flowitem bin that you are copying. Or the other solution by using the command addlabel. In your case that would be: addlabel(item, "PaxID",PaxID); Question 3: Yes , releaseitem() should do the trick. Regards, Steven |
#3
|
|||
|
|||
Hi Steven and all,
Thanks for your feedback. Appreciate it alot. Finally tidied up my small model. I've attached it with this post. Quote:
Just to explain abit about the message passing. The Source passes 3 parameters to the Create Baggage-Queue object. The Create Baggage object will then create the number of baggage accordingly and assign a flowitem rank. The third parameter (param3 = msgparam(3)) is the Passengers' ID. With the label already initialised, I thought I would just do this: setlabelnum(item,"PaxID", PaxID); But nothing every happened. I am unsure as to why this is so. Other Questions As seen from the model, I've used Rack to simulate a waiting area. This is because passengers tend to stand randomly without any particular order while waiting for their baggage. The closest I can get trying to simulate this is by using Rack, and assigning random bays. However, the problem comes in when 2 passengers are randomly assigned the same bays. This will cause the Passengers to be ridiculously stacked on top of each other. Is there a way to get around this? Additionally, the Racks have the 3D shape that i would like to get rid off. Ideally, I would love to have no racks shape at all, so that it appears that PAssengers are actually standing randomly. Is it possible to get rid of this? Regards, Fad |
#4
|
||||
|
||||
Hi Fad,
Sorry Fad, I didn't check your code correctly. The problem is that you use "item" in the onmessage trigger to point to your newly created luggage. But of course that pointer "item" is not defined (set) yet. And it is not declared either. So first declare it at the top of your code: treenode item = NULL; and then the insertcopy returns a pointer to the object that is created so that makes it easy here: item=insertcopy(first(rank(node("/Tools/FlowItemBin",model()),flowitemrank)), destination); That way your code works. item is passed in in most triggers but not in the onmessage, unless you use 1 of the parameters to pass it in. You can always check if the item pointer can be used in that particular trigger by checking at the top of the code and see if it is defined there. Concerning your other question about the rack, simply keep the x key pressed and click on the rack. That way you can change between different appearances of the rack and 1 of those is a flat area on the floor with spaces. On the "place in bay" and "place in level triggers" you can select the options "Random bay if available" and there the standard amount in a cell is 1. So that should solve your other problem. Regards, Steven |
#5
|
|||
|
|||
Oh my God. It worked. Genius. Thanks alot.
But I was just wondering now that the ID issue has been solved, how should I go about searching each segment? I thought that I should just traverse and search from the first to the last sub-trees of each segment and check whether their IDs are the same as the Baggage right? If it does, means its a match. But if I were to do this for every other baggage, wouldn't it be hundreds of baggage checking at the same time? This would create a lag wouldn't it? And somehow related to issue above, the license I am on does not have an Experimenter. As such, I will have to create some codes to pause the current simulation, save its state and run a few scenarios based on that saved state. The best scenario will then be taken as the optimised state, and this will be feedbacked to the main model, after which the main model will continue running from where it stopped. I don't know how I am supposed to go about implementing this, but I just have a few starter questions. I want my scenarios to run for a period of 2 hours. The first thing that would come to mind is to do this. double startTime = time(); go(); while(time()-startTime<120){ //keep running the simulation } stop(); Are there any better ways to implement rather than to use a while-loop, which might require more resources as the codes will keep on checking whether its 2 hours yet? Regards, Fad |
#6
|
|||
|
|||
Flexsim 4.3 has a Stop Time field at the bottom of the screen. You can also manually set the stop time by going into the tree to MAIN:/project/exec/stoptime.
If you have an earlier version that doesn't have this feature, you can create a user event at time 120 that just contains the code stop(); |
#7
|
|||
|
|||
If you use couplings, you won't need to search at all. Here's how:
First, when you send a message to the queue telling it to make a flow item, make sure you're sending it from item, not current. This way in the onMessage trigger of the queue, you'll be able to access the person (the flow item you want to couple with the baggage) by using the msgsendingobject() command. In the onMessage trigger of the queue, store the address of the flowitem you copy into the queue then use it to make a coupling with some code like this: treenode item=insertcopy(first(rank(node("/Tools/FlowItemBin",model()),flowitemrank)), destination); createcoupling(labels(item),labels(msgsendingobjec t())); This will make a label with a number that is a pointer to a label in the baggage flowitem which contains a number that is a pointer to this label. Now, if you want to find out which conveyor contains the baggage of the passenger, you just need to use this code: treenode currentlabel=first(labels(item));//item is the person //'item' could be replaced with 'current' if called from inside the person //or the node() function if you know exactly where the person will be in the tree. treenode conveyor; while(objectexists(currentlabel)){ pt(getnodename(currentlabel));pr(); if(comparetext(getnodename(currentlabel),"Personsu bnode")){ treenode baggage=tonode(getnodenum(currentlabel)); conveyor=up(findownerobject(baggage)); } currentlabel=next(currentlabel); } if(objectexists(conveyor)){ pt(getnodename(conveyor)); } |
#8
|
|||
|
|||
Starting State Files from External Program
Hi once again,
I am trying to load a flexsim state file (state1.fst) from windows command prompt. So what i did was: C:\> start state1.fst However, the command prompt always ask me to specify the associated program, which is FlexSim. As such, this pop-up will appear. In an attempt to reduce user's interactivity as much as possible, how can I overcome this? Or what command should I use to load the state file automatically, without windows asking me for the associated program? Regards, Fad |
#9
|
||||
|
||||
Wouldn't it be solved if you first select the program in windows and select the option always use this program to open fst files? Worth trying.
|
#10
|
|||
|
|||
And I've came to realise that state files is successfully loaded only when the main model is open. In other words, you must open your model first, and then load your state files. Opening your state files by the traditional double-clicking method will open an empty file. And the model() tree is also empty.
|
#11
|
|||
|
|||
SimAir
I dont want to discourage you from building airport simulation tool. just wantr to let you know that Georgia Tech has developed SimAir that does simulate crew, flight, recovery, and ground operations.
it is open source as well. perhaps you could add on top of that. or you could benchmark your model against that one. thanks, Vinay |
#12
|
|||
|
|||
But do they have forum as responsive as this? I feel that FlexSim's forum is very responsive and receptive. Which is why I rather use FlexSim than any other specialised airport simulation tool such as ARCPort and SimTech. Anyway, it's good to know that there are alternatives. Thanks Vinay.
Regards, Fad |