Menu

set export monitor directory

Beginners
hamid
2018-06-14
2018-06-14
  • hamid

    hamid - 2018-06-14

    Hello,

    I wonder how can I set the directory for exported csv files of monitor?
    I'm using text interface in python script like this:

    engine = win32com.client.Dispatch("OpenDSSEngine.DSS")
    engine.Start("0")
    engine.ClearAll()

    .... some codes and redirects....

    New monitor.load_voltage element=Load.load_A mode=3
    engine.Text.Command = 'solve'
    engine.Text.Command = 'export monitor load_voltage'

    but the directory in which the results go is completely different than where the monitor dss file is, and I can see that trying :

    engine.ActiveCircuit.Monitors.FileName

    but how can I set this directory and why it is going somewhere else?

    Thanks in advance.

     
  • Celso Rocha

    Celso Rocha - 2018-06-14

    Hi Hamid!

    You can set the directory for the exported files through the global parameter "datapath".
    For example, if you want to export your monitors to a directory called "MyFolder" in your desktop, you should use something similar to set datapath = "C:\Users\celso\Desktop\MyFolder" through the text interface before the "export" command.
    You can also set it through the property "DataPath", member of OpenDSSengine.DSS. In this case, you should use engine.DataPath = "C:\Users\celso\Desktop\MyFolder"

    I hope it helps!
    All the best!

     
  • Roger Dugan

    Roger Dugan - 2018-06-14

    You have a couple more options:

    1. Use the CD command to change the default directory.
    2. Add the full path name or relative path name to the Export command rather than taking the default export file name.

    Here is the help for the Export command:

    Export various solution values to CSV (or XML) files for import into other programs. Creates a new file except for Energymeter and Generator objects, for which the results for each device of this class are APPENDED to the CSV File. You may export to a specific file by specifying the file name as the LAST parameter on the line. For example:
    
      Export Voltage Myvoltagefile.CSV
    
    Otherwise, the default file names shown in the Export help are used. For Energymeter and Generator, specifying the switch "/multiple" (or /m) for the file name will cause a separate file to be written for each meter or generator. The default is for a single file containing all elements.
    
    May be abreviated Export V, Export C, etc.  Default is "V" for voltages. If Set ShowExport=Yes, the output file will be automatically displayed in the default editor. Otherwise, you must open the file separately. The name appears in the Result window.
    
     
  • hamid

    hamid - 2018-06-14

    Thanks a lot to Celso and Roger, I made it. I tried this solution:

    engine.Datapath = r'C:\my_directory\results'
    engine.Text.Command = 'export monitor load_voltage'

    and it works as I wished!

     

Log in to post a comment.

MongoDB Logo MongoDB