Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Model::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 240

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Model::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 244

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Model::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 248

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Model::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 257

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Collection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Collection.php on line 19

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Collection::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Collection.php on line 32

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Collection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Collection.php on line 26

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Collection::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Collection.php on line 36

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Collection::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Collection.php on line 13

Deprecated: Return type of Google\Site_Kit_Dependencies\Google\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Collection.php on line 41

Deprecated: Return type of Google\Site_Kit\Core\Util\JSON_File::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/JSON_File.php on line 87

Deprecated: Return type of Google\Site_Kit\Core\Util\JSON_File::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/JSON_File.php on line 101

Deprecated: Return type of Google\Site_Kit\Core\Util\JSON_File::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/JSON_File.php on line 113

Deprecated: Return type of Google\Site_Kit\Core\Util\JSON_File::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/JSON_File.php on line 124

Deprecated: Return type of Google\Site_Kit\Core\Util\JSON_File::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/JSON_File.php on line 148

Deprecated: Return type of Google\Site_Kit\Core\Util\JSON_File::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/JSON_File.php on line 135

Deprecated: Creation of dynamic property WP_Bulk_Delete::$api is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/wp-bulk-delete/wp-bulk-delete.php on line 53

Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Admin/Standalone.php on line 95

Deprecated: filter_input(): Passing null to parameter #4 ($options) of type array|int is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/Input.php on line 64

Deprecated: filter_input(): Passing null to parameter #4 ($options) of type array|int is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/Input.php on line 64

Deprecated: version_compare(): Passing null to parameter #2 ($version2) of type string is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/elementor/core/upgrade/manager.php on line 62

Deprecated: Return type of Elementor\Core\Utils\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/elementor/core/utils/collection.php on line 404

Deprecated: Return type of Elementor\Core\Utils\Collection::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/elementor/core/utils/collection.php on line 413

Deprecated: Return type of Elementor\Core\Utils\Collection::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/elementor/core/utils/collection.php on line 421

Deprecated: Return type of Elementor\Core\Utils\Collection::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/elementor/core/utils/collection.php on line 432

Deprecated: Return type of Elementor\Core\Utils\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/elementor/core/utils/collection.php on line 446

Deprecated: Return type of Elementor\Core\Utils\Collection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/stromhaltig/blog/wp-content/plugins/elementor/core/utils/collection.php on line 439

Deprecated: version_compare(): Passing null to parameter #2 ($version2) of type string is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/elementor/core/upgrade/manager.php on line 62

Deprecated: Creation of dynamic property Advanced_Ads_Ads_Txt_Public::$strategy is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/advanced-ads/modules/ads-txt/public/class-advanced-ads-ads-txt-public.php on line 12

Deprecated: Creation of dynamic property Advanced_Ads_Ads_Txt_Public::$strategy is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/advanced-ads/modules/ads-txt/public/class-advanced-ads-ads-txt-public.php on line 12

Deprecated: Creation of dynamic property Advanced_Ads_Network_Adsense::$settings_section_id is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/advanced-ads/admin/includes/class-ad-network.php on line 45

Deprecated: Creation of dynamic property Advanced_Ads_Network_Adsense::$settings_init_hook is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/advanced-ads/admin/includes/class-ad-network.php on line 46

Deprecated: Creation of dynamic property Advanced_Ads_Network_Adsense::$data is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/advanced-ads/modules/gadsense/includes/class-network-adsense.php on line 38

Deprecated: filter_input(): Passing null to parameter #4 ($options) of type array|int is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/Input.php on line 64

Deprecated: filter_input(): Passing null to parameter #4 ($options) of type array|int is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/Input.php on line 64

Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Analytics\Web_Tag::$module_slug is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Modules/Tags/Module_Tag.php on line 42

Deprecated: filter_input(): Passing null to parameter #4 ($options) of type array|int is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/Input.php on line 64

Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Analytics_4\Web_Tag::$module_slug is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Modules/Tags/Module_Tag.php on line 42

Deprecated: filter_input(): Passing null to parameter #4 ($options) of type array|int is deprecated in /var/www/stromhaltig/blog/wp-content/plugins/google-site-kit/includes/Core/Util/Input.php on line 64
Schnelleinstieg: Energie-Datenjournalismus mir R – blog.stromhaltig

Schnelleinstieg: Energie-Datenjournalismus mir R

Datenjournalismus mit R
R Statistik Tool

Die normale Recherche für einen Artikel läuft eigentlich immer nach dem gleichen Prinzip ab: Zunächst hat man eine Information, dann hinterfragt man diese mit Hilfe von Tante-Google. Beim Datenjournalismus ist dies nicht viel anders, nur dass die Fragen an Daten gestellt werden. Gerade die Stromwende neigt dazu sehr viele Daten zu produzieren: SmartMeter, Wetter, Lastgang,… . Mittels der kostenlosen Werkzeuges “R”  können statistische Auswertungen sehr einfach realisiert werden, denn es gibt immer eine Alternative zu Excel (welches ich persönlich nur noch zur Visualisierung verwende),

R-Project

Die Installation der Software sollte nicht sonderlich schwierig sein. Die Downloads für Windows,Linux,Unix und MacOS  finden sich auf jedem CPAN Mirror. Für den Anfang empfehle ich auf jeden Fall die RGUI. Einführungen gibt es sehr viele, da das Werkzeug mittlerweile in vielen Statistik-Vorlesungen verwendet wird. Um mit der Syntax und der Arbeit vertrauter zu wenden würde ich die Anleitung der ETH-Zürich verwenden. Etwas Auffrischung in Sachen Statistik und Analyse gibt es bei der Uni-Bielefeld.

Die Fragestellung

