- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » change boolean variable value from...
change boolean variable value from command line
change boolean variable value from command line
Hi,
I need to recall the simulation several times so I use the runnable generated file with the option -overrideFile initfile.txt.
With this solution I'm able to change the init values of all status variables but I'm not able to change the value of a boolean constant.
Is there a way in order to change a boolean variable (or close/open a switch) without recompile the model?
Thank you
Davide
Re: change boolean variable value from command line
No. Constants are replaced in the model with their value during compilation.
You have to make it a parameter. And even so, if is a structural parameter it might not be possible to change.
- adrpo
- 885 Posts
Re: change boolean variable value from command line
thank you Adrian for the quick reply.
Is there a workaround in order to change a parameter value using the init file values?
My idea is to place a capacitor without discharge and set the initial voltage.
The model reads the voltage. If it is under a threshold the state is "false", if it is over the threshold the state is "true"
I need "only" to change a state from 0 to 1 in order to switch on/off part of my model
regards
Davide
Re: change boolean variable value from command line
Well, if making it a parameter (with fixed=false) instead of a constant doesn't help then the
only way I can think of is to make 2 executables, one with the constant set to true and one
with it set to false and call them with -override for the other values.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » change boolean variable value from...