You are here

entering .CSV data into simile

Hello

I am currently running a model with around 20 different compartments each with a unique name and each with a unique initial value. These unique initial values change from site to site, and measurements of each site gives different values which are recorded in a spreadsheet.

any way, to cut to the chase, i want to be able to change the values
in each compartment to represent each site without clicking on each compartment, going to the table icon, reloading the (changed)CSV file and column heading value etc etc etc...

is there a way to get the initial values to be read off a csv file containing headings with the unique name of each compartment recorded, and changes to the CSV file be updated when the model is run rather than having to click on each compartment?

Hope this makes sense,

can send example model if required

LS

Forums: 

Hello LS,
The mechanism for entering tables into equations is only intended for fairly small tables that will not change between one model run and the next. Since you are using different tables for different scenarios you need to use a different mechanism.

What you should do is, when editing the model element that gets its value from the table, leave the equation blank and select the "fixed parameter" checkbox. Then the data is not entered until you run the model. When you do run it, you get the "file parameters" dialogue that allows you to specify the source of the data for each fixed parameter. This is from .csv files as before.

After you have loaded all the data from .csv files you can use the "save" icon from the parameters dialogue to save all the settings for the whole model or a submodel. Next time you run the model you can reload these settings or create a new lot. They are saved as a .spf file which references all the .csv files you used. This process is documented under "working with external data" in the online help; see "using the scenario file mechanism"

Please write again if you have any more questions

--Jasper

Hello,

i had read the areas of the website you mentioned and fully under
stand the process of changing the variables
i feel that it takes too long to change the parameters when i have to

"specify the source of the data for each fixed parameter"

i have taken to changing the parameters manually by actually clicking
on each parameter in the model interface and changing each parameter to
suit the different conditions. it seems to be quicker.

Maybe im not getting something but i really thought it would be possible for
the whole sub model to read off a table of values with column headings
that correspond to headings of fixed parameters.. rather than loading for each parameter.

do you know what i mean?

if not, dont worry,
im probably being too lazy...

LS

That's what the Save and Open icons are for, in the top right corner of each submodel list in the parameters dialogue box...they save a parameter 'meta file' which contains information about all the files from which parameters in that submodel were actually loaded. When you 'open' one it reloads parameters using the same file.
--Jasper

OK, however it's a pity that you cannot edit the .spf file when you have a lot of parameters to load and you just want to add a new one for example (another column in your .csv file).
Another issue for French or Swiss users, for which the separator in .csv file is the semicolon (;) and not the comma (,): would it be possible to add an option to load directly such a CSV2 file, to avoid finding and replacing "," by ";" every time you export the file from Excel?

Good news is, as of Simile 5.0 the .spf file is in an XML format so you can use a structured editor to change details like file names and column headings. I'll add a request to include Euro-style separators as an option for .csv files.