How can I create a comparator using fortran in PSCAD?
I am trying to make a comparison between a measured current with a reference current signal, as follows:
inputs: Imax(a random value), Ia (Ia is the measured current)
outputs: gate1
#LOCAL REAL iref
#LOCAL REAL iup
#LOCAL REAL ilow
iref = $Imax*SIN(TWO_PI*60*TIME)
iup = iref+iref*01
ilow = iref - iref*0.1
IF $I > up
$gate1 = 0
ELSEIF $I < ilow
$gate1 = 1
ENDIF
Status:
Open Feb 02, 2021 - 04:45 PM
custom components
1answer
Answer
Feb 02, 2021 - 05:18 PM
Hi, I created a test block in PSCAD. There were several mistakes. Here is the code.
#LOCAL REAL iref #LOCAL REAL iup #LOCAL REAL ilow #LOCAL REAL gate iref = $Imax*SIN(TWO_PI*60*TIME) iup = iref+iref*0.1 ilow = iref-iref*0.1 IF ($I>iup) THEN gate = 0 ELSE gate = 1 ENDIF $gate1 = gate
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment