Your solution works great and is, I agree, much cleaner than mine. Thanks for the confirmation of the problem and good suggestion for a fix.
Trevor From: [email protected] [mailto:[email protected]] On Behalf Of Ray Zimmerman Sent: Thursday, September 05, 2013 11:04 AM To: MATPOWER discussion forum Subject: Re: Smartmarket limits definition Hi Trevor, Your suggestion is reasonable, but it seems there are a lot of places where the code checks for empty values of these limits and acts accordingly. I have replaced the line your reference in smartmkt.m with the following ... if isempty(mkt.lim.P.max_offer) price = NaN(ng, 1); else price = mkt.lim.P.max_offer * ones(ng, 1); end Hopefully, this will address the error you are seeing. Let me know if it does not. -- Ray Zimmerman Senior Research Associate B30 Warren Hall, Cornell University, Ithaca, NY 14853 phone: (607) 255-9645 On Aug 19, 2013, at 4:44 PM, "Hardy, Trevor" <[email protected]<mailto:[email protected]>> wrote: In my use of the smartmarket module, the particulars of my model result in a non-convergent system occasionally. In trying to make the error-handling in these cases more robust, I found that line 178 of the smartmarket is causing me problems: price = mkt.lim.P.max_offer * ones(ng, 1); This branch of the function is reached when the uopf function fails to converge and goes through the process of setting all the expected outputs to dummy values. In my case, I've found that mkt.lim.P.max_offer is a null value, thus causing problems. Somehow I got under the impression that the max_offer value was optional but clearly that is not the case for non-convergence. I can see that if the mkt.lim is empty, 'runmarket.m' calls 'pricelimits' (in pricelimimts.m) which calls 'fill_lim' (in the same file) which appears to assign null values to the necessary quantities. It seems like 'fill_lim' should actually be defining numeric values so that the error I'm experiencing is avoided. Am I understanding this correctly or have I missed something? Trevor
