Apsim Next Gen can be used to do your normal functions as you would from the full version.
Copy the path to the Models.exe executable. If installed for all users, this is located at:
"C:\Program Files\APSIM<Version-number>\bin\Models.exe"
replace <version-number> with your current version number.
Use:
"C:\Program Files\APSIM<Version-number>\bin\Models.exe" --apply <configFileName.txt>
Note: Above command can only be used when load is the first command in the configFile.
or use:
"C:\Program Files\APSIM<Version-number>\bin\Models.exe" --apply <configFileName.txt>
Models
instead of typing the full file path to the Models.exe.A config file is simply a text file with a simple command on each line.
save C:\TestSims\wheatTest.apsimx
load C:\TestSims\wheatTest.apsimx
add [ParentNodeName] childNodeName
add [ParentNodeName] childNodeName Name
add [ParentNodeName] exampleApsimFile.apsimx;[nodeName]
add [ParentNodeName] exampleApsimFile.apsimx;[nodeName] Name
delete [ParentNodeName].childNodeName
copy [NodeName] [AnotherNodesName]
copy [NodeName] [AnotherNodesName] Name
duplicate [NodeName].ChildNodeName.ChildNodeName NewName
[Weather].FileName=Dalby.met
#
or /
# Makes a new apsimx file and builds it up to something that will run
# Dalby.met needs to be in C:\TestSims\
load C:\TestSims\minimalSim.apsimx
# Add various nodes to the Simulations node.
add [Simulations] Simulation
add [Simulations] Experiment
add [Simulation] Summary
add [Simulation] Clock
add [Simulation] Weather
# Change data in various nodes.
[Weather].FileName=Dalby.met
[Clock].Start=1900/01/01
[Clock].End=1900/01/31
# Makes a copy of the simulation named Simulation and moves it to the Experiment node named Experiment.
copy [Simulation] [Experiment]
# Duplicate the simulation in the experiment
duplicate [Experiment].Simulation
# Deletes the original Simulation.
delete [Simulations].Simulation
# Saves the Simulation to new file.
save C:\TestSims\newMinimalSim.apsimx
# Runs the simulation.
run
--log
switch.error
.Models.exe example.apsimx --log error
--in-memory-db
switch.Models.exe example.apsimx --in-memory-db
Models.exe --apply config-file.txt --in-memory-db
Models.exe example.apsimx --apply config-file.txt --in-memory-db
--apply
switch can be used in conjunction with the --batch
switch.An example where this would be useful is when you want to change the soil and weather for each individual APSIM file and you have 10s to 100s to 1000s of APSIM files.
To do this you will need two specific files along with any APSIM files you want to change, these files are:
A config file containing ‘placeholders’
$weather-file-name
.load BaseCl.apsimx
[Soil]=SoilLibrary.apsimx;[$soil-name]
[Weather].FileName=$weather-file-name
[SimulationExp].Name=$sim-name
run
A batch file, this is a csv file with headers that match the placeholders (minus the $ symbols)
soil-name | weather-file-name | sim-name |
---|---|---|
Ahiaruhe_1a1 | 16864.met | Sim0001 |
Ahuriri_7a1 | 19479.met | Sim0002 |
Ailsa_5a1 | 19479.met | Sim0003 |
To run this we would run something like: "C:\Program Files\APSIM<your version number>\bin\Models.exe" --apply config-file-name.txt --batch batch-file-name.csv