Source code

The Decision Support System for Agrotechnology Transfer (DSSAT) Version is a software application program that comprises crop simulation models for over 42 crops. The most recent version is v4.8.2 (Check latest RELEASE here). For DSSAT to be functional it is supported by data base management programs for soil, weather, and crop management and experimental data, and by utilities and application programs. The crop simulation models simulate growth, development, and yield as a function of the soil-plant-atmosphere dynamics.

Questions about usage of DSSAT ecosystem [contact us].

Do not know how to use DSSAT? Consider participating the [upcoming DSSAT training workshop]

 

How to get the source code?

The most recent version of the dssat-csm-os can be found here (Check latest source code here). Download/Clone from the GitHub website the source code in a directory of your choice the “dssat-csm-os” folder

Dashboard to download the dssat-csm-os repository from GitHub.

Click on “Download Zip”and unzip the folder into your machine after downloading or Git Clone using the “URL”.

The directory structure

DSSAT cropping system model (CSM) design is a modular structure in which components separate along scientific discipline lines and are structured to allow easy replacement or addition of modules. It has one Soil module, a Crop Template module which can simulate different crops by defining species input files, an interface to add individual crop models if they have the same design and interface, a weather module, and a module for dealing with competition for light and water among the soil, plants, and atmosphere. It is also designed for incorporation into various application packages, ranging from those that help researchers adapt and test the CSM to those that operate the DSSAT /CSM to simulate production over time and space for different purposes.

Directory structure of dssat-csm-os
 

How to compile the source code?

First, select your operational system (MacOS, Linux, Windows) and jump to the right section to download the tools needed for each platform.

Link for the installer of the tools:  https://drive.google.com/drive/folders/1ykZ0RIsDW2OU4NxMaK-eKb9DCGJgarO4

 

Windows:

STEP 1 – Install CMake to create the build project

Run the file cmake-3.29.0-rc3.windows-x86_64.msi in your machine. Follow the standard instructions: Next -> Accept Terms -> Next -> Next -> Next -> Install. Done!

STEP 2 – Install Visual Studio Integrated IDE

Run the file VisualStudioSetup.exe in your machine. Follow the instructions: Continue -> Wait Visual Studio installer get ready -> Scroll down the screen and find “Desktop & Mobile”tools -> Select “Desktop development with C++ & Universal Windows Platform development”-> Install -> OK -> Close ‘X’ Visual Studio Installer.

Step of the Visual Studio installation to make sure WindowsSDK will be installed.

STEP 3 – Install Intel IFort

Run the file w_fortran-compiler_p_2024.0.2.27_offline.exe in your machine (IMPORTANT, if you installed Ifort before Visual Studio, you should uninstall IFort and install Visual Studio before). Follow the instructions: Extract -> Continue -> Accept the terms of the license -> Customize installation -> Hit “->” -> I do NOT consent to the collection of my information -> Install -> Finish

Step of Intel Ifort installation to integrate with Visual Studio

STEP 4 – Using CMake to create the build for the project

CMake is a tool to make it easy the creation of the Visual Studio project. There are two path’s to include in the configuration. 

First is “Where is the source code”, click on the right “Browse Source” and look for your source code downloaded (dssat-csm-os directory). Note that you may have a different name and this is just fine too. Select folder. 

Second is “Where to build the binaries”. For this part, the good practice is, copy the path from the previous step and add in the end “/build”. Done.

Third, click on “Configure”, if it is the first time it will show a message to create the “build” folder, click “Yes”.

Fourth, check the field “specify the generator for this project” is “Visual Studio 17 2022”. If not, click in the drop-down menu and find the correct Visual Studio installation.

Click Finish.

Wait about 5 minutes to create all the project for Visual Studio.

Look for a message in the bottom screen that shows: 

Screenshot of CMake after Configuration and Generate.

Click on “Generate”.

IMPORTANT NOTE: This creation of the project is only made once to create the Visual Studio project. This will not give you an executable of the DSSAT-CSM or anything related. This should be done every time you change the location of your “dssat-csm-os” directory on your machine or is wants to create a project for Visual Studio from scratch.

Close ‘X’ CMake.

STEP 5 – Opening Visual Studio project and compiling the solution

Visual Studio is your integrated development environment (IDE). Here is the place where you will make changes to the source code, compile and generate and executable to run the DSSAT-CSM.

Open your “dssat-csm-os” directory and look for the “build” folder. Open the build folder and look for the file called “DSSAT-CSM.sln”. Double click to open this file (How do you want to open this file message -> Always use Visual Studio to open .sln files). This will open automatically Visual Studio with your DSSAT-CSM project loaded on.

Screenshot of the file explorer showing the content of the build folder after CMake to locate and open the DSSAT-CSM.sln file.

Skyp “Sign in” for now if it is your first time opening Visual Studio and Create a Microsoft account later to use unlimited and then Start Visual Studio.

