Bulk CSV Exports

  • dagoski
  • Topic Author
More
20 Feb 2017 00:24 #5160 by dagoski
Bulk CSV Exports was created by dagoski
I have a mess of projects I'm modeling. I would like to export the summary, monthly, and annual data tables to csv for all the projects in bulk. All in one go instead of going from project to project and exporting each one by hand. Is it possible to script this in SAM? In case anyone's curious, I'm working up evaluations for several parcels of land in a small city. I want to get this all into something like R or Excel. I'm using R to make some prettier plots than SAM can do. Excel makes it easier to format tables for insertion into a written report.

Please Log in or Create an account to join the conversation.

  • pgilman
More
20 Feb 2017 10:37 #5161 by pgilman
Replied by pgilman on topic Bulk CSV Exports
Hello,

SAM's LK scripting language has functions exporting data that might be useful, but that works from within a project (.sam) file. If the files for each project are the same except for a few input variables, it would be fairly straight forward to create a case in a SAM file and then write a script to run each project and export results to a CSV file. The pseudocode would look something like

For each project:
Set value of inputs.
Run a simulation.
Write results to CSV file.

You could also write a program or script in C, Python, Java, or one of the other languages supported by the SAM Software Development Kit (SDK) to run the simulations and write the data to CSV without using the desktop version of SAM. The desktop version of SAM includes a code generator that you can use to generate code for the SDK from a case in SAM -- that way you can set up a project in SAM, generate the code, and then modify it to make the model runs you need.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • stumpyd123
More
20 Mar 2017 05:29 #5162 by stumpyd123
Replied by stumpyd123 on topic Bulk CSV Exports
Dagoski,

Did you ever make any progress with this? I have a similar project with 15 to 20 buildings that this would be really handy on. I have been learning Python and would be happy to contribute towards a shared script.

Cheers,
David

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum