This is very strange … I can't see how that line can cause an error. Let's take
this off-list, since I'm guessing it's something specific to your installation.
Can you try the following:
1. Set a breakpoint at line 98 in have_fcn:
dbstop 98 have_fcn
2. Run your code again.
3. When it stops at the debug prompt, in the Matlab command window type the
following commands:
exist('fval')
exist('fval', 'var')
fval
TorF = exist('fval', 'var') && fval == 1
mpver
4. Send me the results off-list.
Thanks,
--
Ray Zimmerman
Senior Research Associate
419A Warren Hall, Cornell University, Ithaca, NY 14853
phone: (607) 255-9645
On Jan 2, 2013, at 7:41 PM, dian anggun trisnadi <[email protected]>
wrote:
> thanks Ray
> I just realize that 'fval' is part of "PSAT", then i remove that "PSAT" from
> my matlab path. and now i still have an error like this :
>
> MATPOWER Version 4.1, 14-Dec-2011 -- AC Optimal Power Flow
> ??? Undefined function or variable 'fval'.
>
> Error in ==> have_fcn at 98
> TorF = exist('fval', 'var') && fval == 1;
>
> Error in ==> opf_execute at 143
> if ~have_fcn('knitro')
>
> Error in ==> opf at 225
> [results, success, raw] = opf_execute(om, mpopt);
>
> Error in ==> runopf at 96
> [r, success] = opf(casedata, mpopt);
>
> what shoud i do now?
>
>
> 2013/1/2 Ray Zimmerman <[email protected]>
> It appears that you have a function named 'fval' in your Matlab path. This
> function is apparently being called instead of simply referencing the local
> variable named 'fval' (at line 98 in have_fcn.m). This seems strange, since I
> thought variables normally take precedence over functions. But, in any case,
> a function named 'fval' (not part of MATPOWER) is apparently being called and
> is causing the error.
>
> Hope this helps,
>
> Ray
>
> --
> Ray Zimmerman
> Senior Research Associate
> 419A Warren Hall, Cornell University, Ithaca, NY 14853
> phone: (607) 255-9645
>
>
>
>
> On Jan 1, 2013, at 2:40 AM, dian anggun trisnadi <[email protected]>
> wrote:
>
>> greeting
>>
>> hi!
>> my name is Dian, I'm a college student from Indonesia.
>>
>> i had an problem to run AC OPF using KNITRO threre an error like this when
>> i run "runopf.m"
>>
>> MATPOWER Version 4.1, 14-Dec-2011 -- AC Optimal Power Flow
>> ??? Input argument "co" is undefined.
>>
>> Error in ==> fval at 25
>> stringa = get(co,'String');
>>
>> Error in ==> have_fcn at 98
>> TorF = exist('fval', 'var') && fval == 1;
>>
>> Error in ==> opf_execute at 143
>> if ~have_fcn('knitro')
>>
>> Error in ==> opf at 225
>> [results, success, raw] = opf_execute(om, mpopt);
>>
>> Error in ==> runopf at 96
>> [r, success] = opf(casedata, mpopt);
>>
>> what i suppose to do to solve this problem?
>> I'm sure the KNITRO had no problem, because when i run example file from
>> KNITRO there are no error found.
>>
>> nb : I'm using windows 7, Knitro v8, and Matlab 2010a
>>
>> thanks, Dian
>
>