On the top Menu of Visual Studio there is a drop-down menu called “Build”. Click there and “Build Solution”. In the output (Bottom screen) you will see the Intel IFort compiling every Fortran file that is located on the right panel under “Solution Explorer”. Wait for a message similar or without fails:

======== Build: 3 succeeded, 0 failed, 0 up-to-date, 1 skipped ========

======== Build: completed at …

To open the source code files, click on the right panel “Solution Explore” to expand “dscsm048(IFORT)”. You will see the folder with the source code. Double click in the *.for/f90 files and the source will appear on the main screen.

STEP 6 – Finding the executable

After succeed in all the previous steps and finished a complete build. Open your “dssat-csm-os” directory and look for the build -> bin -> Debug -> dscsm048.exe.

The dscsm048.exe is the executable that you can run the crop models with your changes. To use the executable you can rename the current C:\DSSAT48\DSCSM048.EXE from the installation then copy and paste the dscsm048.exe in your C:\DSSAT48\ directory.


 

MacOS/Linux:

STEP 1 – Install CMake to create the build project

MacOS and Linux system are able to download using the package manager that comes with your system. For example, MacOS can use homebrew to install CMake.

STEP 2 – Install gfortran/GCC.

MacOS and Linux system are able to download using the package manager that comes with your system. For example, MacOS can use homebrew to install gcc (e.g https://formulae.brew.sh/formula/gcc#default).

$ brew install gcc

STEP 4 – Download the Data code from GitHub

The most recent version of the dssat-csm-data can be found here (Check latest source code here). Download/Clone from the GitHub website the data. Click on “Download Zip”and unzip the folder into your machine after downloading or Git Clone using the “URL”.

For MacOS users, copy the “Data” folder downloaded and paste and rename from “dssat-csm-data” to “DSSAT48”. Move the folder to “/Applications/” or any other place you feel prefer.

STEP 5 – Configuring the build

Navigate through command line to your “dssat-csm-os” directory. To do this, create a build/ directory at the top level of your project and build there. This folder is created to organize all working files inside it, avoiding messing up your source folder.

$ mkdir build

$ cd build

$ cmake .. -DCMAKE_INSTALL_PREFIX=/Applications/DSSAT48/ 

$ make install

Note that you just need to do the cmake and make install once. After created the build folder and generated the build use only “make”.

After compiling the target with 100% success. The executable will end up in “<source-code>/build/bin/dscsm048” folder.

STEP 6 – Using Visual Studio Code to modify code

Access and download Visual Studio code for your platform:

https://code.visualstudio.com/Download

In the top menu, click Open -> Open Folder and browse where is located your dssat-csm-os source code. You will see the left panel all the folders listed then you can open the *.for/f90 source code and start editing. Also, there are pre-defined tasks that you can open using Terminal -> Run Task and chose to “build DSSAT without debugging”. This will invoke the command line and do automatically the CMake and compiling process.

Visual Studio Code for MacOS and Linux.

 

How to cite DSSAT 

If you are planning to use DSSAT in any reports or publications, please make sure to refer to the version number you used. The version and sub-version numbers can be found in the top section of your output files, e.g., 4.8.X (replace X with current version). In addition, please use the following two references for DSSAT and the Cropping System Model. Other related publications can be found in the Documentation section under DSSAT References and Model References.

Hoogenboom, G., C.H. Porter, K.J. Boote, V. Shelia, P.W. Wilkens, U. Singh, J.W. White, S. Asseng, J.I. Lizaso, L.P. Moreno, W. Pavan, R. Ogoshi, L.A. Hunt, G.Y. Tsuji, and J.W. Jones. 2019. The DSSAT crop modeling ecosystem. In: p.173-216 [K.J. Boote, editor] Advances in Crop Modeling for a Sustainable Agriculture. Burleigh Dodds Science Publishing, Cambridge, United Kingdom (https://dx.doi.org/10.19103/AS.2019.0061.10).

See also: The DSSAT crop modeling ecosystem

Hoogenboom, G., C.H. Porter, V. Shelia, K.J. Boote, U. Singh, W. Pavan, F.A.A. Oliveira, L.P. Moreno-Cadena, T.B. Ferreira, J.W. White, J.I. Lizaso, D.N.L. Pequeno, B.A. Kimball, P.D. Alderman, K.R. Thorp, S.V. Cuadra, M.S. Vianna, F.J. Villalobos, W.D. Batchelor, S. Asseng, M.R. Jones, A. Hopf, H.B. Dias, L.A. Hunt, and J.W. Jones. 2023. Decision Support System for Agrotechnology Transfer (DSSAT) Version 4.8.2 (www.DSSAT.net). DSSAT Foundation, Gainesville, Florida, USA.

Jones, J.W., G. Hoogenboom, C.H. Porter, K.J. Boote, W.D. Batchelor, L.A. Hunt, P.W. Wilkens, U. Singh, A.J. Gijsman, and J.T. Ritchie. 2003. The DSSAT cropping system model. European Journal of Agronomy 18:235-265 (https://doi.org/10.1016/S1161-0301(02)00107-7).See also: The DSSAT cropping system model.