Ok this is a pretty complex problem.
Basically in one part of my model I have a method sending MU's to specific lanes for packout. This is achieved by the method which runs as an entrance control on the entrance to the packout lanes. The method sets an attribute on the MU's class which converters later use to sort the MU.
The attribute that is set on the MU's class is set to the path of the lane that it is sent to. For example: if the MU is to be set to .models.frame.Packout1 then the attribute on the MU's class is set to ".models.frame.Packout1".
The reason that I did it this way is that there is a reject station elsewhere in the model that scraps MU's. I need this reject station to be able to update an attribute on the Packout lane that the class of the MU to be scrapped is set to.
I was planning to accomplish this by setting the Packout lane attribute on the class of the MU to a local variable in the method that controls the reject station. That way within that code I could just call the local variable and then the user defined attribute that I wanted to change. Such as this:
var Packout: object := @.class.Packout
However, I am getting an Unknown identifier error, which I assume is because Plant Sim can't call an attribute on an object that is specified by a local variable. I apologize for the long post, as I said complicated question. I am trying to not post the simulation as it is very complicated. Please let me know if anyone has any ideas or needs clarification. Thanks!
Solved! Go to Solution.
accessing the attribute of an object through a local variable pointing to this object should work fine.
Can you post a screenshot of the method editor with the error message and the line where the error is reported?
Thank you Ralf,
Here is the screen shot you asked for. Within the screenshot I am showing both the method editor with the error highlighted, and to the right the complete method opened in another window. This will allow you to see the error, and where I defined the variable.
In addition, to the right of that, I have opened the dialog window of one of the affected MU's that way you can see the attributes that I am referencing.
Could the problem be steeming from the astrisk that is present before the path of the object? If so, I don't know how to correct this. The astrisk seems to get added automatically when the attribute is set by a method.
The variable Packout is referencing the object .Models.Reynossa.PSTOP_35 and it seems that this object doesn't have a custom attribute with name CountIn. (The * in front of a path means that this is object reference not a textual path to an object. So this reference will always reference the object even when you renamed objects which are part of the path.)
From your description I think you assume that Packout should reference a MU. So please check that the variable is referencing the right object.