Um Fragen an Daten stellen zu können, müssen immer den Art und Umfang der Erhebung der Daten berücksichtigt werden. In den kommenden Wochen wird es hier im Blog zum Beispiel einen Beitrag über das Gradienten Problem im Deutschen Übertragungsnetz geben. Bei dieser Belastung handelt es sich um einen unerwarteten Ausschlag im Stromnetz, wie er bei einer Sturmböe im Windpark passieren könnte – oder beim Ausfall eines großen Kraftwerkes. Als Datenquelle könnten die ReDispatch Maßnahmen gelten, wie allerdings im Followup- Beitrag zu diesen Netzeingriffen beschrieben, gibt es gewisse Unklarheiten in den Quelldaten, welche einer Verwendung entgegenstehen.

Ein Gradienten-Problem könnte aber über die abgerufene Sekundärregelleistung (SRL) erkannt werden. Dabei handelt es sich um eine Ausgleichenergie, die zur Haltung der Netzfrequenz verwendet wird. Die Hypothese ist, dass bei der Zunahme des Gradienten-Problems die Abrufmengen vergrößern. Die Rohdaten kann man als CSV beim Informationsportal zur Regelleistung herunterladen.

Untersuchungsauftrag:
Vergleiche die Abrufmengen von Sekundärregelleistung für Januar-April 2012 und 2013.

Daten Import

R kommt bereits mit einer ganzen Anzahl von Variationen der read.table() Funktion, welche das Einlesen von CSV Dateien auch erlaubt. Für das Einlesen der Abrufmengen sind dennoch einige Parametrisierung und Konvertierungen notwendig.

[bash]

read.rl<-function(file) {
srl<-read.csv(file,sep=";",skip=5,header=FALSE,col.names=c("Datum","Zeit","NegMW","PosMW","Remark"),as.is=TRUE)
col2cvt <- c(‘NegMW’, ‘PosMW’)
for (i in col2cvt){
srl[[i]] <- as.character(gsub("\\.", "", srl[[i]]))
srl[[i]] <- as.numeric(gsub("\\,", ".", srl[[i]]))
}
srl
}
read.srl<-read.rl
read.mrl<-read.rl
[/bash]

Zunächst wird eine Funktion definiert, die das Einlesen der Regelleistungs-CSV-Dateien übernimmt. Anschließend wird noch ein Alias definiert. Danach können die Daten sehr einfach als Matrix (Tabelle)  eingelesen werden:

[bash]

feb12=read.srl("e:/data/srl_de/ABGERUFENE_SRL_BETR_IST-WERTE_20120201_20120228_Netzregelverbund_20130523-012353.csv")
; oder aus der Zwischenablage
feb12=read.srl("clipboard")

[/bash]

Erste Auswertung

Beim Einlesen wurde für jede Quelldatei eine einzelne Tabelle angelegt. Um diese Tabelle angezeigt zu bekommen kann man diese direkt aufrufen:

[bash]

feb12

[/bash]

Die einzelnen Werte können ab diesem Zeitpunkt auch schon visualisiert werden

[bash]
hist(feb12[,"NegMW"])

[/bash]

Verteilung Abrufgröße negative SRL - Februar 2012
Verteilung Abrufgröße negative SRL – Februar 2012

Einfache Statistik

Für die Beantwortung der Fragestellung (“Gradienten Problem”) wird eine Summe über die negative und positive Abrufmenge für den gesamten Monat benötigt. Da wir für jeden Monat eine Tabelle haben, bietet sich auch hier das Anlegen einer Funktion an:

[bash]

sum.abruf<-function(data) {
sum(data[,"PosMW"],data[,"NegMW"],na.rm=TRUE)
}

[/bash]

Die gesamte Abrufmenge in MW lässt sich dann mit dem Aufruf der Tabelle als Parameter ermitteln:

[bash]

sum.abruf(feb12)

[/bash]

Es sei an dieser Stelle angemerkt, dass es in den Quelldaten einige fehlende Werte gibt. Diese sollte man beachten, bevor man zum Beispiel den Februar 2012 mit dem Februar 2013 vergleicht.

Einen Vektor für die 4 Monate 2012 und 2013 lässt sich mit folgendem Syntax erstellen:

[bash]

monate = c("Januar","Februar","März","April")

monate2012=c(sum.abruf(jan12),sum.abruf(feb12),sum.abruf(mar12),sum.abruf(apr12))

monate2013=c(sum.abruf(jan13),sum.abruf(feb13),sum.abruf(mar13),sum.abruf(apr13))

ergebnis=data.frame(monate,monate2012,monate2013)

[/bash]

In der Tabelle ergebnis befindet sich nun die Antwort auf die Frage, wie sich die Monatswerte im Jahresvergleich verändert haben. Da das Ergebnis schon etwas verwunderlich ist, soll es hier nicht weiter beleuchtet werden.

Zum Umgang mit “R” sei nur soviel gesagt: Das Werkzeug ist sehr mächtig, daher auch manchmal etwas schwierig zu bedienen. Wenn man sich aber mit einfachen Fragestellungen an die Erkundung macht, dass kann man sehr gute Ergebnisse – in sehr kurzer Zeit – erzielen.

Inhalt nicht verfügbar.
Bitte erlauben Sie Cookies, indem Sie auf Übernehmen Sie auf das Banner

Durch das Fortsetzen der Benutzung dieser Seite, stimmst du der Benutzung von Cookies zu. Weitere Informationen

Die Cookie-Einstellungen auf dieser Website sind auf "Cookies zulassen", um Ihnen das beste Surferlebnis möglich zu geben. Wenn Sie diese Website ohne Änderung Ihrer Cookie-Einstellungen zu verwenden fortzufahren, oder klicken Sie auf "Akzeptieren" unten, dann erklären Sie sich mit diesen.

Schließen