Thu, 22/09/2016 - 04:53 — daler6
I have build a very simple model and added an input slider in the execution window for a variable defined as a Variable parameter (I do give it a default value). I am able to change the value of the variable using the slider. However, when I click the Stop button to reset the simulation in order to run the model with the new value of the parameter, the value gets reset to the default value. I do not recall this happening in v6.4, the version I last used.
Reporter:
daler6
Created:
Thu, 22/09/2016 - 04:53
Updated:
Fri, 30/09/2016 - 12:47
Comments
#1
This is new behaviour in Simile v6.7. Now, when you adjust a slider while the model is paused, the corresponding model value changes immediately and so do other values that depend on it, except for compartments and other state variables that only change while the model is running. Also graph plots and other display tools are updated immediately with the new values. This means that to run a model with a certain slider value right from the initial time, you can reset the model then set the slider before starting it. Previously, setting the slider after reset would not have taken effect until after the first compartment update. Having made this change, we felt that it was wrong that a model should behave differently after reset depending on what the current settings were before reset, and might give results that were hard to repeat, so now variable parameters are reset to their default values when the model resets.
#2
Thanks for the clarification. This still leaves a question on my part, though. I often like to use a variable parameter to set the initial value of a compartment. In the simple example I pointed to, I was using the InitFood variable to set the initial value of Food. Given that the value for the compartment does not change when I move the slider, it will always start with the default value. So, how is it possible to use a parameter to set the initial value of a compartment? I would prefer not to have to go back to the model diagram and recompile the model each time.
An additional point. With this new approach, each time the user resets the model, all of the variable parameters reset to their default. Thus, if they have more than one variable parameter, they will need to change all of them each time, assuming that they do not want to use the default value. This introduces a bit more work if they want to experiment with two parameters, moving one away from the default but keeping it constant through a number of runs, while varying the value of the other parameter. That is a more nuanced issue, but I thought I would raise it anyway.
#3
OK, for the case of experiments with multiple parameters, some of which have the same non-default value over multiple runs, you can set initial values for them in the file parameter dialogue, which will be applied rather than the default values in the model. This has the extra advantage that sets of parameter values can then be saved in parameterization files (.spf) and loaded as required. Data for variable parameters take the form of alternating time points and values, with the value for time 0 being applied at reset (unless resetting to a different time).
I must admit we hadn't thought about the use of sliders to set initial values for compartments. It looks like you can still adjust their value at reset by moving the slider before resetting -- but there is no visual feedback. This is clearly a bug and we will fix it, probably by allowing a slider to alter a compartment's value directly if moved immediately after a reset. In the mean time you can also put initial compartment values into the file parameter dialogue -- they do not need time points as they only apply at reset.
#4
Thanks for your reply. It has taken me a few days to get back to this. I have managed to get this to work with the file parameter dialogue. Your suggestion to adjust the initial values for compartments just by moving the slider before resetting does not work. When resetting, the value gets reset to either the default value or the value set in the file parameter dialogue.
In the meantime, I look forward to the bug fix.
#5
I have managed to restore the previous behaviour for sliders that affect fixed parameters including initial values of compartments. That is, they can be adjusted whenever the model is paused, and the new values take effect at the next reset. However I will not make a new release until we get the problem with running Simile on the iMac sorted out.