question

Jorge C41 avatar image
0 Likes"
Jorge C41 asked Andrew O commented

Combinar cajas con una distribución

Necesito saber como combinar varias cajas en un pallet, pero la cantidad de cajas es variable y debe funcionar con una distribución de datos. El modelo que tengo siempre combina los valores predeterminados que escogí (20 cajas)

prueba.fsm

FlexSim 22.2.0
combinerpallet
prueba.fsm (42.3 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Andrew O avatar image Andrew O commented ·

Hi @Jorge C41, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

The target component list can be changed with the "Update Combiner Component List" option in the On Entry trigger of the combiner. Normally, that option sets the component list to be equal to a column from a global table. Which column is used is determined by a label on the pallet (in this case that would be the quantity).

The code of that option can be simplified and adjusted to not require a global table and simply set the quantity to a value generated by a random distribution. (If you add the mentioned pick option and inspect its code, you will find that the code below is a stripped down and slightly adjusted version of it)

Google Translate:

La lista de componentes de destino se puede cambiar con la opción "Update Combiner Component List" en el disparador de entrada del combinador. Normalmente, esa opción establece que la lista de componentes sea igual a una columna de una tabla global. La columna que se utiliza está determinada por una etiqueta en el palé (en este caso, sería la cantidad).

El código de esa opción se puede simplificar y ajustar para que no requiera una tabla global y simplemente establezca la cantidad en un valor generado por una distribución aleatoria. (Si agrega la opción de selección mencionada e inspecciona su código, encontrará que el código a continuación es una versión simplificada y ligeramente ajustada)

/**Custom Code*/
Object current = ownerobject(c);
Object item = param(1);
int port = param(2);
     
if (port == 1) {  
    Table thelist = getvarnode(current, "componentlist");
    treenode thesum = getvarnode(current, "targetcomponentsum");
    int quantity = duniform(3, 8, getstream(current));  // Random number between 3-8
    thesum.value = quantity;
    thelist[1][1] = quantity;
}

prueba-fm.fsm


prueba-fm.fsm (43.4 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.