1 / 14

Running in

Running in. Peter Gould, Pacific Northwest Research Station Growth-Model User Group Meeting, June 2, 2010. Acknowledgements. I “borrowed” previous work on the implementation of the ORGANON dlls in Excel from Mark Hanus and Sean Garber .

Download Presentation

Running in

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Running in Peter Gould, Pacific Northwest Research Station Growth-Model User Group Meeting, June 2, 2010

  2. Acknowledgements I “borrowed” previous work on the implementation of the ORGANON dlls in Excel from Mark Hanus and Sean Garber. Mark Hanus helped troubleshoot problems with ORGANON8.4. David Hann and other ORGANON developers for providing DLLs.

  3. Why run ORGANON in R? R users don’t need to switch environments or interfaces to run different programs (on cutting and pasting). Can combine projections and summaries. Can automate processing (1 or 100,000 stands).

  4. How to connect to ORGANON DLL (Dynamic-Link Library): a program that can be called by another program. Often used to create, manipulate, and update variables. ORGANON has three dlls: ORGVOL.dll ORGEDIT.dll ORGRUN.dll

  5. Can we call the dlls directly from R? (Yes, in theory) Should I be worried? R sees the dll! R sees the functions in the dll!! R CRASHES!!!

  6. Alternative Approach • ORGANON can be run in MS EXCEL using the dlls. • Mark Hanus did the original coding in VB. • Sean Garber added more features • I updated it for Version 8.4 (with help from Mark Hanus) and added features for input/output. • R can control EXCEL using the rcom package (Thomas Baier (2008). rcom: R COM Client Interface and internal COM Server. R package version 2.0-4.) • runOrg8.4 runs ORGANON via EXCEL.

  7. What do you need? ORGANON DLLs and RUN_ORGANON8.4.xls need to be installed in: C:\Program Files\ORGANON\DLL R needs to be installed (I’m using version 2.9.1) AND the rcom package. Excel need to be installed and macros enabled (I’m using Excel2007). The runOrg8.4 function needs to be loaded.

  8. Tree list (use the exact variable names) Input Formats Optional: HT, CR

  9. Header info (use the exact variable names) Input Formats • Optional: USEGEN, DBHGAIN, HTGAIN, USESNC, RETAINYRS.

  10. Process for runOrg8.4 Opens the Excel workbook (set to be invisible). Loops through the stands Updates header information Pastes the input treelist into the worksheet Runs ORGEDIT (adds heights, crown ratios, etc.) Runs ORGRUN (the actual projections) Copies output back to R Closes Excel and returns to R

  11. Run the function and output

  12. Example: Two stands, 30 plots / stand , 10 trees / plot, projected for 10 cycles (50 yrs). Elapse time: 5.5 seconds

  13. The Excel Workbook Double-click above to open and then save with this name and path: C:\Program Files\ORGANON\DLL\RUN_ORGANON8.4.xls Use Excel1997-2003 format.

  14. The R Code (double-click below to open)

More Related