question

Marco Ney avatar image
0 Likes"
Marco Ney asked Joerg Vogel commented

Model Parameterization via Excel or DBase

Hi all,

I am wondering if/how a model can be parameterized reading an Excel sheet (or DBase).

To start the exercise, I read an Excel sheet during model reset into TimeTable.

But how to update the setup & process times of a processor for example ?

I attached a model which shall have each processor updated 'on entry' with a RowID. The RowID is the row in the timetable.

As I don't have access to the global variables using 'free' version, I put my 'global' var (RowID) in the dispatcher. Each source will increment this 'RowID' variable in the dispatcher.

I don't know how to update the setup and process time in the trigger menu of each processor.

I read the RowID from the previous station, next would be to update setup and process times.

....Finally I will have to check when the timetable list is processed and stop the model...

Regards

modelparamviaexcel001.fsm

modelparamviaexcel001.xlsx

FlexSim 19.0.2
process timesetup time
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

Joshua S avatar image
0 Likes"
Joshua S answered Joerg Vogel commented

You can reference the table directly in your process and setup times using

Table("TimeTable")[Row][Col]

so in your model for the setup times it would be

Table("TimeTable")[item.RowID][1]

and for process times

Table("TimeTable")[item.RowID][2]

Then you can create a trigger on the source that checks to see if the Dispatcher label is above the number of rows in your table, and will close it's output port if that condition is met.

Here is your model with the changes, I made all the changes on the bottom line and then deleted the top 2 lines and copied the bottom line 2 times. I got rid of some of the triggers on your objects as well.

The model will stop automatically now since it senses that the 3 sources are closed any nothing else will occur in the model.

You can also use the command stop(); anywhere in the model you can enter code in and it will stop the model.

19192-modelparamviaexcel001-1.fsm


· 2
5 |100000

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

Marco Ney avatar image Marco Ney commented ·

Thanks for this update, this is probably the shortest functional solution with the minimum amount of code/variables.

The idea of this exercise is to write into the processor properties without doing this directly in the processor tab fields, e.g. Model.Process1.SetupTime = TimeTable(current.RowID, 1) resp. Model.Process1.ProcessTime = TimeTable(current.RowID, 2)

That is the reason why I added the trigger 'At Entry'.

Also I like to see the values read from the table in the quick property fields, actually I see the formula.

How can I do that ?

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Marco Ney commented ·

Hi Marco, I think there isn't any chance you can parse just a value as text into a function that returns a numerical value and shows this value in the quick properties. The only approach that comes into my mind - you have to replace the plain text of the source code at the function node completely, and you have to build the node as FlexScript while the model runs. Maybe you can write the text as an output to a file in an XML compatible format and insert this data from the file into the cycletime node, then you might see the return value in the quick properties.

Original export of the node as a XML-data

<?xml version="1.0" encoding="UTF-8"?>
<flexsim-tree version="4" treetype="tree">
<node f="442" dt="2"><name>cycletime</name><data>Object current = ownerobject(c);
Object item = param(1);
return /**/10/**direct*/;</data></node></flexsim-tree>

replaced by the following code to exchange the process time of 10 to 16

<?xml version="1.0" encoding="UTF-8"?>
<flexsim-tree version="4" treetype="tree">
<node f="442" dt="2"><name>cycletime</name><data>Object current = ownerobject(c);
Object item = param(1);
return /**/16/**direct*/;</data></node></flexsim-tree>
0 Likes 0 ·