# D'abord modifier les option de simulation pour la question 1 puis remetre les options en 'yes' pour les autres questions# "Model Inputs", "Global parameters", "General parameters", "Simulation options" and desactivate "Nitrogen stress activation" and "Water stress activation"#A basic USM for each crop is available (spring barley, spring wheat and spring field pea).file <-file.path(paste0(workspace, "/usms.xml"))# get_param_xml(file)
The tec file
Use the standard cropping practices you are provided with (Excel file) to create the .tec file of each crop by modifying the base technical file (ORIGINAL_tec). Months are given for dates of practices, choose the days as you wish.
Choose a year among 2011 to 2020 as you wish and define the climate files for the USM. Since all crops are spring crops requiring a winter soil preparation the preceding year, you must choose two successive years for your simulations (e.g. for a crop harvested in 2011, choose clima_RAIMAT2010 for the climate file of the first year, and clima_RAIMAT2011 for the climate file of the second year). Remember to report the years you have used when presenting your results.
# At 2011-06-30# df = filter(sim_all, Date == as.POSIXct("2011-06-30", tz = "UTC"))# df$Date = as.POSIXct("2011-06-30", tz = "UTC")# df[, c("situation","masec_n","mafruit", "Date")]# result = get_sim(workspace = workspace)# p <- plot(result)# print(p)# MODIFICATION DES OPTION EN YES
Question 2: Actual Yields Over 10 Years
Years: 2010 to 2020
Code
output_2 =c("masec_n","mafruit","totir","totapN","turfac","inn", "turfac1moy","turfac2moy","inn1moy","inn2moy","leaching_from_lev","leaching_from_plt","N_volatilisation")# Simulate the actual yields obtained over 10 years, analyse the potential causes of the variability,# in particular looking at yield components and environmental stresses; you can focus on one or two species out of the three.file <-file.path(paste0(workspace, "/usms.xml"))# get_param_xml(file)#I nned to know the second day of simulation file <-file.path(paste0(workspace, "/usms.xml")) aa <-get_param_xml(file)# aa$usms.xml$fclim1 # aa$usms.xml$fclim2 set_param_xml(file =file.path(workspace, "usms.xml"),param =c("fclim1"), values="clima_RAIMAT.2010", overwrite = T)set_param_xml(file =file.path(workspace, "usms.xml"),param =c("fclim2"), values="clima_RAIMAT.2020", overwrite = T)### SpringBarley_tec.xmlparam_df <-data.frame(tec_name="SpringBarley_tec.xml",julres=214,#Organic inputs supplyjultrav_1 =253, profres_1=10, proftrav_1=15, #Soil preparationjultrav_2 =375, profres_2=0, proftrav_2=10,# Second soil prepiplt0 =397, profsem =2.5, densitesem =350, variete =1, #SowingjulapN_or_sum_upvt =434, 'absolute_value/%'=60, engrais =5) #fertparam_df <-rename(param_df, 'absolute_value/%'="absolute_value..")### Modify the tec file using the data.framegen_tec_xml(param_df = param_df, file =file.path(workspace, "SpringBarley_tec.xml"), out_dir = workspace)# Generate the model input files (text files) from javaStics input files (XML files)gen_usms_xml2txt(javastics = javastics,out_dir = out_dir,workspace = workspace,usm=usm)#### run the USMs## define the model options model_options <-stics_wrapper_options(javastics = javastics, workspace = workspace,parallel =TRUE)## run the USMs as they are definedres_2 <-stics_wrapper(model_options = model_options, var=output_2, situation = usm)# plot(ori=res_2$sim_list,# var=c("mafruit","masec_n"))# # plot(ori=res_2$sim_list,# var=c("inns","turfac"))p <-plot(res_2$sim_list, overlap =list(list("mafruit","masec_n"),list("turfac1moy","inn1moy")),var =c("mafruit","masec_n", "inn1moy","turfac1moy"))p$SpringBarley