Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Codesysservice stoppt nach 25 Stunden

CanBohr
2019-02-26
2023-08-17
  • CanBohr - 2019-02-26

    Hallo an alle,

    ich habe mal wieder ein kleines (so hoffe ich) Problem.
    Der Codesysservice stoppt nach 25 Stunden Dauerbetrieb meines Raspis.
    Der Raspi ist dann zwar noch im Lan- und Wlan-Netz sichtbar (WinSCP) aber die Kommunikation mit Codesys ist unterbrochen, ähnlich wie beim Testbetrieb nach 2 Stunden ohne Lizenz.
    Ich habe aber eine Lizenz.
    Auf der Webvisu des Raspis erscheint das rote Laufrad mit der Meldung: "An error happened, will automatically restart."
    Wenn ich auf der Console des Raspi: "sudo service codesyscontrol status" eingebe, bekomme ich die untenstehende Statusmeldung.
    Wenn ich die codesyscontrol stoppe und starte, läuft das Programm wieder ganz normal durch.

    Hat jemand einen Tip für mich, woran das Verhalten liegen kann?

    Vielen Dank schon mal im Voraus,
    CanBohr

     
  • CanBohr - 2019-03-12

    Hallo Herr Schwellinger,

    ich bin auf der Suche nach der Fehlerursache etwas weiter gekommen.

    Es liegt wohl an der Schreibroutine für das Schreiben des Datensatzes.

    Irgendwann bekommt der Schreibbefehl die Rückmeldung pResult:=ADR( 2)
    Kurz danach stürtzt das System ab, auch wenn ich einen Haltepunkt einfüge.
    Der Fehler tritt nach etwa 1006 Schreibvorgängen auf.

    Mache ich beim Schreiben was falsch?

    Hat jemand einen Tip für mich, wie ich den Fehler elegant abfangen kann.

    IF NOT FileOpenData THEN
       
       FilePathAndName:=Concat(PLC_PRG.sFilePathData,PLC_PRG.sFileNameData);
       handleData := SysFileOpen(szFile:= FilePathAndName, AM_APPEND_PLUS , ADR( rte) );      
             
       (* Write Datastring to file *)
       IF SysFileWrite(hFile:= handleData, pbyBuffer:= ADR(resultdata_csv), ulSize:=pEnd - ADR(resultdata_csv) , pResult:=ADR( rte) )= 0 THEN
          
          iERRORData := 92; (* Could not write to file *)
          sStatusData := 'Could not write file.';
          SysFileClose(hFile:= handleData ) ;
       
          IF FileOpenData THEN
             
             (* Close file *)
             IF SysFileClose(hFile:= handleData ) =0 THEN
                      
                   FileOpenData := FALSE;
                   sStatusData := 'File Saved.';
                   iERRORData := 91; (* Could not close file *)
                   sStatusData := 'Could not close file.';
                   xReadyForData:=FALSE;
             END_IF
          END_IF
       ELSE
          xWritingData:=FALSE;   
          xStartData := FALSE;
          xReadyForData:=TRUE;
             
       END_IF
       
    

    IMG: Codesys write CSV Data Fehler.jpg

    IMG: Codesys write CSV Data.jpg

     
  • CanBohr - 2019-03-16

    Ich habe es zum Laufen bekommen.
    Es war ein Timingproblem beim Öffnen, Schreiben und Schließen der CSV-Datei.
    Den Weg zur Lösung findet ihr hier:
    https://forum.codesys.com/viewtopic.php ... 971#p23971

    Gruß,
    CanBohr

    PS: Danke auch hier für die Unterstützung auch im Hintergrund.

     

Log in to post a comment.