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

Fehler: " kein gültiges Zuweisungsziel. "

mariusfg
2017-01-19
2017-01-19
  • mariusfg - 2017-01-19

    Hallo,

    ich bin neu mit Codesys unterwegs.
    Habe einen Funktionsblock generiert.

    Es erscheinen die Fehlermeldungen "TRUE AND boEVU30" ist kein gültiges Zuweisungsziel.

    Ich gehe von einem Syntaxfehler aus.

    FUNCTION_BLOCK FB_PowerSteps
    VAR_INPUT
       iEVU_Pro: INT; //Prozentzahl der Leistungsforderung EVU
    END_VAR
    VAR_OUTPUT
       boEVU60: BOOL;
       boEVU30: BOOL;
       boEVU00: BOOL;
    END_VAR
    VAR
       iMerkerEVU_Pro: INT := 100;
    END_VAR
    
    IF (iEVU_Pro = 60 AND iMerkerEVU_Pro = 60)
            THEN boEVU60 := TRUE AND boEVU30 := FALSE AND boEVU00 := FALSE; 
       ELSIF (iEVU_Pro = 30 AND iMerkerEVU_Pro = 30)
           THEN boEVU60 := FALSE AND boEVU30 := TRUE AND boEVU00 := FALSE;
       ELSIF (iEVU_Pro = 0 AND iMerkerEVU_Pro = 0) 
          THEN boEVU60 := FALSE AND boEVU30 := FALSE AND boEVU00 := TRUE;
       ELSE boEVU60 := FALSE AND boEVU30 := FALSE AND boEVU00 := FALSE;   // alle Werte deaktivieren >> 100 % Einspeisung in allen anderen Fällen
    END_IF;
    

    Danke für eure Hilfe. (Sorry, Thema war erst im falschen Bereich)

     
  • Anonymous - 2017-01-19

    Originally created by: Massimo.Milluzzo

    You can use the keyword AND only during the evaluation of an expression.
    You have to split the assignments and put a semicolon at the end of each one, like this

    IF (iEVU_Pro = 60 AND iMerkerEVU_Pro = 60) THEN 
       boEVU60 := TRUE ;
       boEVU30 := FALSE;
       boEVU00 := FALSE; 
    ELSIF (iEVU_Pro = 30 AND iMerkerEVU_Pro = 30)  THEN 
       boEVU60 := FALSE;
       boEVU30 := TRUE;
       boEVU00 := FALSE;
    ELSIF (iEVU_Pro = 0 AND iMerkerEVU_Pro = 0) THEN 
       boEVU60 := FALSE;
       boEVU30 := FALSE;
       boEVU00 := TRUE;
    ELSE 
       boEVU60 := FALSE;
       boEVU30 := FALSE;
       boEVU00 := FALSE;   // alle Werte deaktivieren >> 100 % Einspeisung in allen anderen Fällen
    END_IF;
    
     

Log in to post a comment.