Getting Started - Netbeans and the OMS Console #17095/HEAD / v10 |
Tags:
not added yet
Getting Started - Netbeans and the OMS ConsoleDeveloping OMS models requires an integrated development environment (IDE) tool and the OMS Console. Modelers have some flexibility in the choice of their IDE tool, but for this training the Netbeans IDE should be used.The general approach to OMS modeling involves using the IDE to develop, compile, and debug source code written in supported languages (currently Java, FORTRAN, C, C++, and NetLogo), and to build a .jar file for OMS simulations. Then the modeler uses the OMS Console and domain specific lanaguage (DSL) elements to create and run simulations (test, simulate, calibrate, analyze).
System Requirements and Installing OMS on Your ComputerRefer to the OMS home page at http://oms.javaforge.com (a parent page to this one) for complete instructions for installing and running OMS on your computer. Download the latest version of OMS. Following is a summary of the steps involved.OMS InstallationPrerequisites
You need to set the JAVA_HOME environment variable, and let it point to your JDK install directory. See instructions in the FAQ accessed from the OMS home page on how to do it if you are not sure. Install
On its first execution the console will install required jar files and configuration files into HOME/.oms. Those files are being used to run models, and an IDE can use the jar files during model development.
Installing Netbeans and Creating a Project Workspace (EXERCISE 1)Instructions for installing MinGW and NetBeans in WindowsInstructions from Cheryl Porter as of 9/22/2011:1. Go to the SourceForge Download page for MinGW: http://sourceforge.net/projects/mingw/files/ 2. Near the top, click on the link for the latest version:
3. Save the file to a temporary directory. Double click on it to run it. 4. Select the Use pre-packaged repository catalogues button and click on Next >
5. In the Select Components box click on C++ (and Fortran Compiler if you want it!) and MinGW Developer Toolkit (to get make and debug !) and click Next > 6. Click on Install. Wait ~5 minutes for the .exe file to unpack and install. 7. Click on Finish. 8. Now you need to add C:\mingw\bin;C:\mingw\msys\1.0\bin to PATH:
9. Now download and install Netbeans: Go to http://netbeans.org/
10. Save the file into a temporary folder. Double click on it to install it.
11. You may have to install the Java Platform (JDK)
12. Start NetBeans: Start => Programs => NetBeans => NetBeans 7.0.1 13. Install plugin for C and C++ compilers.
14. Install subversion version control (for this workshop we will need it).
Setting Up a Project WorkspaceTo get started in Netbeans, modelers should open a basic OMS template project designed for the IDE, available from the OMS javaforge site, or adapt a previously developed project. The oms3.prj.csm project will be provided to training participants. Other project examples are available from the oms_examples directory (go to the SCM Repository tab at oms.javaforage.com).Although modelers do not have to use one of the oms3.prj.<prjname> templates or examples, they can avoid several configuration and set-up steps by using one. A template project provides both Netbeans and OMS configuration properties necessary for a successful OMS modeling experience. A project template should be extracted (if zipped) and/or copied to a directory of the modeler's choice. The basic oms3.prj.template provides the folder stucture displayed in the graphic below. Starting out, the folder name oms3.prj.template should be changed by replacing "template" with a suitable name, for example, the workshop training project is oms3.prj.csm ("csm" an acronym for crop simulation model).
Using Netbeans, the modeler should open the template project via File>Open Project. A snapshot of the Netbeans user interface follows, displaying the folders and files for a mock-up oms3.prj.csm.
As the modeler develops and compiles source code, Netbeans will add the build and dist folders to the project to contain the build products. Source code is saved in the src folder.
Simulations developed with the OMS Console are saved in the simulation folder. Data files for simulation are placed in the data folder. Simulation output files in the output folder. Auto-documentation also is saved to the output folder. Other relevant documentation is kept in the docs folder.
Using the OMS Console (EXERCISE 2)The OMS Console has three primary user interfaces: (1) simulation, (2) parameter editor, and (3) analysis output.OMS Console - SimulationThe OMS Modeling Console is a graphical user interface (GUI) for the OMS development platform. It provides simple access to core features, such as simulation management, output analysis, and documentation generation. Using the Console is just one way to interact with OMS. As open source software, modeling communities can integrate OMS system components into their own IDEs or custom model development applications.The main purpose of the OMS Console is to allow a modeler a straightforward and simple tool to develop a model, create a simulation, run the simulation, provide for parameter editing and offer ad-hoc post run analysis and visualization. The figures below provide an overview of the OMS Console.
The Console's principal UI is shown in the figure above. Several buttons and layout features are familiar standard elements. The UI is organized as follows: Working DirectoryThe working directory sets the base directory and system property oms3.work for a simulation. It defines a workspace for the simulation. If this folder contains the file oms3.conf, its content gets loaded and applied for all simulation. For example if the file oms3.conf contains a list of open files, they will be opened after setting this directory. The directory can be set using the button next to the directory name.Simulation TabsEach tab contains one simulation script, tool bar, and associated console output. The console might have multiple simulations open at one time, however they must originate from the same workspace. Each simulation tabs operates independent from each other, means you can execute one simulation, while editing another one in a different tab.ToolbarsThe console has two tool bars. A global tool bar manages a set of simulations. In addition, each simulation has its own tool bar, allowing for different operations such as executing, documenting, etc. a simulation. The tool bar action are explained in detail below.EditorThe simulation editor allows creating and editing a simulation file.Console OutputThis read only output area, shows all standard and error output from the simulation run. Users select the appropriate tab to view the output.Status LineSome informative message during console use.Each simulation tab contains its own private tool bar. The tool bar actions are always directed towards the current simulation script in the editor. OMS Toolbar buttons are described as follows:
Each tab has a context menu that is accessible with a right mouse click. It allows saving, saving under a different name, closing, and other operations with respect to the selected tab. OMS Console - Parameter EditorThe Parameter Editor is a visual tool for parameter editing that is embedded in the OMS console. It can be started by clicking on the appropriate button in the tool bar of a simulation tab. It allows for a presentation and filtering of parameter values, bulk editing of values, statistics, and basic spread sheet like operations.The editor works on parameter files that adhere to the OMS CSV parameter file format. Such files can be easily edited with other external tools such as Excel, however the parameter editor provides an easy to use interface to manipulate parameter values numerically. Note that only parameter files referenced as properties in the model parameter sub-element in a simulation using the .. parameter(file:'<name>') ... construct can be loaded into the Parameter Editor. Parameters and parameter files referenced as sub-elements of the parameter sub-element, that is, contained within curly brackets "{...}" cannot be loaded into the Parameter Editor.
The figure above shows the Parameter Editor with loaded parameters. The layout of the window is organized as follows. Parameter FileThis combo box shows the active parameter file for editing. When opened the combo box lists all parameter files as specified within parentheses of the parameter sub-element. The modeler should select the parameter file to view and edit.FilterThe Filter combo box allows switching views on the parameters in the selected file. They can be filtered by dimension, by scalars, or all parameters can be presented as shown in this figure. Changing the filter will cause different parameters sets to diplay in the Parameter Editor panel.Command ConsoleThe command line on this console allows the (bulk) manipulation of parameter data. This command line has a history, a help function and offers more powerful methods of editing parameter values. This will be demonstrated in more detail during the workshop.Parameter Editor PanelThis table shows the parameter names and values. The layout might change when different filter are applied. It has in-place editing capabilities, by clicking on a cell, it value can be edited and changed.
The figure above shows the parameter editor with an applied dimension filter. The table presents all parameters bound to a specific dimension. Selecting cells in the table will print basic statistics about those on the bottom of the window. Any area can be selected, a column selection will print statistics about the whole column at the bottom of the editor.
OMS Console - Analysis OutputThe Analysis Output window graphically displays output defined in the analysis section of a simulation. It is executed by pressing the Analysis Button in the tool bar in a simulation tab. The following graphic shows a time series plot of simulated streamflow (red), observed runoff (green), and the difference between the simulated and observed values.
The tile bar shows the output folder containing the analysis data. Depending on the setting in <outputstrategy>, such output can be versioned or unversioned. With either setting, the last output folder of a simulation run is presented. The analysis tabs contain the plots, graphs, and charts, such as timeseries, error, scatter, flowduration, and other analyses. The tab name reflects the analysis performed. A part of the analysis section used to create the plots above is shown below. ... analysis(title:"Simulation Output") { timeseries(title:"East Fork Carson", view: COMBINED) { x(file:"%last/out1.csv", column:"date") y(file:"%last/out1.csv", column:"basin_cfs") calc(eq:"simulated - observed") { simulated(file:"%last/out1.csv", column:"basin_cfs") observed(file:"%last/out1.csv", column:"runoff[0]") } y(file:"%last/out1.csv", column:"runoff[0]") } timeseries(title:"Error", view: MULTI ) { ... Note the timeseries sub-element of analysis maps to the view of the plot graph above. Note the variable %last references the last output folder of a simulation run. The plot contains three y axes, one of which involves the calculation of simulated minus observed values. To reiterate, the Analysis Output window displays graphics only if the analysis DSL element is specified in the simulation file. |
Navigation Bar for Object Modeling System
Resources:
Downloads You must login to see this link. Register now, if you have no user account yet. OMS API Javadoc Publications & Presentations Annotation Reference DSL Reference Handbook 3.0 (Draft) Frequently Asked Questions (FAQ) OMS License (LGPL 2.1) New Users: 1. Get an ALM account 2. Join the OMS project Contact Us: Jack Carlson Coordinator, OMS Laboratory OMS Laboratory Jack.Carlson@colostate.edu (970) 492-7323 Olaf David Director, OMS Laboratory odavid (at) colostate.edu (970) 491-8026 |