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!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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!
You have a couple more options:
Here is the help for the Export command:
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!