Jump to content

Repeat Group questions


pbecker
 Share

Recommended Posts

Hey everyone,


After reading the documentation and various topics here, I still have a few questions concerning Repeat Groups and tables.


-Are Repeat Groups in submodels essentially copied tables, meaning the submodel gets passed a clone of the top level's table?

I guess I'm confused because of this sentence in the Reference Guide:

(Ref. guide p. 338)"Since Data Tables should exist at the top level model and not the submodel, a Repeat Group is created on the submodel instead of keeping

the reference to the Data Table."

If data should only exist on the top level, why not just reference it from the submodel? Sounds like the reference is discarded for a copy, which contradicts the first premise?


- Or is the Repeat Group a "Table of references"?

In which case it still seems overly complicated to me, couldn't we simply pass the name of the table, without having to pass all columns?

Alternatively, why not adding the ability to reference a table from a submodel in the form "Location.Parent.Model.TableName"?


The reason I'm asking is that I have a model with many submodels, that all need to access a huge data table.

If I'm not mistaken, Repeat Groups require you to pass every single column to every single submodel by hand, since selecting multiple submodels and right-clicking to choose "Select referenced property" doesn't work.


I ended up creating a state variable that copied the data table, which I can access from the submodels via "Location.Parent.Model.ArrayName". Although the information is then 'pulled', this sentence adds to the confusion:

(Ref. guide p. 480)"Remember that information can only be passed into an object through properties"

I might be overthinking this, but storing information in an entity that is sent into an object passes information without properties as well?


I'd just like to understand Repeat Groups and moreover I'd like to be able to use the Search Step from the submodel, which doesn't work with the array.

I might give the find step a shot at this.


Sorry for the lengthy post - any insights are appreciated!


-Phil

Link to comment
Share on other sites

A repeat group is a way to pass data between objects. It consists of N fields of properties, which can be repeated (similar to a collection of rows, i.e. a table)—hence a repeating group of properties. The reason you can’t reference the table from the submodel is because of the object orientedness of Simio. When you create a submodel, you are actually creating an object definition. You may only ever plan on placing (or instantiating) your object in a “parent” model in your current Simio project (the .spfx file you are working with), but there is nothing stopping you (or anyone else with access to your project file) from instantiating that object in another, different, parent model or even in a completely different project file (by loading your project file as a library, fyi). So, your submodel can’t know about anything in a parent model, unless there are properties that can be set on the object instance that can then refer to data or parameters at the parent model level. That’s what this quote is referencing:

(Ref. guide p. 480)"Remember that information can only be passed into an object through properties"

You can “pull” data into an object by looking at Location.Parent.Model.ArrayName for example, but you can’t do too much with that, because there is no guarantee that that array even exists for an arbitrary parent model, let alone that the contents of the array are what they “should” be (in terms of data type).


In your case, how would each submodel that you place know which table to reference? Even if you set a table property on the object definition, Simio cannot know what columns will be available, even though you will by virtue of building the model.


Repeat groups allow you to create a kind of property on your object definition that you can, for each object instantiation, populate with a table. With a prepeat group, your object definition “knows” about what data will be available to it, because you’ve stated “this data is a property of this object, and it must be set each time I instantiate an object of this type.”


Still doesn't resolve the difficulty of actually setting all those properties to get your data into the object instances, but maybe helps explain why things are the way they are...


-Adam

Link to comment
Share on other sites

I'll ask them if anything can be done to make the assignments easier.

There are three features built-in that can help.

1) When you have already built an object with a table, you will find a table tool that will Convert To Repeat Group within that object.

2) When you want to create a table in the parent object, the lower part of the Add Table Data button allows you to build a table matching the schema of any repeat group (e.g. that new repeat group you just made in the included object). This creates the data table exactly matching that names and data types in the repeat group.

3) When you want to "pass" that new table as a property value, you can right click on that new repeat group and specify your table name as the reference property.ConversionOfTablesToParent.PNG.0012fc3a8cbb5ea18c54ae9bd6130b2f.PNG

Link to comment
Share on other sites

I’ve got a follow up question of my own. What is the use-case of the table property? I can define a table property on an object, and then set that property value to a table in my “parent” model in my object instance. In my object’s processes definitions, I can search the table and find all the rows. However, I can’t seem to do anything with the rows found. For example, I’d like to get a field from each row and assign it to a state variable. I tried referencing the result using TableProp[1,1] , but I get an “incorrect number of parameters” error :? . I can’t set a state matrix to the table property either  :(


So, what can I do with a table property?


Thanks,


Adam

Link to comment
Share on other sites

Thanks Dave, works like a charm.

It still requires me to assign every table to each object individually, as selecting multiple objects --> right click --> set referenced property doesn't work.

But that's okay, since the column assignments are automatically taken care of.


Sorry Adam, I don't know the answer to your question.

Link to comment
Share on other sites

×
×
  • Create New...