Skip to content

gk-crop/Simplace.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplace

Build Status

Julia package to interact with the modeling framework Simplace

Introduction

This package provides methods to interact with the modelling framework Simplace - Scientific Impact assessment and Modelling PLatform for Advanced Crop and Ecosystem management. See www.simplace.net for more information on Simplace. Simplace is written in Java (and some parts in Scala) so one can access it from Julia via JavaCall package. The purpose of this package is to simplify the interaction between Julia and Simplace, by providing functions to:

  • initialize and configure Simplace
  • load a simulation (solution and project)
  • parameterize the simulation
  • run the simulation
  • get simulation output and convert it to formats suitable for Julia

Installing the Simplace Framework

For installing Simplace, please consult the webpage www.simplace.net. Notice that Simplace version 5.1, svn revision >=403 is required.

A brief guide to install Simplace:

  • If you don't have installed Java, please install an appropriate version of the (JRE or JDK) from openjdk.org or adoptium.net (recommended).
  • Get Simplace from www.simplace.net
  • Install the Simplace package in Julia:
julia> using Pkg; Pkg.add("Simplace")

If you encounter errors, make sure to install the package JavaCall.

Basic Usage

The usage of Simplace in Julia follows roughly this scheme:

  • init Simplace by providing the path to your simplace installation directory, your working directory and your outputs
  • open a Simplace project form a solution (and project) file
  • create a list of simulation parameters you want to change
  • create and run a Simulation
  • get the result from the simulation
  • convert the result to a Julia object (Dict())

Examples

Running a project

using Simplace

# directory where simplace is installed
installDir = "d:/simplace/"

# configure path and choose simulation setup (solution, project)
workDir = joinpath(installDir, "simplace_run/simulation/")
outputDir = joinpath(installDir, "simplace_run/output/")
sol = joinpath(workDir, "gk/solution/complete/Complete.sol.xml")
proj = joinpath(workDir, "gk/project/complete/CompleteSensitivity.proj.xml")

# initialise simplace
sh = initSimplace(installDir, workDir, outputDir)

sess = openProject(sh, sol, proj)
runProject(sh)
closeProject(sh)

Run a solution with changed parameters

using Simplace

# Directory where simplace is installed
installDir = "d:/simplace/"

workDir = joinpath(installDir, "simplace_run/simulation/")
outputDir = joinpath(installDir, "simplace_run/output/")
sol = joinpath(workDir, "gk/solution/complete/Complete.sol.xml")

# initialise simplace
sh = initSimplace(installDir, workDir, outputDir)

sess = openProject(sh, sol, "", Dict("enddate" => "1999-12-31"))

# create a simulation that starts in 1995 and set the light use efficiency parameter to 3.2
simid=createSimulation(sh, Dict("startdate" => "1995-01-01", "vBaseLUE" => 3.2))

setLogLevel("WARN")
runSimulations(sh)
setLogLevel("INFO")

closeProject(sh)

# fetch the result (java object) and convert it into a Julia Dict()
res = getResult(sh, "DIAGRAM_OUT", simid)
d = resultToDict(res)
print(d["AnthesisDate"])

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages