question

Santiago T2 avatar image
0 Likes"
Santiago T2 asked Santiago T2 commented

Exportar datos (Fechas) desde Excel a Flexsim

Saludos. ¿Cómo puedo exportar una tabla de datos desde excel a flexsim, la cual contiene fechas exactas (d/m/yyyy;h:mm) en la que deben suceder ciertos eventos?. Para la simulacion estoy usando la herramienta ProcessFlow y en la libreria Token Creation utilice Data Time Source.

Al tratar de exportar me aparece ese error espero puedan ayudarme gracias.

error.png

FlexSim 21.2.4
processflowsimulationsource schedule
error.png (4.5 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.

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Santiago T2 commented

Based on the error message it seems that the import is configured to copy the values into the schedule of a 3D-source object, that no longer exists. Please make sure that the correct object/activity is selected in the table data field.

1635755593112.png

Moreover, using the "Date Time Source" does not actually make importing the items any easier because the excel values have to be converted to FlexSim units anyway. As such, I'd suggest to use simply use the "Schedule Source".

To convert the excel date format (days since the 0.1.1900) to FlexSim date format (seconds since the 01.01.1601) you can use the "Post Import Code" feature.

1635756167041.png

Copy the following code in the window that opens when clicking on the button:

string processflow_Name;
string source_Name;
treenode tableNode;
Table schedule;

processflow_Name = "ProcessFlow";
source_Name = "Source";

tableNode = Model.find("/Tools/ProcessFlow/" + processflow_Name + "/" + source_Name + ">variables/arrivals");
schedule = tableNode.as(Table);
for(int row = 1; row <= schedule.numRows; row++)
{
    schedule[row][1] = Model.getTime(schedule[row][1]);
}

The first four lines declare the variables. In line 6 and 7 you have to change the assigend values of "processflow_Name" and "source_Name" variables according to your own model. If you copy values to more than one source, repeat the code (apart from the declarations in the first four lines) for each source activity.


Google Translate:

Según el mensaje de error, parece que la importación está configurada para copiar los valores en la programación de un objeto de origen 3D, que ya no existe. Asegúrese de seleccionar el objeto / actividad correcto en el campo de datos de la tabla.
Además, el uso de la "Date Time Source" en realidad no facilita la importación de los elementos porque los valores de Excel deben convertirse a unidades FlexSim de todos modos. Como tal, sugiero usar simplemente el "Schedule Source".
Para convertir el formato de fecha de Excel (días desde el 0.1.1900) al formato de fecha FlexSim (segundos desde el 01.01.1601), puede utilizar la función "Post Import Code".

Copie el siguiente código en la ventana que se abre al hacer clic en el botón:

Las primeras cuatro líneas declaran las variables. En las líneas 6 y 7, debe cambiar los valores de asignación de las variables "processflow_Name" y "source_Name" según su propio modelo. Si copia valores en más de una fuente, repita el código (aparte de las declaraciones en las primeras cuatro líneas) para cada actividad de la fuente.


1635755593112.png (2.4 KiB)
1635756167041.png (8.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.

Santiago T2 avatar image Santiago T2 commented ·

Muchas gracias funcionó correctamente!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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