Jump to content

Huge problem! help please


Recommended Posts

In my model I created a new model called "Channel" and placed many channels on the model. Each channel has many entities (products) that are created inside the channel and stay inside of it until another type of entity (driver) enter the channel and takes the wanted product. In model, I created an array to indicate me how many products are on each channel. To do this, I use processes: each time a new entity is created on a channel, that channel fires an event that is associated to a process of Model (1 process per 1 channel) that updates the array.


So far so good...


The problem is that I am going to have to use the Simio API to set the number of channels and by reading the many posts on this forum I now know that it is not possible to use it to create processes. So the approach I use (trigger processes executed by an event fired from a channel) can't be used...


Could someone tell me if there's another way to know how many entities (products) are on each channel so my driver knows if he has to enter that channel or not?


Thank you

Link to comment
Share on other sites

1) You don't mention why you need the API but the first thing I would do is revisit that decision. It is rare that Simio modelers actually need the API - often people use it because that is how they have gotten around limitations in other products but there is probably a better way within Simio.


2) I don't understand the need for the process and event. Each channel can have a state (e.g. Channel1.WIP) that increments and decrements as entities enter and leave. The "driver" simply examines that state.

Link to comment
Share on other sites

Thank you for your reply!


Forgive me if I was not being clear. As I said I need to use the API to set the number of channels because I need to test (Simulation Experiences) my model with different numbers of channels (10,100,1000,10000, etc) -> I'm not going to place, connect and edit 10000++ objects...


That being said, I know I can use something like "Channel1.WIP", but since I don't know the number of channels, I don't know if the driver is examining the channel1 or the channel999...


The array implementation I'm using is very handy because it lets me know where a type of product is (e.g. If I want to know if product 2 is on channel 5 I only need to go to array[2,5] and see the quantity).


To help clarify what I'm talking about I attached my model. The global array is the state matrix PlaceOfREF and the processes that update this array are on the processes category ChannelComunication


Any ideas? I'm really having a lot of probelms with this :(

bosch_RASM_tobias.spfx

Link to comment
Share on other sites

There are multiple ways to deal with this issue, so I’ll go over my thought process and show you one way that I think will do what you need.


You created several object definitions, which is key in Simio’s object oriented paradigm. However, the difficulty comes in interfacing objects with data and processes in the parent model where the objects are instantiated. One indicator that the full object-orientedness is not being used is the creation of multiple processes at the parent model level that do exactly the same thing, only they refer to different object instances in the model. This indicates that either the process is inherent to the object, and so should be included in the object definition or that the process can be generalized at the parent model level and use states/properties of the object instances. Your model has exactly this scenario with the “ChannelCommunication” processes—they are all exactly the same but just pointing at different Channel instances. Your idea of using the API to place the channels is reasonable, but you run into the issue of not being able to create instance-specific processes, as you’ve found.


In your case, you make use of a global state array, so I kept the ChannelCommunication logic at the parent level. This allows us to refer to that state array directly. The approach is to reduce all those processes into one process that can take information about each channel instance to update the appropriate state in the array. I noticed you already have a property called “Position” defined on the Channel object, so we have that data available. Now we need a way to run that process from within the Channel object, so I created a process property on the Channel object called "ProcessProperty1". In the Channel’s process “AssignmentToProduct” I added an “Execute” step before “Fire2” with the value of “ProcessProperty1”.

channel_process.png.1bb9af8ce59f33130d773e9f7cf07d76.png

 

Now, in the parent model, we need to delete all but one of the ProcessXX in the ChannelCommunication group—rename that remaining process ChannelCommunicationUpdate for clarity. Next, we need to generalize the values in that assignment step and remove the triggering event name (we are using the execute step in the Channel definition, so we don’t need a specific event to trigger the process anymore). This is a little messy—there might be a better way to do this. My approach is to make use of the location.parent property available on each object. Through trial and error, I found that the object executing the ChannelCommunicationUpdate process is a Product entity in a combiner object in the Channel object. That means we can access the relevant properties on a Channel via the following expression: Product.Location.Parent.Combiner.Location.Parent.Channel


Thus on the assignment step the fields become:

Row:

Math.If(MODE==0,Product.Location.Parent.Combiner.Location.Parent.Channel.Position,Product.Location.Parent.Combiner.Location.Parent.Channel.ProductCreated) 

Column:

Product.Location.Parent.Combiner.Location.Parent.Channel.Position

New Value:

Math.If(MODE == 0, PlaceOfREF[Product.Location.Parent.Combiner.Location.Parent.Channel.Position, Product.Location.Parent.Combiner.Location.Parent.Channel.Position] + 1, PlaceOfREF[Product.Location.Parent.Combiner.Location.Parent.Channel.ProductCreated, Product.Location.Parent.Combiner.Location.Parent.Channel.Position] + 1)

model_process.thumb.png.5ef76fb2cbe0193ba5655dce5609f93b.png

 

Now, the ProcessProperty1 on each channel instance needs to be set to that ChannelCommunicationUpdate process. For future “builds” of the model, you can either set ProcessProperty1’s default value to be ChannelCommuncationUpdate or set the property value when placing the object.


I think that will give you the ability to create an arbitrary number of channel instances via the API and have the logic apply to each instance.


Hope it helps :)


-Adam

Link to comment
Share on other sites

Great and simple solution! Excellent explanation too!


I did try to use a process property but since the option didn´t show on the execute step I gave up... This time I wrote manually and Simio accepted it.


Nevertheless while I was waiting for a reply I tryed another approach: I placed all the channels in a data table and now my drivers, instead of consulting the global array (this array doesn't exist now), each of them has an array of destinies .


Working very good untill now. I just hope I won't have many problems while adding the channels to the data table (dynamically) using the Simio API...


Thanks again for your help!

Link to comment
Share on other sites

×
×
  • Create New...