Hi Dojo,
I'm trying to loop over several elements and retrieve around 20 parameter values for each element. This takes quite some time, so I'm looking for ways to improve performance. However, I haven't found any method so far that helps with this. Could anyone help me out with the following questions?
-
Is there a method in the IDms or IDmsElement class (or elsewhere in ad hoc) that allows fetching multiple parameters at once?
-
Is there a GetParametersMessage variant in SLNet similar to GetParameterMessage, so I can request multiple parameters at once?
-
I also tried using DMS.SendMessages, but it seems to send all my GetParameterMessages individually. Does anyone have experience with this?
Thanks in advance!
Hi Sofian,
Something you could try is fetching the data of multiple elements in parallel, using Parallel.Foreach.
Something like this (pseudocode);
IEnumerable<IDmsElement> elements;
var result = new ConcurrentDictionary<>();
Parallel.ForEach(elements, element =>
{
foreach(var param in parameters)
{
// retrieve all values
var value = element.GetParameter(param);// store values
result.Add(...);
}
});// Do something with the retrieved parameter values
...