Cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing the station an MU was sent to based on it's attribute

Valued Contributor
Valued Contributor

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

...

Packout.AttributeToBeAccessed

 

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!

4 REPLIES

Re: Accessing the station an MU was sent to based on it's attribute

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello mbuschur,

 

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?

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Accessing the station an MU was sent to based on it's attribute

Valued Contributor
Valued Contributor

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.

Re: Accessing the station an MU was sent to based on it's attribute

Siemens Phenom Siemens Phenom
Siemens Phenom

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.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Accessing the station an MU was sent to based on it's attribute

Valued Contributor
Valued Contributor
Oh I see the problem. I have it set up for the MU's to default to a random object as the initial value if they are ever not assigned to a specific lane. This is just a very rare specific exception where the MU hit the reject station without a packout lane specified to its class. I hadn't considered that possibility when I wrote the code.

I have resolved the issue by adding the mentioned attributes to that initial object. They won't actually mean anything, but that should satisfy the code.

Thank you for pointing out that key part!