Check whether results do already exist for current parameter values
The idea of this feature is relatively simple: Check whether the project has already been simulated for the current set of parameters and it the corresponding results are present in the Result Navigator.
Nevertheless, despite the relative simplicity of the feature, its implementation is quite complex due to a lack of specific commands in the CST VBA interface. Here I enunciate the main conceptual steps that must be performed for implementing the feature. More details on the specific implementation details of each of them can be found in the merge request.
- Retrieve current value for all parameters
- Get a list with all the project parameter names
- Get the number of parameters in the project using the "GetNumberOfParameters" command.
- Use the "GetParameterName" command to retrieve the name of each parameter one by one.
- For each parameter, retrieve its value using the retrieve() method of the Parameter class in CPA.
- Get a list with all the project parameter names
- Find results ID for the current parameter combination
- Verify that all parameters exist.
- Retrieve the parameter values for all the runIDs
- Get the resultIDs using the "GetResultIDsFromTreeItem" command. This requires to know the result for which the user is interested. If the project hasn't been simulated yet, this may result in error. Take this into account.
- For each of the resultIDs retrieve in the former step, obtain its corresponding parameter values by using the "GetParameterCombination" command. This is a tricky command since it requires special input parameters that will in reality acts as outputs (see merge request).
- Compare the current parameter values with the list of parameters for the already run simulations.
- Take into account that when comparing the values it could be interesting to allow a certain tolerance (i.e. "almost equal" instead of "strictly equal").
- If more than one resultID matches, reduce the allowed tolerance to check which of them better matches the specified parameters.
Edited by Lucas POLO-LOPEZ