dburton Posted December 11, 2013 Share Posted December 11, 2013 Hi Everyone I seem to be having a problem with a search step with a transfer step following depending on whether a match is found. I'm sure this is due top my lack of understanding of tokens - apologies, I'm pretty new to Simio! As I understand it, the Search step creates a new token when the match criteria is found but retains the original token which continues through the process. I think the original token is causing the problem. I guess my question is; is there a way to suppress the original token (or destroy it) once the new token is play? I believe the original is trying to initiate an unwanted transfer step which is clashing with the wanted step, resulting in a runtime error. I've attached the error message which may help. Any help, advice or direction to texts explaining tokens would be very much appreciated. .......Dave Link to comment Share on other sites More sharing options...
tulach Posted December 11, 2013 Share Posted December 11, 2013 By default found branch (token) is executed first and then the original. This is unless you have a delay in found branch. If so, (and the delay is at least math.epsilon) original token is executed before the delay and than found token executes. If you can send a screenshot of your process it will be easier to give precise help. Link to comment Share on other sites More sharing options...
dburton Posted December 12, 2013 Author Share Posted December 12, 2013 Thanks for the advice and for getting back to me so quickly - I'll try a delay in the original branch Link to comment Share on other sites More sharing options...
MEagar Posted December 13, 2013 Share Posted December 13, 2013 I have seen this error before with transporter/entity transfers... You may have conflicting logic here.... i.e. an event occurs that triggers a token into a delay or wait step based on a condition before transfer can complete, yet during this duration another event occurs that wants the transfer to occur for a second time or the entity to be directed somewhere else...the original token is not released and destroyed first... simple solution... I used dummy nodes to shift the transporter\entities around based on a precedence constraint structure whilst clocking the time of the transporter\entity at each node. This worked like a bomb. Also, if you don't need the original token, destroy it or don't attach any processes on the line after it. Link to comment Share on other sites More sharing options...
dburton Posted December 13, 2013 Author Share Posted December 13, 2013 Thank you - fixed. Have re-jigged the logic so that nothing crucial happens with the original token. Link to comment Share on other sites More sharing options...
dburton Posted December 13, 2013 Author Share Posted December 13, 2013 Hi again - One last question.... Is it possible to use the find step to search a variable array for more than one value? I can see how it is possible to search forwards and backwards, so possibly finding two matching values but am stumped when it is >2. Again any help or advice much appreciated. Thanks..........Dave Link to comment Share on other sites More sharing options...
CWatson Posted December 13, 2013 Share Posted December 13, 2013 If you have an Index Variable Name named 'Testing' for example, you can initially set the 'Testing' value to 1 let's say to start the Find step. Within the Find step, you can have the Starting Index be 'Testing' (which would initially be 1) and Ending Index be the max value of the state variable dimension you are searching. Then, when a matching value (based on your condition) is Found and you do whatever calculations using 'Testing' value (which would be the index into the array), you can Assign 'Testing' to be 'Testing+1' so that you start the search at that point in the vector/array, given you don't increase the value over the Ending Index. Then connect the Assign step back into the Find step to start the Find again, this time starting at the new starting index. Link to comment Share on other sites More sharing options...
dburton Posted December 14, 2013 Author Share Posted December 14, 2013 Excellent, Thank you! Really appreciate your help. Link to comment Share on other sites More sharing options...
Recommended Posts