antonio6vieira Posted July 8, 2014 Share Posted July 8, 2014 Hello guys! In the model I'm developing I have a means of transport (lets call it car) that is an entity, another entity that is a driver and a third type of entity that represents the products. The main purpose of the car is to take the driver to a destiny (to get to those destinies he needs to choose between many paths -> selection weight) and then the driver leaves the car, goes into an object I created (channel) takes the products he wants and returns them to the car. Then, if in the same place he is, he wants more products from channels above the one he is on (yy axis), he repeats the process until he is finished. After that he returns to the car and drives to the next set of channels in his "shop list". Until now, I'm modeling this as a batch of a batch (products wanted batched on the driver and driver batched on the car) but I need the products to go to the car whenever the driver returns from a set of channels (so that they don't walk always with the driver) So, I would like to know if anyone has any suggestions as how to do this. I though of something similar to Simbit "UsingAStorageQueue" but instead of using the batch step I wanted to add the products to a queue of the object that represents the car. I tried to create a Station in the car object and I put the driver there through the Transfer step but i can't remove it from that station So, can somebody please give me some advice on what would be the best approach to model this problem? Or, if you think I'm proceeding correctly, can you please tell me what I need to do to remove the driver from the station of the car? Thanks Link to comment Share on other sites More sharing options...
antonio6vieira Posted July 16, 2014 Author Share Posted July 16, 2014 In this situation, I think the approach of an entity in the station of another entity would be the best option... But I still didn't succeed in removing the entity from the station. Could someone help me please? Thank you. Link to comment Share on other sites More sharing options...
antonio6vieira Posted July 21, 2014 Author Share Posted July 21, 2014 Can somebody help me please? Thanks Link to comment Share on other sites More sharing options...
gdrake Posted July 21, 2014 Share Posted July 21, 2014 Apologize for being so slow to respond, but you should be able to: a) Add a station to an entity. b) use the Transfer step to transfer an entity into and out of the station. Make sure that you are trying to transfer into the station of the actual right entity. After an entity transfers into a station, make sure that you do an EndTransfer step to end the transfer activity so that another entity might be able to transfer into it. When you say that the transfer did not work, can you describe what you did and why it did not seem to work? Link to comment Share on other sites More sharing options...
antonio6vieira Posted July 21, 2014 Author Share Posted July 21, 2014 Thanks for your reply! Currently I have 2 problems: 1) I'm able to add the entity to a station but I don't think I'm doing it the right way since the only way I was able to do it was using variables to hold the entity I want to transfer... 2) I can't remove it in any way I try I attached a model on which I'm experiencing to see if I manage to do this. So, could you please take a look to see what I'm doing and tell me what I need to change? Thank you very much. solution1.spfx Link to comment Share on other sites More sharing options...
gdrake Posted July 21, 2014 Share Posted July 21, 2014 The Transfer step may be used to transfer an entity into or out of a station location. On the Transfer step, you use the Entity Type property (Advanced Options) to specify the entity object to be transferred. When transferring the entity into the station, you would specify the 'To' property as Station and then specify the station of the other entity that you want to transfer into (e.g., MyCustomEntity.SomeStationThatWasAdded). The 'From' property is whatever type of location the entity is physically coming from. Usually, within the logic of the entity that owns the station location, you will use an EndTransfer step in a process triggered by the station's 'Entered' event to have the entering entity free the station's transfer-in mechanism so that other entities might also then transfer into that station. This is important if your station is intended to hold more than a single entity concurrently. If you don't do that, then the first entity into the station is going to block other entities from entering that station until it transfers out. See the usage of the EndTransfer step in other standard library objects perhaps for example. When transferring the entity out of the station, then you would specify the 'From' property as CurrentStation. The 'To' property will be wherever the entity is physically transferring to. The above all should work. If you are getting errors, then you probably have a reference off or have otherwise misspecified the Transfer step properties. Link to comment Share on other sites More sharing options...
gdrake Posted July 21, 2014 Share Posted July 21, 2014 Taking a quick look at that model, you have a couple of issues but they are easily fixed. 1) In that 'TransferNode2_Entered' process, put a Decide step in front of the Transfer step to only execute the Transfer step if 'Entity.Is.B' is True. Since you will be essentially dropping off the A entity at the same node, when the A entity enters the node you don't want it to being doing this Transfer step logic. 2) In the Transfer step itself, you want to transfer the 'A' entity that the 'B' entity is carrying in that station location. So, on the Transfer step, specify the 'Entity Type' property as 'SpecificObject' (in Advanced Options). Then specify the 'Entity Object' to be transferred as 'B.estacao.Contents.FirstItem.Entity'. That will tell the Transfer step to simply transfer the first entity item in the 'estacao' station of the 'B' entity that has entered the node and is executing this Transfer step. Link to comment Share on other sites More sharing options...
antonio6vieira Posted July 21, 2014 Author Share Posted July 21, 2014 Thank you very much, that did work. I was missing the "B.estacao.Contents.FirstItem.Entity" to specify the entity to be removed. Still, my model only works when I use the entity state "entidade" to point to the entity B. When I don't use this state and try to use "B.station" on the property "StationName" of the "Transfer2" step I get an error saying that I'm trying to reference B while the executing type is A. I understand why Simio is giving me this error but I think there has to be another way to do this without the use of the "entidade" state, am I right? Link to comment Share on other sites More sharing options...
gdrake Posted July 21, 2014 Share Posted July 21, 2014 Put a Decide step in front of that Transfer step per my recommendation #1 above. Link to comment Share on other sites More sharing options...
antonio6vieira Posted July 21, 2014 Author Share Posted July 21, 2014 Sorry but I was talking about process "TransferNode1_Entered". If I understood correctly that sugestion was for "TransferNode2_Entered". "Transfer2" of "TransferNode1_Entered" process. Maybe that was the confusion... Sorry about those names... This model is just for experiencing this :/ Link to comment Share on other sites More sharing options...
gdrake Posted July 21, 2014 Share Posted July 21, 2014 Note that I made the two changes that I described above and that simple model seemed to work fine. The entity transferred off the entity into TransferNode2 and each entity then went to their respective Sinks. Seemed like it worked. Definitely no runtime errors. Link to comment Share on other sites More sharing options...
jzhou Posted July 22, 2014 Share Posted July 22, 2014 Maybe we can use a Search step to find the entity in B's station, target at it then transfer it... Link to comment Share on other sites More sharing options...
antonio6vieira Posted July 22, 2014 Author Share Posted July 22, 2014 I think that I may not have been clear and my apologies for it. The suggestions gdrake gave work perfectly and thank you for it What I would like to do is to stop using that "entidade" state... Is it even possible to do that? I attached the same model with the modifications gdrake suggested and without the use of the "entidade" state for you to see the error. I also changed the names of the steps and processes to make it easy for us to understand what we're talking about. Many thanks! solution1.spfx Link to comment Share on other sites More sharing options...
gdrake Posted July 22, 2014 Share Posted July 22, 2014 In that new model that you attached, in the 'GoToStation' process logic and the Transfer step, of course you will need to specify the exact entity 'B' whose station you are trying to transfer into. To do that, you may have to set some kind of variable pointing to that B entity. But you will need to use absolute reference to it. Now in this very simple model, I can cheat because I know that there is only one 'B' entity in the system. So if you, for example, specify the Station Name property in that Transfer step as 'B1[1].estacao' then you will see the model work just fine. That is saying to transfer into the entity in the population of 'B1' type entities at population member index 1. Of course there is only one of those guys in the system so sure that is the right guy. However, if you had multiple entities of type 'B1' in the system, then you would want to of course reference the specific B1 type entity sitting at that node presumably to be matched up with the A entity. In that case, you'll need to setup some kind of reference to get to the right 'B1' type entity. Whether that is setting a variable reference, or putting that B1 entity into a storage that the A entity can then search or whatever. Link to comment Share on other sites More sharing options...
antonio6vieira Posted July 22, 2014 Author Share Posted July 22, 2014 gdrake, As I thought there had to be something pointing to the B entity, although I didn't know I could use "B1[1]" to specify an entity from the population. Thanks for the enlightenment! Now, is there some way to point to a specific entity that has a specific value on a state? At the moment I use an entity state to point to it (same approach as "entidade" state you saw on my previous model), but I would like to know if it is possible to specify it directly, something like "B1[1]"? Thanks once again! Link to comment Share on other sites More sharing options...
Recommended Posts