Answer Question
Writing IF/ELSE script for a component
Hello,
I'm new to writing scripts for PSCAD compenents and I'm trying to write a simple IF/ELSE script for a component. But, I'm receving error that there are some synatx errors and also there is no IF/ELSE corresponding to and ENDIF.
Below is my script which has 4 inputs and one output (yo). Your help is really appreciated. Also I was wondering from where I could find a good source for syntax for this type of scriipting.
IF $sw < 0.5 THEN $yo = 0 ELSEIF sw > 1.5 THEN IF $yi1 > $yi2 THEN $yo = $yi1 - $yi2 ELSEIF $yi1 < -$yi2 THEN $yo = $yi1 + $yi2 ELSE $yo = 0 ENDIF ELSE IF $yi1 > $yi3 THEN $yo = $yi1 - $yi3 ELSEIF $yi1 < -$yi3 THEN $yo = $yi1 + $yi3 ELSE $yo = 0 ENDIF ENDIF
I'm new to writing scripts for PSCAD compenents and I'm trying to write a simple IF/ELSE script for a component. But, I'm receving error that there are some synatx errors and also there is no IF/ELSE corresponding to and ENDIF.
Below is my script which has 4 inputs and one output (yo). Your help is really appreciated. Also I was wondering from where I could find a good source for syntax for this type of scriipting.
IF $sw < 0.5 THEN $yo = 0 ELSEIF sw > 1.5 THEN IF $yi1 > $yi2 THEN $yo = $yi1 - $yi2 ELSEIF $yi1 < -$yi2 THEN $yo = $yi1 + $yi2 ELSE $yo = 0 ENDIF ELSE IF $yi1 > $yi3 THEN $yo = $yi1 - $yi3 ELSEIF $yi1 < -$yi3 THEN $yo = $yi1 + $yi3 ELSE $yo = 0 ENDIF ENDIF