Ich würde mir gerne ein Array von Plugin Aufruf zu Aufruf merken ==> gleitenden Mittelwert über einen gewisse Zeitdauer.
Folgender Befehl in Zeile 13 funktioniert offensichtlich noch nicht so ganz:
my @Wind_History = $plugin_info{$plugname.'_Wind_History'};
Wer hat einen kurzen Hinweis? Hab das ganze Plugin noch eingefügt, falls jemand ähnliches vor hat oder am WG testen will.
Danke Robert
Folgender Befehl in Zeile 13 funktioniert offensichtlich noch nicht so ganz:

my @Wind_History = $plugin_info{$plugname.'_Wind_History'};
Wer hat einen kurzen Hinweis? Hab das ganze Plugin noch eingefügt, falls jemand ähnliches vor hat oder am WG testen will.
Danke Robert
Code:
[FONT=Arial][SIZE=2]# Wind Mittelwert[/SIZE][/FONT] [FONT=Arial][SIZE=2]# V1.00 2011-02-02[/SIZE][/FONT] [FONT=Arial][SIZE=2]### Definitionen [/SIZE][/FONT] [FONT=Arial][SIZE=2]my $Wind_aktuell_ga = "5/1/90"; [/SIZE][/FONT] [FONT=Arial][SIZE=2]my $w_Intervall=60; # Minuten[/SIZE][/FONT] [FONT=Arial][SIZE=2]### Ende Definitionen[/SIZE][/FONT] [FONT=Arial][SIZE=2]$plugin_info{$plugname.'_cycle'} = 30;[/SIZE][/FONT] [FONT=Arial][SIZE=2]my $w_max= $w_Intervall*60/$plugin_info{$plugname.'_cycle'}; [/SIZE][/FONT] [FONT=Arial][SIZE=2]my $Wind_aktuell=knx_read($Wind_aktuell_ga,10,9);[/SIZE][/FONT] [FONT=Arial][SIZE=2]my $w = $plugin_info{$plugname.'_wind_zaehler'}; # Letzte Position lesen[/SIZE][/FONT] [FONT=Arial][SIZE=2]my @Wind_History = $plugin_info{$plugname.'_Wind_History'}; # Array lesen [/SIZE][/FONT] [FONT=Arial][SIZE=2]$Wind_History[$w]=$Wind_aktuell;[/SIZE][/FONT] [FONT=Arial][SIZE=2]$w++;[/SIZE][/FONT] [FONT=Arial][SIZE=2]if ($w > ($w_max-1)) {$w=0}[/SIZE][/FONT] [FONT=Arial][SIZE=2]$plugin_info{$plugname.'_wind_zaehler'} = $w; # Naechste Position merken[/SIZE][/FONT] [FONT=Arial][SIZE=2]$plugin_info{$plugname.'_Wind_History'} = @Wind_History; # Array merken[/SIZE][/FONT] [FONT=Arial][SIZE=2] [FONT=Arial][SIZE=2]# Mittelwert[/SIZE][/FONT] [FONT=Arial]berechnen[/FONT] [/SIZE][/FONT][FONT=Arial][SIZE=2]my $Summe = 0;[/SIZE][/FONT] [FONT=Arial][SIZE=2]for my $i (0 .. ($w_max-1)) [/SIZE][/FONT] [FONT=Arial][SIZE=2]{[/SIZE][/FONT] [FONT=Arial][SIZE=2]$Summe = $Summe + $Wind_History[$i];[/SIZE][/FONT] [FONT=Arial][SIZE=2]}[/SIZE][/FONT] [FONT=Arial][SIZE=2]my $Wind_Mittelwert = (1.0* $Summe / $w_max);[/SIZE][/FONT] [FONT=Arial][SIZE=2]return;[/SIZE][/FONT] [FONT=Arial][SIZE=2]# zum debuggen [/SIZE][/FONT] [FONT=Arial][SIZE=2]# return "Wind_Mittelw $Wind_Mittelwert w $w Summe $Summe W0 $Wind_History[0] W1 $Wind_History[1] W2 $Wind_History[2]";[/SIZE][/FONT]
Kommentar