Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Sonnenwinkel berechnen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Sonnenwinkel berechnen

    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Pistus last edited by Pistus

      Mit diesem Skript ändert sich Azimuth innerhalb 3h von -47° bis 221° 11:30 bis 14:30Uhr

      const suncalc = require('suncalc2');
      const result = getObject("system.adapter.javascript.0");
      const lat = result.native.latitude;
      const long = result.native.longitude;
      const idEle = 'Sonnenstand.Elevation';
      const idAzi = 'Sonnenstand.Azimuth';
      
      createState(idEle, 0, {type: 'number', unit: '°'});
      createState(idAzi, 0, {type: 'number', unit: '°'});
      
      function Sonnenstand_berechnen () {
      	var now = new Date();
      	var sunpos = suncalc.getPosition(now, lat, long);
      	var h = sunpos.altitude * 180 / Math.PI;
      	var a = sunpos.azimuth * 180 / Math.PI + 100;
      	setState(idEle, Math.round(10 * h) / 10, true);
      	setState(idAzi, Math.round(a), true);
      }
      schedule("* * * * *", Sonnenstand_berechnen);
      

      Was ist falsch an dem Skrpt?

      paul53 bahnuhr 3 Replies Last reply Reply Quote 0
      • paul53
        paul53 @Pistus last edited by paul53

        @pistus sagte: Was ist falsch an dem Skrpt?

        Zeile 15:

        	var a = sunpos.azimuth * 180 / Math.PI + 180;
        

        Stimmen die Werte von lat und long?

        1 Reply Last reply Reply Quote 0
        • bahnuhr
          bahnuhr Forum Testing Most Active @Pistus last edited by bahnuhr

          @pistus

          probier dies:

          https://forum.iobroker.net/topic/733/gesucht-script-sonnenwinkel-berechnen/92?_=1712058556266

          1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Pistus last edited by paul53

            @pistus
            Alternative aus der System-Konfiguration:

            const suncalc = require('suncalc');
            const result = getObject('system.config');
            const lat = result.common.latitude;
            const long = result.common.longitude;
            
            P 1 Reply Last reply Reply Quote 0
            • P
              Pistus @paul53 last edited by Pistus

              @paul53 ich habe die Daten der Systemconfiguration genommen
              Jetzt ist Azimuth139° und
              Elevation 37° um 15:40
              Wenn man sich das Bild betrachtet ist Azimuth immer noch daneben

              Was ist falsch an Zeile 15?

              azimutwinkel.png

              bahnuhr paul53 2 Replies Last reply Reply Quote 0
              • bahnuhr
                bahnuhr Forum Testing Most Active @Pistus last edited by bahnuhr

                @pistus
                Zeile 15 und 17 ist falsch
                Mein Script hast du offensichtlich nicht verglichen.

                P 1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 @Pistus last edited by paul53

                  @pistus sagte: Was ist falsch an Zeile 15?

                  Es müssen 180 (nicht 100) addiert werden (Nord = 0°, Ost = 90°).

                  @pistus sagte in Sonnenwinkel berechnen:

                  Jetzt ist Azimuth139°

                  Das sind 80° zu wenig.

                  1 Reply Last reply Reply Quote 0
                  • P
                    Pistus @bahnuhr last edited by

                    @bahnuhr Ich finde Dein Skript mit der Visualisierung top.
                    Aber ich bin nicht so fit im Skripten, ich muss verstehen und klein anfangen.
                    In Deiner Visualisierung habe ich für März nicht die -XX° für Azimuth verstanden.
                    Siehe mein Sonnenwinkelbild mit Etwawerten.
                    Was ist falsch in Zeile 17.

                    P 1 Reply Last reply Reply Quote 0
                    • P
                      Pistus @Pistus last edited by Pistus

                      @bahnuhr
                      @paul53
                      So sieht das Skript jetzt aus. Bitte noch einmal um Überprüfung.

                      const suncalc = require('suncalc2');
                      const result = getObject('system.config');
                      const lat = result.common.latitude;
                      const long = result.common.longitude;
                      
                      //const result = getObject("system.adapter.javascript.0");
                      //const lat = result.native.latitude;
                      //const long = result.native.longitude;
                      const idEle = 'Sonnenstand.Elevation';
                      const idAzi = 'Sonnenstand.Azimuth';
                      
                      createState(idEle, 0, {type: 'number', unit: '°'});
                      createState(idAzi, 0, {type: 'number', unit: '°'});
                      
                      function Sonnenstand_berechnen () {
                      	var now = new Date();
                      	var sunpos = suncalc.getPosition(now, lat, long);
                      	var h = sunpos.altitude * 180 / Math.PI;
                      	var a = sunpos.azimuth * 180 / Math.PI + 180;
                      	setState(idEle, Math.round(10 * h) / 10, true);
                      	//setState(idAzi, Math.round(a), true);
                      
                          setState(idAzi, Math.round(Math.round(10 * a) / 10), true);
                      }
                      schedule("* * * * *", Sonnenstand_berechnen);
                      
                      bahnuhr 1 Reply Last reply Reply Quote 0
                      • bahnuhr
                        bahnuhr Forum Testing Most Active @Pistus last edited by

                        @pistus

                        geb doch mal was ein und vergleichen die Werte mit dem Internet.
                        Dann siehst du doch gleich ob die Werte passen.

                        P 1 Reply Last reply Reply Quote 0
                        • P
                          Pistus @bahnuhr last edited by

                          @bahnuhr
                          Für Mülheim an der Ruhr um 16:00 Uhr beträgt das Azimut etwa 220 Grad.
                          Elevation: Dies ist der vertikale Winkel, der den Winkel über dem Horizont angibt. Um 16:00 Uhr in Mülheim an der Ruhr beträgt die Elevation etwa 30 Grad.
                          Jetzt um 16:50
                          aziel.png

                          bahnuhr 1 Reply Last reply Reply Quote 0
                          • bahnuhr
                            bahnuhr Forum Testing Most Active @Pistus last edited by

                            @pistus
                            Also ein bisschen schwerfällig bist du schon.
                            Warum gibts du deine Daten nicht im Internet ein.
                            Dann siehst du doch genau, dass diese fast stimmen !
                            e8136f96-621c-4642-847a-194228db09fe-image.png

                            P 1 Reply Last reply Reply Quote 1
                            • P
                              Pistus @bahnuhr last edited by

                              @bahnuhr Danke, passt doch super.
                              Mit 82 ist man halt nicht mehr so drahtig. Könntest Du bitte mir den Link Link von Deinem Beispiel, Berechnung Sonnenverlauf, weitergeben.

                              bahnuhr 1 Reply Last reply Reply Quote 0
                              • bahnuhr
                                bahnuhr Forum Testing Most Active @Pistus last edited by

                                @pistus
                                gleich der 1. Treffer in google
                                6674eedd-752e-4f89-9702-4f8ed20b151b-image.png

                                für Mond gibts auch sowas.

                                P 1 Reply Last reply Reply Quote 1
                                • P
                                  Pistus @bahnuhr last edited by

                                  @bahnuhr Danke.
                                  Der nächste Schritt, ich würde gerne den Sonnenverlauf mittels Sonnenbild im Halbkreis darstellen . Im Hintergrund mein Solardach in Ost- West Ausrichtung, zwei Stränge.
                                  Die Sonne soll sich stündlich weiter bewegen und dabei soll die abgeführte Leistung vom Solardach angezeigt werden. Jeder Strang.
                                  solardach.jpg
                                  Dach hinten ist Osten.
                                  sonnenstand10.png
                                  So ungfähr

                                  bahnuhr 1 Reply Last reply Reply Quote 0
                                  • bahnuhr
                                    bahnuhr Forum Testing Most Active @Pistus last edited by

                                    @pistus
                                    Da muss jemand anders helfen.

                                    P 1 Reply Last reply Reply Quote 0
                                    • P
                                      Pistus @bahnuhr last edited by

                                      @bahnuhr Die Leistung je Strang bekomme ich schon jetzt mittels Modbus vom Wechselrichter und kann in den Objekten abgeholt werden.
                                      Wie bekommt man die Daten von Azimuth in VIS und kann diese dann im Halbkreis darstellen.

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post

                                      Support us

                                      ioBroker
                                      Community Adapters
                                      Donate

                                      730
                                      Online

                                      31.9k
                                      Users

                                      80.2k
                                      Topics

                                      1.3m
                                      Posts

                                      3
                                      17
                                      696
                                      Loading More Posts
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      Community
                                      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                      The ioBroker Community 2014-2023
                                      logo