Menu

Error message while MATLAB COM interfacing

Beginners
2017-11-05
2019-06-07
  • Ranjan Raj Gurung

    Hello sir,

    I just began to COM interfacing in MATLAB to control my openDSS results with some looping function in MATLAB.
    An error message comes while running as:

    301(opendss)
    "you must create a new circuit object first: new circuit.mycircuitname to execute this command"

    I acknowledge the message for several times and at command window, there comes like this:

    DSSText =

    Interface.OpenDSS_Engine.IText
    

    What may be the problem ?
    Thank you

     
  • Roger Dugan

    Roger Dugan - 2017-11-06

    The error message indicates your script tried to do something that requires the circuit to be created first with the New Circuit.circuitname command.

    Check the scope of your loop to make sure it is doing what you think it should be doing.

     
    • Danula Balasooriya

      How did you solve the problem ?? I'm getting the same one & i can not find why

       
  • Ranjan Raj Gurung

    Thank you sir,
    I have given the circuit name to the openDSS script when I wrote it in standalone mode and it executes successfully. Now I want to interface the openDSS with MATLAB through same script.
    Should I again create the circuit name for the same script? If I need to create, then where should I create it?
    This may be very easy for you but I am not able to move forward with my purpose of controlling the circiut with MATLAB. I have attached the matlab window also.
    Thank you very much

     
  • Ranjan Raj Gurung

    Dear Roger,
    I found it myself. I learnt that the best way to debug the error is to do hit and trial with some relevant steps :).
    Thank you very much

     
  • Roger Dugan

    Roger Dugan - 2017-11-07

    Yes, good advice. Novice users seem reluctant to try different things, either not wanting to make a mistake or afraid of breaking the program. I would be surprised if you could break it permanently. So just try it. This way you learn how the program responds.

     
  • Ranjan Raj Gurung

    Hello,

    I want to apply for loop or any so that I can store information about Voltage and Power at each step of 1 hour for 1 year. Is that possible to do a loop where I can store voltage and power value in each stepsize as I have to control those values ?
    Thank You

     
  • Roger Dugan

    Roger Dugan - 2017-11-07

    Of course. There is no looping in OpenDSS scripting language so you have to do that from MATLAB. I would Set Mode=Yearly Number=1 so that the program executes one time step for each time the Solve function is invoked. Then your control algorithm can interact with the system elements between Solve commands.

    Use Monitor elements to capture the quantities of interest. This will happen automatically in Yearly mode. Then you can get the results at the end of the simulation.

     
  • Ranjan Raj Gurung

    Thank you Roger,
    I tried it and ran the simulation but it is too slow. It takes 8.856 s for 100 h simulation. Is it like this or something need to be done? please suggest.

     
  • Roger Dugan

    Roger Dugan - 2017-11-07

    You are right that MATLAB driving the OpenDSS COM interface will typically be slow for this operation. Python can be faster and, of course, C++, Delphi, and even Excel VBA will run at almost natively-compiled code speed through the COM interface. The DirectDLL interface is a bit faster.

    To run as fast as possible, you would need to build in a control model into OpenDSS. You can build OpenDSS with the Free Pascal Compiler if you don't have Delphi.

    Also -- and we do this often -- if you can emulate the impact of your load control with a LoadShape object, this will run quite efficiently for a Yearly-mode simulation.

     

Log in to post a comment.

MongoDB Logo MongoDB