Posted 7/10/2010 12:03:58
|
|
|
|
I get adding parameters through the UI, then referencing them in code; I'm a little fuzzy on where the SystemParameters class resides; I'm not big on behind the scenes magic I can't control from code.
My question is this: can I declare an optimization parameter in code, or do I always need to use the UI to add a parameter before referencing it in code?
SystemParameters.Keys.Add("test34");
I seem to be able to add a key to the collection (in system startup), but once done I don't seem to be able to set initial values. And perhaps more to the point the new parameter does not show in the UI after I have compiled the system.
|
|
Posted 7/12/2010 11:31:18
|
|
|
|
I've been thinking about this a bit more; If I understand the way RE handles parameters it will be a significant pain. Here is what I would like to see in RE:
1) the ability to add a new systemParameterInfo item to the SystemParameters collection in code
2) the ability to set a default (non-optimization) value in the item.SystemParameterInfo item
3) (after compile) have the new item and default value appear in the UI
I realize this requires some plumbing to achieve.
|
|
Posted 7/12/2010 11:53:18
|
|
|
|
Okay. I think I have a workaround to achieve what I want.
1) declare a MySystemParameters dictionary in MySystem
2) set initial runtime values in MySystemParameters("myKey").value
3) at runtime, access the SystemParameter of the same name
a) if the optimization parameter exists in SystemParameter (and the value is != 0), use its Value
b) if the SystemParameter does not yet exist, use the default value in MySystemParameter
Caveat: once you establish the parameter in the UI, any non-zero default value set in the UI will override the default value set in your code.
|
|
Posted 7/12/2010 13:45:02
|
|
|
|
There really is no magic in the system parameters. It's simply a convenient way to move parameters from UI to code without having to code. If you want to override this completely, that's fine.
What you're proposing would be fine.
DTrader (7/12/2010) Okay. I think I have a workaround to achieve what I want.
1) declare a MySystemParameters dictionary in MySystem
2) set initial runtime values in MySystemParameters("myKey").value
3) at runtime, access the SystemParameter of the same name
a) if the optimization parameter exists in SystemParameter (and the value is != 0), use its Value
b) if the SystemParameter does not yet exist, use the default value in MySystemParameter
Caveat: once you establish the parameter in the UI, any non-zero default value set in the UI will override the default value set in your code.
|
|
|
|