Community

Hi All, When i create a Parameter Variation, typically i want to record some data from the Root-Object ("Main") after each variation. It seems logical to do this thing with a DataSet Object, e.g. i place the dataset Object into the ParameterVariation Object. Unfortunately i cannot use the automatic update feature of the DataSet, because i cannot access the root-Object from the "Vertical Axis Value" Property of the DataSet. The only place where i can access the root Object is in the "Before/After Simulation Run"Property of the ParameterVariation Object. There i could write something like dataset.update(getCurrentIteration(),root.getSomeData()); But this looks very ugly, using the automatic Update feature of the DataSet would be much more elegant and less error prone, because i don't have to maintain the long list of dataset.update() calls (I'm going to have quite a few datasets of this type). How are you using the ParameterVariation? Is there a more clever way to access the root-Object?
Hello! You were right that the most common way to collect statistics in [ParameterVariation] experiment is using a [DataSet] object inside a [ParameterVariation] object. You cannot use reference to [Main] object in [Y Axis Value] property of [DataSet] because by the moment a DataSet is updated, this reference has already been lost (and thus, is equal to null). I can suggest you two variants of handling this problem^ The first one is the one you mentioned yourself, i.e. performing all operations in [Before/After Simulation Run] fields. The second solution is, to my mind, a bit more elegant. In [ParameterVariation] object you crate a plain variable [main] of Java type [Main]. In field [After Simulation Run] you put the following code: main = (Main)engine.getRoot(); So, the reference to the root object will be saved in [main] variable. In [Vertical Axis Value] you can access this root object, e.g.: main.getSomeData();