Jump to content
Simio Forum

Acessing External ModelEntities properties


Recommended Posts

Hi!


I have a component made by me. In one server I have a process that has a step using the ModelEntity.Quantidade property (a custom property defined by me, not in this component's scope, but in the model where I'm going to load this component). I've created External Nodes and stuff, and then I load this component to another model (that has the ModelEntity having the Quantidade property).


I then create instances of this ModelEntity in the Facility to use as my component's inputs. But I've found that the component is unable to read that property... How can I make it work? How can I make my component read ModelEntity's Quantidade property in my model?


Currently I'm trying with Token.Is.ModelEntity.Quantidade to see what happens... It doesn't work.


Thanks!

Edited by Guest
Link to post
Share on other sites

If I try to access the ModelEntity from the outside the model by a component I get this:


2yzg3s1.png


I'm looking for a way to do something like this in one of the component's steps: Root.ModelEntity.Quantidade, where Root is the model where that component is running.

Link to post
Share on other sites
Pedro. I´m not sure if I understood your question, but take a look at the attached model. How far is that from what you need?


Eduardo.

Thank you Eduardo!

Yes, it is very simillar to that one, but in different files.


For example like this one:


33trqsw.png


If this one worked fine, the label should show 55 instead of 0. :(


I'm attaching to this post this example.


Thanks!

ExternalEntities.zip

Link to post
Share on other sites

Pedro,


If you create a new "State" instead of "Property" in the ModelEntity, it works as you wish, BUT only if you create a model inside the same component.spfx, not if you load the object to another file. At first I thought it was restriction for student version, but it does the same for Team license. See attached file.


Please, someone from Simio could explain why this happens?


Eduardo

LoadingComp2.zip

Link to post
Share on other sites

Without looking at the models attached, I will hazard a guess that those "components" reference a model id for "ModelEntity". When there is a ModelEntity in the same project that is linked, it will reference that specific one, otherwise it will look for any model of the same type or name.


I think this as I have seen multiple instances of ModelEntity in drop down menus in my models.

Link to post
Share on other sites
I will hazard a guess that those "components" reference a model id for "ModelEntity". When there is a ModelEntity in the same project that is linked, it will reference that specific one, otherwise it will look for any model of the same type or name.

 

That's not quite true. I removed the "ModelEntity" from the component and used the one from the calling project. The component didn't find the reference.

Link to post
Share on other sites
I will hazard a guess that those "components" reference a model id for "ModelEntity". When there is a ModelEntity in the same project that is linked, it will reference that specific one, otherwise it will look for any model of the same type or name.

 

That's not quite true. I removed the "ModelEntity" from the component and used the one from the calling project. The component didn't find the reference.

 

Ah, maybe something has changed, which is why I have not seen this bug yet. I also completely forgot about the internal references we can now read. Have you tried comparing the object references to see what is up?

 

2013-01-29_11-18-36.png.bdbed537718901877243eec4ce905a73.png

If you right click on the model (that uses the entity) and click on "Object References", you will see the reference id.

 

2013-01-29_11-25-48.png.d77244d43c8c66e3719bd44718b96d24.png

If you then use winRar or 7-Zip you can open the Simio project file and look at the xml. Find the model entity in the xml, and compare its reference.


Doing this should hopefully give you some confirmation on this issue, and maybe help support in diagnosing how this issue occurs. I wish we could change the reference from within Simio (as changing the XML breaks the model).

Link to post
Share on other sites

James. Good points about internal references and xml inspection.


So, I learned that we can have in Simio two different objects (different internal ID) with the same name when the second object is loaded. Could Simio prevents two objects with same name in a model when loading? Or it would bring little value and more complications?

Link to post
Share on other sites
×
×
  • Create New...