Jump to content

Logical Comparison Between Strings, Please Help !!


fshawly
 Share

Recommended Posts

Hello,


I'm working on a project where I'm modeling an airport. I have assigned passengers with their flight number as an integer and flight destination as a string. I've also done that to check-in counters.


the problem I'm facing is when directing passengers to their counters according to the flight number and destination, I can't find the right expression to compare between the destinations on the passengers and counters on the node that leads the passengers to their counters. Also, I'm facing the same problem in other processes I'm using in the model.


the current expression I'm using is: Candidate.counter.FN == Pass.FN && Candidate.counter.FD == "Pass.D", but this expression doesn't seem to work because passengers are still going to wrong counters.


I've tried 'Candidate.counter.FD =="Pass.D"' which returns the following error: unable to resolve identifier ''Candidate' as member of element definition 'model'


I've tried many other expressions but they either lead passengers to wrong counters or they evaluate the entire expression as false and passengers stop at the node.


Can you please help by giving me the right expression?

Thanks, Fouad

Link to comment
Share on other sites

Candidate.counter.FD == "Pass.D"

I don't think you need qoutes around Pass.D. Another option is String.Compare(string1, string2).


For your other error, try it without the quotes. Also, are you using single quotes in the Simio expression, or is that just formatting in your post? Because using quotes around the entire expression is incorrect. But I suspect that is not the issue... the best way to get help is to post an example model.


Although, I think that the error is not only with your string comparison. I believe Simio uses lazy evaluation of logical expressions (which is supported by the fact that you do not get an error on the AND expression), which means that the first half is what is not evaluating the way you'd expect. So, I'd investigate how you are assigning the flight numbers before getting too caught up in the string comparison. What happens when you use just Candidate.counter.FN == Pass.FN?


-Adam

Link to comment
Share on other sites

Another problem is on the left side of the expression. When you are examining items in a list or collection, the keyword "Candidate" indicates that it is an item in the list. That must be followed by an object type to tell Simio what context to use with that item. For example:


Candidate.Node.AssociatedStationOverload references the AssociatedStationOverload function on the candidate which is a Node


Candidate.Node.AssociatedObject.MyServer.CurrentWaitingTime references a state named CurrentWaitingTime that is defined on a custom object definition called MyServer, which is the object associated with the candidate which is a Node.

Link to comment
Share on other sites

  • 4 weeks later...
Another problem is on the left side of the expression. When you are examining items in a list or collection, the keyword "Candidate" indicates that it is an item in the list. That must be followed by an object type to tell Simio what context to use with that item. For example:


Candidate.Node.AssociatedStationOverload references the AssociatedStationOverload function on the candidate which is a Node


Candidate.Node.AssociatedObject.MyServer.CurrentWaitingTime references a state named CurrentWaitingTime that is defined on a custom object definition called MyServer, which is the object associated with the candidate which is a Node.

I'm not sure what you mean, but I've created an object and named it "Counter". If that's what you mean.

 

Another option is String.Compare(string1, string2)

I didn't think of that, I'll try it.

 

So, I'd investigate how you are assigning the flight numbers before getting too caught up in the string comparison.

I'm sure that the assignments are right, I've checked it through tracing the model and the assignment are correct.

 

What happens when you use just Candidate.counter.FN == Pass.FN?

If I remember correctly, I believe the passengers stop at the node, or they go to wrong counters. Either way it's not what I want.

 

For your other error, try it without the quotes. Also, are you using single quotes in the Simio expression, or is that just formatting in your post?

I've tried, doesn't work .. No, I'm using single quotes.


All I need is the right expression to use when comparing strings other than the String.Compare function.


Thanks

Link to comment
Share on other sites

×
×
  • Create New...