FlexPro
HistoryBase
Ingénierie
Formation
Téléchargements
Support FlexPro
Connaissance
Communauté
À propos de nous
Références
Emplois
Contact général
Liste des revendeurs
Support FlexPro
FR
DE
EN
Porte-plaquette
Produits et solutions
Support et téléchargements
Entreprise
Magazine
Contact
Langue
MyWeisang

Paramètres du compte.

Topic

Speeding up running average calculations

Page d'accueil ' Communauté ' Automation et VBA ' Relever les calculs de la moyenne courante

Voir les messages de 4 - 1 à 4 (sur un total de 4)
  • Auteur
    Messages
  • #35056
    Norbert Bakkers
    Participant

    During execution of a programme, the running average of a dataset seems to take a very long time to calculate.
    I first tried to get the code to program a running average by recording a macro and to use it in a modified form in my own code. The problem is that I can record it but I can not execute the macro. It crashes on the line that sets the ‘Interval width’ => ‘WindowSize’.
    This is the recorded macro:
    ActiveDatabase.ActiveFolder.Object(“Mean”).Select False
    ActiveDatabase.ActiveFolder.Object(“Mean”).Select
    ActiveDatabase.SelectedObject.WindowSize = 500
    Application.UpdateAll

    Therefore I use the following formula:
    .Formula = “Mean(‘DataSet’ ,MEAN_ARITHMETIC + CALC_RUNNING, 500)”

    This works but is very slow for bigger datasets, especially if the averaging window is big. Is there any way of speeding up this process?

    #35054
    Bernhard Kantz
    Participant

    The macro stops with an error because the generated code is not correct. We will remove this issue. The correct code should be:
    [code]
    ActiveDatabase.SelectedObject.SmoothingWidth = 500
    [/code]
    An alternative to the mean function is the smooth function respectively the Signal Smoothing Analysis Object. This method uses a faster linear algorithm.
    The result of
    [code]
    Mean(‘DataSet’ ,MEAN_ARITHMETIC + CALC_RUNNING, 501)”
    [/code]
    and
    [code]
    Smooth(‘DataSet’ ,250)”
    [/code]
    is similar.
    When the smoothing is calculated, there are insufficient left and right neighbours available for the first or last SmoothingWidth values in DataSet. Unlike the mean function these values are then equated to the first or last value in DataSet.

    Refer to the online help for more information.

    support@weisang.com

    #35055
    Norbert Bakkers
    Participant

    Thanks.
    Using the Smooth function instead of the running average function speeds the process up by almost a factor of 10 !!

    #35053
    Norbert Bakkers
    Participant

    During execution of a programme, the running average of a dataset seems to take a very long time to calculate.
    I first tried to get the code to program a running average by recording a macro and to use it in a modified form in my own code. The problem is that I can record it but I can not execute the macro. It crashes on the line that sets the ‘Interval width’ => ‘WindowSize’.
    This is the recorded macro:
    ActiveDatabase.ActiveFolder.Object(“Mean”).Select False
    ActiveDatabase.ActiveFolder.Object(“Mean”).Select
    ActiveDatabase.SelectedObject.WindowSize = 500
    Application.UpdateAll

    Therefore I use the following formula:
    .Formula = “Mean(‘DataSet’ ,MEAN_ARITHMETIC + CALC_RUNNING, 500)”

    This works but is very slow for bigger datasets, especially if the averaging window is big. Is there any way of speeding up this process?

Voir les messages de 4 - 1 à 4 (sur un total de 4)
  • Vous devez être connecté pour répondre à ce sujet.