Piecewise function for Wind Turbine Generation

Hello guys, please I am trying to implement this any help will be great.Screenshot 2021-09-21 111740

There is too little information here to help. What have you tried so far?

1 Like
for t in T
   if v(t)>= 0.
       if v(t)< vi*v(t)
       Pwt = 0.
       elseif  v(t) >= vi
                  if  v(t) <= vr
                      Pwt == ((v(t)^3- vi^3)/(vr^3- 
                      vi^3))*Pr
                 end
       elseif v(t) >= vr
             if v(t) <= vo
                Pwt == Pr
             end
       end 
   else 
         Pwt=0
   end
end

I tried to run this code but it doesn’t seem to work. What is v and T, Pwt etc?

You need to combine your range comparisons in single if conditions instead of nesting ifs. You’ve got situations where the correct branch is never taken and others where Pwt is never calculated.

BTW, posting a question like this in the new to Julia category may get more exposure.