view test-data/input/example_01/farmer-pl.txt @ 0:50112d3941d8 draft

"planemo upload for repository https://forgemia.inra.fr/insilicow/insilicow-tool commit a01dd8fc54d5015e703722d7acb8db4b54b4a468"
author siwaa
date Mon, 07 Apr 2025 15:18:25 +0000
parents
children
line wrap: on
line source

#################################################################################################################
#                                                                                                               #
#	InSiliCow: Farm Management                                                                              #
#                                                                                                               #
#################################################################################################################

#################################################################################################################
#====== Preprocessor: specification of included files                                                           #
#################################################################################################################

@include farmer-log.txt
# provides the action log_olivier
# call the action log_olivier every hour

#################################################################################################################
#====== Initialization of simulation										#
#################################################################################################################

#______ Simulation time range

init{
  begin_date  = 1970-01-01 00:00:00 # 1970-01-01 00:00:00
  end_date    = $end_year$-12-31 23:59:59   # 1975-02-20 23:59:59
  output_db   = events.sqlite
  name        = $sim_id$
}

#______ Models 

param_general{
	garuns_type   = garuns_olivier
	rpm_type      = rpm_lite
	abortion_type = abortion_olivier	
}

#______ Stoechio
stoechio{

}

################################################################################################################# 
#====== Genetic Scaling Parameters (GSP): defines individual cow performance                                    #
#														#
#======> in GARUNS model											#
#GSP	  (unit)	: Name					Default 	  | Proxy for			#
#WM 	  (Kg)		: Mature non labile body mass		450     ± 25      | Format 			#
#khi_M    (%)		: Target labile:non-labile mass ratio 	  0.33  ±  0.03   | Body fatness		#
#b0       (1/d)	: Reserves storage rate 		  1.6   ±  0.16   | Reserve lability		#
#nu_X     (-)		: Labile body mass mobilization index	  1.0   ±  0.1    | Maternal investment	#
#nu_Y     (-)		: Milk yield index			  1.0   ±  0.1	  | Milk potential		#  
#nu_F     (-)		: Milk fat secretion index		  1.00  ±  0.02   | Milk fat content		#
#nu_P     (-)		: Milk protein secretion index		  1.00  ±  0.02   | Milk protein content	#
#eD_star  (MJ ME/Kg DM) : Optimal diet energy content		 12.3   ±  0.5    | Energy intake capacity	#
#NDF_star (Kg NDF/Kg DM): Optimal fiber energy content		  0.5   ±  0.02   | Fiber intake capacity	#
#														#
#======> in RPM model                                   	                                                #
#nu_I     (-)		: Conception probability threshold        0.026 ±  0.007  | Fertility			#
#nu_B     (-)		: Puberty index			  1.70  ±  0.07   | Age at 1st ovulation	#
#nu_Z	  (-)		: Follicular dynamics rate		  1.00  ±  0.02   | Estrous duration		#
#################################################################################################################

################################################################################################################# 
#====== Transmission of Genetic Scaling Parameters (GSP)                                                        #
#     > genetic_sd defines the Mendelian sampling standard deviation for the calculation of the GSP of          #
#       a newborn calf : GSP_newborn ~ Normal [ (GSP_mother + GSP_father)/2 , GSP_sd ]                          #
#################################################################################################################

genetic_sd{

	garuns_olivier.WM{   
	  sd  = 50
	  min = 200
	  max = 800
	}
	
	garuns_olivier.khi_M {
	  sd  = 0.06
	  min = 0.1 
	  max = 0.6
	}
	
	garuns_olivier.b0{
	  sd  = 0
	  min = 0.80
	  max = 2.40
	}
	
	garuns_olivier.nu_X{
      	  sd  = 0
	  min = 0.2
	  max = 1.8
	}
	
	garuns_olivier.nu_Y{
	  sd  = 0.1
	  min = 0.2
	  max = 1.8
	}
	
	garuns_olivier.nu_F{
          sd  = 0
	  min = 0.50
	  max = 1.50
	}
	
	garuns_olivier.nu_P{
	  sd  = 0
	  min = 0.50
	  max = 1.50
	}

	garuns_olivier.eD_star{
	  sd  =  0
	  min =  9.0
	  max = 15.0
	}

	garuns_olivier.NDF_star{
	  sd  =  0
	  min =  0.10
	  max =  0.90
	}

	rpm_lite.nu_I{
	  sd  =  0.007
	  min =  0.00
	  max =  0.20
	}

	rpm_lite.nu_B{
	  sd  =  0.07
	  min =  1.20
	  max =  2.20
	}

	rpm_lite.nu_Z{
	  sd  =  0.02
	  min =  0.90
	  max =  1.10
	}
}

#################################################################################################################
#====== Initialization of cows  										#
#################################################################################################################

####### DEFAULT COW #############################################################################################
init_cow{
    name=cow_default
    
    ### ABORTION rules acording to days in pregnancy (dip)
    abortion_olivier.delta   = constant 3.0 	# days (compute every delta)
    abortion_olivier.enabled = sometime
					  	# never    : no abortion, 
       					# always   : always abort, 
       					# sometime : abort according to abortion_olivier.abo
						#		    and abortion_olivier.dip

    ### Days in pregnancy (dip) cutoffs (to cut gestation in early embryo, late embryo and fetal stages)
    #   Default intervals: 	Early embryo [0;17]	Late embryo [17;64]	Fetal [64;+inf]
    abortion_olivier.dip =  vector constant 17 ; constant 64 
    
    ### Daily probability of abortion for each intervals
    # 	Default probabiliies : E: 0.0230	L: 0.0096	F: 0.0004	
    abortion_olivier.abo = vector constant 0.02  ;  constant 0.005 ; constant 0.0004
    	
    ### GARUNS & RPM_lite Genetic Scaling Parameters
    #	Default constant values
    garuns_olivier.WM       =  constant 450		#450 
    garuns_olivier.khi_M    =  constant 0.30	#  0.33
    garuns_olivier.b0       =  constant 1.6		#  1.6
    garuns_olivier.nu_X     =  constant 1	#  1.0
    garuns_olivier.nu_Y     =  constant 1.1	#  1.0
    garuns_olivier.nu_F     =  constant 1	#  1.0
    garuns_olivier.nu_P     =  constant 1	#  1.0
    garuns_olivier.eD_star  =  constant 10.7	# 10.7
    garuns_olivier.NDF_star =  constant 0.5	#  0.5   
              rpm_lite.nu_B =  constant 1.7	#  1.7
    	      rpm_lite.nu_Z =  constant 1	#  1.0	
              rpm_lite.nu_I =  constant 0.025	#  0.026
}

####### RANDOM COW ##############################################################################################
init_cow{
    name=cow_random
    
    ### ABORTION rules acording to days in pregnancy (dip)
    abortion_olivier.delta   = constant 3.0 	# days (compute every delta)
    abortion_olivier.enabled = sometime
						# never    : no abortion, 
       					# always   : always abort, 
       					# sometime : abort according to abortion_olivier.abo
						#			    and abortion_olivier.dip

    ### Days in pregnancy (dip) cutoffs (to cut gestation in early embryo, late embryo and fetal stages)
    #   Default intervals: 	Early embryo [0;17]	Late embryo [17;64]	Fetal [64;+inf]
    abortion_olivier.dip =  vector constant 17 ; constant 64 
    
    ### Daily probability of abortion for each intervals
    # 	Default probabiliies : E: 0.0230	L: 0.0096	F: 0.0004	
    abortion_olivier.abo = vector constant 0.02  ;  constant 0.005 ; constant 0.0004
    	
    ### GARUNS & RPM_lite Genetic Scaling Parameters
    #	Random values
    garuns_olivier.WM       =  norm99 450 		50		#450 	 ± 25
    garuns_olivier.khi_M    =  norm99 0.30	0.06	#  0.33  ±  0.03
    garuns_olivier.b0       =  norm99 1.6 		0		#  1.6   ±  0.16
    garuns_olivier.nu_X     =  norm99 1		0	#  1.0   ±  0.10
    garuns_olivier.nu_Y     =  norm99 1.1 	0.1	#  1.0   ±  0.10
    garuns_olivier.nu_F     =  norm99 1		0	#  1.0   ±  0.02
    garuns_olivier.nu_P     =  norm99 1		0	#  1.0   ±  0.02 
    garuns_olivier.eD_star  =  norm99 10.7 	0	# 10.7   ±  0.5
    garuns_olivier.NDF_star =  norm99 0.5	0	#  0.5   ±  0.02 
              rpm_lite.nu_B =  norm99 1.7		0.07	#  1.7	 ±  0.07
    	      rpm_lite.nu_Z =  norm99 1		0.02	#  1.0	 ±  0.02
              rpm_lite.nu_I =  norm99 0.025		0.007	#  0.026 ±  0.007
}

#################################################################################################################
#====== Breeding    												#
#################################################################################################################

#______ Bull semen: quality = 0.95 ± 0.05 ; sexratio = 0  % female

breed{
  breed = bull_default
}

init_bull{
    name=semen_default
    bull.breed_name     = bull_default
    bull.semens_quality = norm99 0.95 0.05        # a number between 0.0 (=never works) and 1.0 (=perfect) 
    bull.female_ratio   = constant 0  	# offspring sex ratio. 1.0 = 100%female,  0.0=0%female   
}

#_______Breeding season: every year from *-03-21 00:00:00 to *-06-21 23:59:59

condition{
  type = chron_range
  name = breeding_season
  from = *-03-21 00:00:00     #*-03-21 00:00:00	
  to   = *-06-21 23:59:59       #*-06-21 23:59:59
}

trigger{
  type   = chron
  name   = breeding_start
  scheme = *-03-21 00:00:00 
}

# link{
#  trigger    = breeding_start
#  action     = log_db Start_breeding_season
#}

trigger{
  type   = chron
  name   = breeding_end
  scheme = *-06-21 23:59:59
}

#link{
#  trigger  = breeding_end
#  action   = log_db Stop_breeding_season
#}

#______ Estrous detection method ________________________________________________________________________________

estrous_detection_method{
  name=estrous_detection_default

  #When do we observe oestruses
  time_slice = 06:00:00 18:00:00 #00:00:01 23:59:59 

  #estrogene is transformed to an expression using a Hill function
  expression_threshold=0.75 #default 0.75
  expression_stiffness=7    #default 7


  #the oestrus worth an insemination if the memory function is above this threshold
  #THIS threshold is scaled for an observation all the day long
  #if you observe half a day multiply this threshold by 0.5
  #1.0 is a reasonable base value for all day observations
  detection_threshold=0.05  # 0.1

  #then, the oestrus is truely detected with a chance of
  sensitivity = 0.75 #0.7

  #then an average of wrong_oestrus_per_day are generated
  wrong_oestrus_per_day = 0 #0.00
}


#______ Insemination _________________________________________________________________________________

# Insemination is performed once a day when estrous is detected

state{
  state = ALREADY_INSEMINATED	 
}

trigger{
  type=custom
  name=tr_delete_ALREADY_INSEMINATED
}

link{
  trigger = tr_delete_ALREADY_INSEMINATED
  action = state_delete ALREADY_INSEMINATED
}

link{
  trigger   = estrous
  condition = is_in BREEDING
  condition = not is_pregnant
  condition = not is_in ALREADY_INSEMINATED
  action    = state_add ALREADY_INSEMINATED
  action    = trigger_later tr_delete_ALREADY_INSEMINATED 1
  action    = log_db 01_INSEMINATION
  action    = inseminate semen_default
}

#################################################################################################################
#====== Initialization of herd  										#
#################################################################################################################

trigger{
  type = custom
  name = init_day_01
}
trigger{
  type = custom
  name = init_day_02
}
trigger{
  type = custom
  name = init_day_03
}
trigger{
  type = custom
  name = init_day_04
}
trigger{
  type = custom
  name = init_day_05
}
trigger{
  type = custom
  name = init_day_06
}
trigger{
  type = custom
  name = init_day_07
}
trigger{
  type = custom
  name = init_day_08
}
trigger{
  type = custom
  name = init_day_09
}
trigger{
  type = custom
  name = init_day_10
}
trigger{
  type = custom
  name = init_day_11
}
trigger{
  type = custom
  name = init_day_12
}
trigger{
  type = custom
  name = init_day_13
}
trigger{
  type = custom
  name = init_day_14
}
trigger{
  type = custom
  name = init_day_15
}
trigger{
  type = custom
  name = init_day_16
}
trigger{
  type = custom
  name = init_day_17
}
trigger{
  type = custom
  name = init_day_18
}
trigger{
  type = custom
  name = init_day_19
}
trigger{
  type = custom
  name = init_day_20
}
trigger{
  type = custom
  name = init_day_21
}
trigger{
  type = custom
  name = init_day_22
}
trigger{
  type = custom
  name = init_day_23
}
trigger{
  type = custom
  name = init_day_24
}
trigger{
  type = custom
  name = init_day_25
}
trigger{
  type = custom
  name = init_day_26
}
trigger{
  type = custom
  name = init_day_27
}
trigger{
  type = custom
  name = init_day_28
}
trigger{
  type = custom
  name = init_day_29
}
trigger{
  type = custom
  name = init_day_30
}
trigger{
  type = custom
  name = init_day_31
}
trigger{
  type = custom
  name = init_day_32
}
trigger{
  type = custom
  name = init_day_33
}
trigger{
  type = custom
  name = init_day_34
}
trigger{
  type = custom
  name = init_day_35
}
trigger{
  type = custom
  name = init_day_36
}
trigger{
  type = custom
  name = init_day_37
}
trigger{
  type = custom
  name = init_day_38
}
trigger{
  type = custom
  name = init_day_39
}
trigger{
  type = custom
  name = init_day_40
}
trigger{
  type = custom
  name = init_day_41
}
trigger{
  type = custom
  name = init_day_42
}
trigger{
  type = custom
  name = init_day_43
}
trigger{
  type = custom
  name = init_day_44
}
trigger{
  type = custom
  name = init_day_45
}
trigger{
  type = custom
  name = init_day_46
}
trigger{
  type = custom
  name = init_day_47
}
trigger{
  type = custom
  name = init_day_48
}
trigger{
  type = custom
  name = init_day_49
}
trigger{
  type = custom
  name = init_day_50
}
trigger{
  type = custom
  name = init_day_51
}
trigger{
  type = custom
  name = init_day_52
}
trigger{
  type = custom
  name = init_day_53
}
trigger{
  type = custom
  name = init_day_54
}
trigger{
  type = custom
  name = init_day_55
}
trigger{
  type = custom
  name = init_day_56
}
trigger{
  type = custom
  name = init_day_57
}
trigger{
  type = custom
  name = init_day_58
}
trigger{
  type = custom
  name = init_day_59
}

link{
  trigger = init
  action  = buy_calf cow_random 1
  action  = log_db BUY_CALF_N=1
  action  = trigger_later init_day_01 1
}
link{
  trigger = init_day_01
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_02 1
}
link{
  trigger = init_day_02
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_03 1
}
link{
  trigger = init_day_03
  action  = buy_calf cow_random 8
  action  = log_db BUY_CALF_N=8
  action  = trigger_later init_day_04 1
}
link{
  trigger = init_day_04
  action  = buy_calf cow_random 8
  action  = log_db BUY_CALF_N=8
  action  = trigger_later init_day_05 1
}
link{
  trigger = init_day_05
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_06 1
}
link{
  trigger = init_day_06
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_07 1
}
link{
  trigger = init_day_07
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_08 1
}
link{
  trigger = init_day_08
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_09 1
}
link{
  trigger = init_day_09
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_10 1
}
link{
  trigger = init_day_10
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_11 1
}
link{
  trigger = init_day_11
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_12 1
}
link{
  trigger = init_day_12
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_13 1
}
link{
  trigger = init_day_13
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_14 1
}
link{
  trigger = init_day_14
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_15 1
}
link{
  trigger = init_day_15
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_16 1
}
link{
  trigger = init_day_16
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_17 1
}
link{
  trigger = init_day_17
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_18 1
}
link{
  trigger = init_day_18
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_19 1
}
link{
  trigger = init_day_19
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_20 1
}
link{
  trigger = init_day_20
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_21 1
}
link{
  trigger = init_day_21
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_22 1
}
link{
  trigger = init_day_22
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_23 1
}
link{
  trigger = init_day_23
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_24 1
}
link{
  trigger = init_day_24
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_25 1
}
link{
  trigger = init_day_25
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_26 1
}
link{
  trigger = init_day_26
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_27 1
}
link{
  trigger = init_day_27
  action  = buy_calf cow_random 12
  action  = log_db BUY_CALF_N=12
  action  = trigger_later init_day_28 1
}
link{
  trigger = init_day_28
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_29 1
}
link{
  trigger = init_day_29
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_30 1
}
link{
  trigger = init_day_30
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_31 1
}
link{
  trigger = init_day_31
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_32 1
}
link{
  trigger = init_day_32
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_33 1
}
link{
  trigger = init_day_33
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_34 1
}
link{
  trigger = init_day_34
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_35 1
}
link{
  trigger = init_day_35
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_36 1
}
link{
  trigger = init_day_36
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_37 1
}
link{
  trigger = init_day_37
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_38 1
}
link{
  trigger = init_day_38
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_39 1
}
link{
  trigger = init_day_39
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_40 1
}
link{
  trigger = init_day_40
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_41 1
}
link{
  trigger = init_day_41
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_42 1
}
link{
  trigger = init_day_42
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_43 1
}
link{
  trigger = init_day_43
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_44 1
}
link{
  trigger = init_day_44
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_45 1
}
link{
  trigger = init_day_45
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_46 1
}
link{
  trigger = init_day_46
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_47 1
}
link{
  trigger = init_day_47
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_48 1
}
link{
  trigger = init_day_48
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_49 1
}
link{
  trigger = init_day_49
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_50 1
}
link{
  trigger = init_day_50
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_51 1
}
link{
  trigger = init_day_51
  action  = buy_calf cow_random 8
  action  = log_db BUY_CALF_N=8
  action  = trigger_later init_day_52 1
}
link{
  trigger = init_day_52
  action  = buy_calf cow_random 4
  action  = log_db BUY_CALF_N=4
  action  = trigger_later init_day_53 1
}
link{
  trigger = init_day_53
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_54 1
}
link{
  trigger = init_day_54
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_55 1
}
link{
  trigger = init_day_55
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_56 1
}
link{
  trigger = init_day_56
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_57 1
}
link{
  trigger = init_day_57
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_58 1
}
link{
  trigger = init_day_58
  action  = buy_calf cow_random 0
  action  = log_db BUY_CALF_N=0
  action  = trigger_later init_day_59 1
}
link{
  trigger = init_day_59
  action  = buy_calf cow_random 25
  action  = log_db BUY_CALF_N=25
}

#################################################################################################################
#====== Management of herd	  										#
#################################################################################################################

#_______Predefined states : herd, heifers & mature ______________________________________________________________
#
# 	herd	: Every animal that enters the herd is added to this state. Male calves are never added.
#	heifers : Newborn female calves enter the herd as heifers, and are moved to not_heifers at 1st calving.	
#	mature	: Cows enter mature state when non-labile body mass W > 0.5 WM (GSP for mature format). 	


#################################################################################################################
#====== Remove cows @ end of simulation									#
#################################################################################################################

trigger{
  type   = chron
  name   = tr_end_simu
  scheme = 1985-12-31 23:59:58 
}

link{
  trigger = tr_end_simu
  action  = log_db action_remove_herd
  action  = remove_herd
}

action{
  type      = broadcast_now
  name      = remove_herd
  trigger   = tr_remove_herd
}

trigger{
  type    = custom
  name	  = tr_remove_herd
}

link{
  trigger  = tr_remove_herd
  action  = log_db delete_cow
  action   = delete_cow
}

#################################################################################################################
#====== Rearing    												#
#################################################################################################################

#_______CALF: heifers of age < 100 days

state{
  state = CALF	 
}

link{
  trigger    = enter heifers
  condition  = age < 100
  # action     = log_db heifers_to_CALF
  action      = state_move heifers CALF
}

link{
  trigger    = calving
  condition  = state_size CALF > 333
  action     = log_db REMOVE_CALF_to_limit_size 
  action     = delete_calf
 }

#_______HEIFER: heifers of age >= 100 days

state{
  state = HEIFER
}

link{
  trigger     = enter heifers
  condition  = age >= 100
  # action      = log_db heifers_to_HEIFER
  action      = state_move heifers HEIFER
}

link{
  trigger    = every_day
  condition  = age >= 100
  condition  = is_in CALF
  # action     = log_db CALF_to_HEIFER_@WEANING
  action     = state_move CALF HEIFER
}


#################################################################################################################
#====== Reproduction    											#
#################################################################################################################

#_______CYCLING: non-pregnant heifers at 1st ovulation or postabortive/postpartum recycling cows _____________

state{
  state = CYCLING
}

link{
  trigger     = ovulation
  condition   = is_in HEIFER
  # action      = log_db HEIFER_to_CYCLING_@PUBERTY
  action      = log_db 00_PUBERTY
  action      = state_move HEIFER CYCLING
}

link{
  trigger     = ovulation
  action      = log_db 00_OVULATION
}

#_______BREEDING: cycling heifers and cows during breeding season ______________________________________________

state{
  state = BREEDING
}

#During breeding season, not TO_CULL and CYCLING cows are moved to BREEDING  
link{
  trigger    = every_day
  condition  = breeding_season
  condition  = not is_in TO_CULL
  condition  = is_in CYCLING
  condition  = is_in mature
  # action     = log_db CYCLING_to_BREEDING
  action     = state_move CYCLING BREEDING
}

link{
  trigger = enter BREEDING
  # action  = log_db Start_estrous_detection 
  action  = estrous_start estrous_detection_default
}

link{
  trigger    = every_day
  condition  = not breeding_season
  condition  = is_in BREEDING
  # action     = log_db BREEDING_to_CYCLING
  action     = state_move BREEDING CYCLING
}

link{
  trigger = quit BREEDING
  # action  = log_db Stop_estrous_detection 
  action  = estrous_stop
}


#_______PREGNANT: at conception _________________________________________________________________________________

state{
  state = PREGNANT
}

link{
  trigger    = conception 
  action     = log_db 02_CONCEPTION
  action     = state_move BREEDING PREGNANT
}

#_______POST-ABORTIVE: triggered at abortion ____________________________________________________________________

state{
  state = POST-ABORTIVE
}

link{
  trigger    = abortion
  condition  = days_after_conception <= 17
  action     = log_db 03_EARLY_EMBRYO_DEATH
  action     = state_move PREGNANT CYCLING
}

link{
  trigger    = abortion
  condition  = days_after_conception > 17
  condition  = days_after_conception <= 64
  action     = log_db 04_LATE_EMBRYO_DEATH
  action     = state_move PREGNANT CYCLING
}

trigger{
  type = custom
  name = post_abortive_recycling
}

#Abortions after ] 64 - 210 days] days in pregnancy are managed with a voluntary period of 40 days   
link{
  trigger    = abortion
  condition  = days_after_conception >   64
  condition  = days_after_conception <= 210
  action     = log_db 05_FETAL_DEATH
  action     = state_move PREGNANT POST-ABORTIVE
  action     = trigger_later post_abortive_recycling 40
}

link{
  trigger = post_abortive_recycling
  # action  = log_db POST-ABORTIVE_to_CYCLING
  action  = state_move POST-ABORTIVE CYCLING
}

#Abortions after 210 days in pregnancy are managed by culling   
link{
  trigger    = abortion
  condition  = days_after_conception > 210
  action     = log_db 05_FETAL_DEATH
  action     = log_db TO_CULL_from_PREGNANT_after_late_fetal_death
  action     = state_move PREGNANT TO_CULL
}


#_______POSTPARTAL: triggered at parturition ____________________________________________________________________

state{
  state = POSTPARTAL
}

trigger{
  type = custom
  name = postpartal_recycling
}

link{
  trigger    = parturition
  action     = log_db 06_PARTURITION
  # action     = log_db PREGNANT_to_POSTPARTAL 
  action     = state_move PREGNANT POSTPARTAL
  action     = trigger_later postpartal_recycling 40
  action     = log_db start_milking
  action     = start_milking
 }

link{
  trigger = postpartal_recycling
  # action  = log_db POSTPARTAL_to_CYCLING
  action  = state_move POSTPARTAL CYCLING
}

#################################################################################################################
#====== Drying-off    												#
#################################################################################################################

#_______EXTENDED_LACTATION: CYCLING and is_milking after 305 days after calving 

state{
  state = EXTENDED_LACTATION
}

link{
  trigger    = every_day
  condition  = is_milking
  condition  = not is_in PREGNANT
  condition  = not is_in EXTENDED_LACTATION 
  condition  = days_after_calving >= 305
  # action     = log_db Extended lactation
  action     = state_add EXTENDED_LACTATION
}

#stop 300 days_after_calving if milk_yield <= 5 kg/d and not in EXTENDED_LACTATION
link{
  trigger   = every_day
  condition = is_milking
  condition  = not is_in EXTENDED_LACTATION
  condition = days_after_calving >= 300
  condition = milk_yield <= 5
  action   = log_db stop_milking
  action    = stop_milking
}

#stop 300 days_after_calving if milk_yield <= 5 kg/d and in EXTENDED_LACTATION
link{
  trigger   = every_day
  condition = is_milking
  condition  = is_in EXTENDED_LACTATION
  condition = days_after_calving >= 300
  condition = milk_yield <= 5
  action   = log_db stop_milking_extended
  action    = stop_milking
}

#stop 300 days_after_calving and 219 days_in_pregnancy
link{
  trigger   = every_day
  condition = is_milking
  condition = is_pregnant
  condition = days_after_calving >= 300
  condition = days_in_pregnancy >= 219
  action    = log_db stop_milking_pregnant
  action    = stop_milking
}

link{
  trigger = stop_milking
  trigger = enter PREGNANT
  condition = is_in EXTENDED_LACTATION
  action    = state_delete EXTENDED_LACTATION
}

#################################################################################################################
#====== Culling    												#
#################################################################################################################

#_______TO_CULL:  ____________________________________________________________________

state{
  state = TO_CULL
}

#______culling not pregnant nulliparous at age > 800 days
link{
  trigger    = every_day
  condition  = is_in CYCLING
  condition  = not is_in PREGNANT
  condition  = parity = 0
  condition  = age > 800
  action     = log_db TO_CULL_from_CYCLING_because_too_old_heifer
  action     = state_move CYCLING TO_CULL
}


#______culling not pregnant 320 days_after_calving
link{
  trigger    = every_day
  condition  = days_after_calving > 320
  condition  = is_in CYCLING
  action     = log_db TO_CULL_from_CYCLING_because_too_late_after_calving
  action     = state_move CYCLING TO_CULL
}

#______culling not pregnant after 7 insemination
link{
  trigger    = every_day
  condition  = is_in BREEDING
  condition  = not is_in ALREADY_INSEMINATED
  condition  = parity > 0
  condition  = num_insemination_lactation >= 7
  action     = log_db TO_CULL_from_BREEDING_max_nb_ins
  action     = state_move BREEDING TO_CULL
}

link{
  trigger = enter PREGNANT
  condition = is_in TO_CULL
  action    = state_move TO_CULL PREGNANT
}


#______culling oldest cow

link{
  trigger    = culling_day
  condition  = state_size TO_CULL = 999999
  condition  = state_size PREGNANT > 666
  #individual conditions, like not is_milking cannot be mixed wirh herd level triggers
  action     = log_db Seek_for_oldest_to_cull
  action     = cull_oldest
}

trigger{
  type = custom
  name = tr_cull_oldest
}

action{
  type      = broadcast_now
  name      = cull_oldest
  condition = not is_pregnant
  condition = not is_milking
  condition = not is_in HEIFER
  condition = not is_in CALF
  sortby    = age
  reverse   = yes
  limit     = 1
  trigger   = tr_cull_oldest
}

link{
  trigger = tr_cull_oldest
  action  = log_db remove_oldest
  action  = delete_cow
}


#______remove cows TO_CULL once a month on day 15th

trigger{
  type = custom
  name = tr_remove_cows_to_cull
}

link{
  trigger   = tr_remove_cows_to_cull
  condition = is_in TO_CULL
  condition = not is_milking
  condition = not is_pregnant
  action     = log_db Remove
  action    = delete_cow
}

trigger{
  type   = chron
  name   = culling_day
  scheme = *-*-15 14:00:00 
}

action{
  type = broadcast_now
  name = broadcast_TO_CULL
  condition = is_in TO_CULL
  trigger   = tr_remove_cows_to_cull 
}

link{
  trigger = culling_day
  action  = broadcast_TO_CULL
}


#################################################################################################################
#====== Feeding    												#
#################################################################################################################
#______optimal feeding for 999

state{
  state = CONTROL
}

link{
  trigger   = enter herd
  condition = state_size herd <= 999        #nb_control 0 - 999
  action    = change_food optimal
  action    = state_add CONTROL   #Cows are fed on optimal diet as a control
}

#______Default feeding rules

#################### > at birth: on calf diet
link{
    trigger   = enter CALF
    condition = not is_in CONTROL 
    action    = change_food calf_diet
}

#################### > at weaning: on heifer diet
link{
  trigger   = enter HEIFER
    condition = not is_in CONTROL 
    action    = change_food heifer_diet
}

#################### > at parturition: on lactation diet
link{
  trigger   = parturition
    condition = not is_in CONTROL 
  action    = change_food lactation_diet
}


#################### > at drying-off: on drycow_diet
link{
  trigger   = stop_milking
    condition = not is_in CONTROL 
  action    = change_food drycow_diet
}

#################### > OUTDOOR: on pasture diet
trigger{
  type      = chron
  name      = outdoor
  scheme    = *-04-01 00:00:00 
}

link{
  trigger = outdoor
  action  = broadcast_outdoor
}

action{
  type = broadcast_now
  name = broadcast_outdoor
  trigger   = outdoor_feeding 
}

trigger{
  type = custom
  name = outdoor_feeding
}

link{
  trigger   = outdoor_feeding
  condition = not is_in CALF
  condition = not is_in CONTROL
  action    = change_food pasture_diet
}


#################### > INDOOR: back to diet according to state
trigger{
  type      = chron
  name      = indoor
  scheme    = *-10-01 00:00:00 
}

link{
  trigger = indoor
  action  = broadcast_indoor
}

action{
  type = broadcast_now
  name = broadcast_indoor
  trigger   = indoor_feeding 
}

trigger{
  type = custom
  name = indoor_feeding
}

link{
  trigger   = indoor_feeding
  condition = is_in HEIFER
  condition = not is_in CONTROL
  action    = change_food heifer_diet
}

link{
  trigger   = indoor_feeding
  condition = is_in CYCLING
  condition = not is_in CONTROL
  action    = change_food heifer_diet
}

link{
  trigger   = indoor_feeding
  condition = is_in BREEDING
  condition = not is_milking
  condition = not is_in CONTROL
  action    = change_food heifer_diet
}

link{
  trigger   = indoor_feeding
  condition = not is_in BREEDING
  condition = not is_milking
  condition = not is_in CONTROL
  action    = change_food drycow_diet
}

link{
  trigger   = indoor_feeding
  condition = is_milking
  condition = not is_in CONTROL
  action    = change_food lactation_diet
}




#################################################################################################################
#====== Generic stuff												#
#################################################################################################################

trigger{
  type   = chron
  name   = every_day_herd
  scheme = *-*-* 12:00:00
}

trigger{
  type = custom
  name = every_day
}

link{
  trigger = every_day_herd
  action  = broadcast_now every_day
}

trigger{
  type = custom
  name = first_day_sub
}

trigger{
  type = custom
  name = first_day
}

link{
  trigger = init
  action  = trigger_later first_day_sub 0.001
}
link{
  trigger = first_day_sub
  action = broadcast_now first_day
}

#################################################################################################################
#====== Log													#
#################################################################################################################

log{

  #farmer level
  insemination       = yes
  change_food        = yes

  #herd level
  conception         = yes
  parturition        = yes
  death              = yes
  estrous_observed   = yes
  estrous_missed     = yes
  estrous_environment= yes
  insemination_result= yes
  mature             = yes
  ovulation          = yes
  new_cow            = yes
  delete_cow         = yes
  abortion           = yes

  #cow level
  animal_performance = no
}

#################################################################################################################
#====== Log states	    											#
#################################################################################################################

action{
  type = genericlog_herd

  name = log_states
  log_type    = file
  file_path   = states.txt
  sep_col     = \t
  file_line_flush=no
  
  #sqlite_path  = states.sqlite
  #sqlite_table = states
  

  #--- from cow and simulator ---
  column{
     value       = time
     name        = time
     sqlite_type = numeric
  }
  
  column{
     value       = state.CONTROL
     name        = CONTROL
     sqlite_type = numeric
  }

  column{
     value       = state.CALF
     name        = CALF
     sqlite_type = numeric
  }

  column{
     value       = state.HEIFER
     name        = HEIFER
     sqlite_type = numeric
  }

  column{
     value       = state.CYCLING
     name        = CYCLING
     sqlite_type = numeric
  }

  column{
     value       = state.BREEDING
     name        = BREEDING
     sqlite_type = numeric
  }

  column{
     value       = state.PREGNANT
     name        = PREGNANT
     sqlite_type = numeric
  }

  column{
     value       = state.POST-ABORTIVE
     name        = POST-ABORTIVE
     sqlite_type = numeric
  }

  column{
     value       = state.POSTPARTAL
     name        = POSTPARTAL
     sqlite_type = numeric
  }

  column{
     value       = state.EXTENDED_LACTATION
     name        = EXTENDED_LACTATION
     sqlite_type = numeric
  }

  column{
     value       = state.TO_CULL
     name        = TO_CULL
     sqlite_type = numeric
  }


 # column{
 #    value       = state.not.mature
 #    name        = not_mature
 #    sqlite_type = numeric
 # }

}

link{
  trigger = every_day_herd
  action = log_states
}



###s######## Default diets

feed{
   name = calf_diet
   type = mix

   feed = CPL.MLK
   proportion = 1.00
}

feed{
   name = heifer_diet
   type = mix

   feed = FO.STR
   proportion = 0.02
   feed = FO.HAP
   proportion = 0.60
   feed = FO.GSI
   proportion = 0.32
   feed = CO.CER
   proportion = 0.05
   feed = CPL.CMV
   proportion = 0.01
}

feed{
   name = lactation_diet
   type = mix

   feed = FO.STR
   proportion = 0.01
   feed = FO.HAP
   proportion = 0.03
   feed = FO.GSI
   proportion = 0.04
   feed = FO.CSI
   proportion = 0.70
   feed = CO.CER
   proportion = 0.05
   feed = CO.OSC
   proportion = 0.13
   feed = CO.ROO
   proportion = 0.03
   feed = CPL.CMV
   proportion = 0.01
}

feed{
   name = drycow_diet
   type = mix

   feed = FO.STR
   proportion = 0.02
   feed = FO.HAP
   proportion = 0.68
   feed = FO.CSI
   proportion = 0.08
   feed = CO.CER
   proportion = 0.05
   feed = CO.OSC
   proportion = 0.13
   feed = CO.ROO
   proportion = 0.03
   feed = CPL.CMV
   proportion = 0.01
}

feed{
   name = pasture_diet
   type = mix

   feed = FO.FGX
   proportion = 0.778
   feed = CO.CER
   proportion = 0.050
   feed = CO.OSC
   proportion = 0.130
   feed = CO.TUB
   proportion = 0.002
   feed = CO.ROO
   proportion = 0.030
   feed = CPL.CMV
   proportion = 0.010
}





########################################################
#                                                      # 
#List of available feed (derived from INRA tables)     #
#                                                      # 
########################################################

########### FORAGES ####################################
#	FO.STR		Straw
#	FO.STN		Straw treated with ammonia
#	FO.MSH		Maize stover & husks
#	FO.HAL		Legume hay
#	FO.HAG		Gramineae hay
#	FO.HAP		Permanent grassland hay
#	FO.DHA		Dehydrated alfalfa
#	FO.DHF		Dehydrated forage
#	FO.FGC		Fresh cereal grass
#	FO.FGO		Fresh oleaginous grass
#	FO.FGG		Fresh gramineae grass
#	FO.FGX		Fresh mixed grass (meadow)
#	FO.FGL		Fresh legume grass
#	FO.GSI50	Grass silage > 50% DM
#	FO.GSI		Grass silage
#	FO.CSI		Corn silage
#	FO.FPF		Faba & pea forage
#	FO.VEG		Vegetable fodder

###########	CONCENTRATES ###############################
#	CO.CER		Cereal seed & by-products
#	CO.OSC5		Oilseed cake <5% oil
#	CO.OSC		Oilseed cake
#	CO.TUB		Starchy tubers
#	CO.ROO		Vegetable roots
#	CO.FPB		Faba & pea bean
#	CO.LUP		Lupin
#	CO.SDO		Oilseed

########### COMPLEMENTS ################################
#	CPL.CMV		Compl. Minerals & Vitamins
#	CPL.AMA		Amino acids
#	CPL.URE		Urea
#	CPL.MOL		Molasses
#	CPL.PLP		Beet pulp
#	CPL.MLK		Milk
#	CPL.OIL		Oil

			
feed{	# Straw
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 80 %FM
			# Representative INRA feed: FP0090 Oat straw
   name 		= FO.STR
   type 		= ingredient
   feed_eD 	=  5.9512   # MJ_ME/kg_DM
   feed_DMC =  0.8825   # kg_DM/kg_FM
   feed_OM 	=  0.9100   # kg/kg_DM
   feed_OMd =  0.4500   # %
   feed_CP 	=  0.0360   # kg/kg_DM
   feed_CPd =  0.0296   # %
   feed_NDF =  0.7910   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0150   # kg/kg_DM
}
feed{	# Straw treated with ammonia
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 80 %FM
			# Representative INRA feed: FP0080 Barley straw, NH3-treated 5%DM
   name 		= FO.STN
   type 		= ingredient
   feed_eD 	=  7.6484   # MJ_ME/kg_DM
   feed_DMC =  0.8867   # kg_DM/kg_FM
   feed_OM 	=  0.8970   # kg/kg_DM
   feed_OMd =  0.5567   # %
   feed_CP 	=  0.1000   # kg/kg_DM
   feed_CPd =  0.3933   # %
   feed_NDF =  0.7603   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0150   # kg/kg_DM
}
feed{	# Maize stover & husks
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 80 %FM
			# Representative INRA feed: FP0180 Maize stover, ensiled
   name 		= FO.MSH
	 type = ingredient
   feed_eD 	=  8.5847   # MJ_ME/kg_DM
   feed_DMC =  0.5022   # kg_DM/kg_FM
   feed_OM 	=  0.9332   # kg/kg_DM
   feed_OMd =  0.6220   # %
   feed_CP 	=  0.0888   # kg/kg_DM
   feed_CPd =  0.3432   # %
   feed_NDF =  0.6580   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0150   # kg/kg_DM
}
feed{	# Legume hay
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FF3370 Lucerne hay
   name 		= FO.HAL
   type 		= ingredient
   feed_eD 	=  8.4626   # MJ_ME/kg_DM
   feed_DMC =  0.8500   # kg_DM/kg_FM
   feed_OM 	=  0.8956   # kg/kg_DM
   feed_OMd =  0.5987   # %
   feed_CP 	=  0.1791   # kg/kg_DM
   feed_CPd =  0.6818   # %
   feed_NDF =  0.5326   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0259   # kg/kg_DM
}
feed{	# Gramineae hay
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FF1190 Italian ryegrass hay
   name 		= FO.HAG
   type 		= ingredient
   feed_eD 	=  8.8553   # MJ_ME/kg_DM
   feed_DMC =  0.8500   # kg_DM/kg_FM
   feed_OM 	=  0.9011   # kg/kg_DM
   feed_OMd =  0.6294   # %
   feed_CP 	=  0.1169   # kg/kg_DM
   feed_CPd =  0.5447   # %
   feed_NDF =  0.6421   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0300   # kg/kg_DM
}
feed{	# Permanent grassland hay
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FF0750 Mountain permanent grassland hay
   name 		= FO.HAP
   type 		= ingredient
   feed_eD 	=  9.0294   # MJ_ME/kg_DM
   feed_DMC =  0.8500   # kg_DM/kg_FM
   feed_OM 	=  0.9133   # kg/kg_DM
   feed_OMd =  0.6196   # %
   feed_CP 	=  0.1270   # kg/kg_DM
   feed_CPd =  0.5679   # %
   feed_NDF =  0.6090   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0223   # kg/kg_DM
}
feed{	# Dehydrated alfalfa
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CD0040 Dehydrated alfalfa
   name		 	= FO.DHA
   type 		= ingredient
   feed_eD 	=  9.2187   # MJ_ME/kg_DM
   feed_DMC =  0.9070   # kg_DM/kg_FM
   feed_OM 	=  0.8752   # kg/kg_DM
   feed_OMd =  0.6317   # %
   feed_CP 	=  0.2002   # kg/kg_DM
   feed_CPd =  0.7017   # %
   feed_NDF =  0.4375   # kg/kg_DM
   feed_ST 	=  0.0297   # kg/kg_DM
   feed_STd =  0.8200   # %
   feed_EE 	=  0.0292   # kg/kg_DM
}
feed{	# Dehydrated forage
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CD0120 Dehydrated Italian ryegrass
   name 		= FO.DHF
   type 		= ingredient
   feed_eD 	=  9.9954   # MJ_ME/kg_DM
   feed_DMC =  0.9080   # kg_DM/kg_FM
   feed_OM 	=  0.8898   # kg/kg_DM
   feed_OMd =  0.7010   # %
   feed_CP 	=  0.1436   # kg/kg_DM
   feed_CPd =  0.6182   # %
   feed_NDF =  0.5450   # kg/kg_DM
   feed_ST 	=  0.0024   # kg/kg_DM
   feed_STd =  0.1640   # %
   feed_EE 	=  0.0268   # kg/kg_DM
}
feed{	# Fresh cereal grass
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FV2020 Fresh whole crop sorghum
   name 		= FO.FGC
   type 		= ingredient
   feed_eD 	=  9.4748   # MJ_ME/kg_DM
   feed_DMC =  0.2504   # kg_DM/kg_FM
   feed_OM 	=  0.9148   # kg/kg_DM
   feed_OMd =  0.6585   # %
   feed_CP 	=  0.1044   # kg/kg_DM
   feed_CPd =  0.6330   # %
   feed_NDF =  0.5710   # kg/kg_DM
   feed_ST 	=  0.0983   # kg/kg_DM
   feed_STd =  0.8652   # %
   feed_EE 	=  0.0304   # kg/kg_DM
}
feed{	# Fresh oleaginous grass
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FV2830 Fresh silphium
   name 		= FO.FGO
   type 		= ingredient
   feed_eD 	=  9.8974   # MJ_ME/kg_DM
   feed_DMC =  0.1170   # kg_DM/kg_FM
   feed_OM 	=  0.8494   # kg/kg_DM
   feed_OMd =  0.7323   # %
   feed_CP 	=  0.1535   # kg/kg_DM
   feed_CPd =  0.7491   # %
   feed_NDF =  0.4212   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0248   # kg/kg_DM
}
feed{	# Fresh gramineae grass
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FV0490 Fresh italian ryegrass
   name 		= FO.FGG
   type 		= ingredient
   feed_eD 	= 10.2129   # MJ_ME/kg_DM
   feed_DMC =  0.1885   # kg_DM/kg_FM
   feed_OM 	=  0.8893   # kg/kg_DM
   feed_OMd =  0.7150   # %
   feed_CP 	=  0.1452   # kg/kg_DM
   feed_CPd =  0.6756   # %
   feed_NDF =  0.5690   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0367   # kg/kg_DM
}
feed{	# Fresh mixed grass (meadow)
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FV0120 Fresh lowland grassland
   name 		= FO.FGX
   type 		= ingredient
   feed_eD 	= 10.2424   # MJ_ME/kg_DM
   feed_DMC =  0.1946   # kg_DM/kg_FM
   feed_OM 	=  0.9057   # kg/kg_DM
   feed_OMd =  0.6896   # %
   feed_CP 	=  0.1444   # kg/kg_DM
   feed_CPd =  0.6595   # %
   feed_NDF =  0.5498   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0265   # kg/kg_DM
}
feed{	# Fresh legume grass
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FV2370 Fresh red clover
   name 		= FO.FGL
   type 		= ingredient
   feed_eD 	= 10.3243   # MJ_ME/kg_DM
   feed_DMC =  0.1749   # kg_DM/kg_FM
   feed_OM 	=  0.8844   # kg/kg_DM
   feed_OMd =  0.7014   # %
   feed_CP 	=  0.2046   # kg/kg_DM
   feed_CPd =  0.7671   # %
   feed_NDF =  0.4603   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0287   # kg/kg_DM
}
feed{	# Grass silage > 50% DM
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FE2790 Wilted perennial ryegrass silage
   name 		= FO.GSI50
   type 		= ingredient
   feed_eD 	=  9.3078   # MJ_ME/kg_DM
   feed_DMC =  0.5502   # kg_DM/kg_FM
   feed_OM 	=  0.9056   # kg/kg_DM
   feed_OMd =  0.6545   # %
   feed_CP 	=  0.1351   # kg/kg_DM
   feed_CPd =  0.6395   # %
   feed_NDF =  0.5744   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0337   # kg/kg_DM
}
feed{	# Grass silage
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FE2220 Perennial ryegrass silage
   name 		= FO.GSI
   type 		= ingredient
   feed_eD 	= 10.3090   # MJ_ME/kg_DM
   feed_DMC =  0.2234   # kg_DM/kg_FM
   feed_OM 	=  0.8950   # kg/kg_DM
   feed_OMd =  0.6952   # %
   feed_CP 	=  0.1406   # kg/kg_DM
   feed_CPd =  0.6469   # %
   feed_NDF =  0.5425   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0374   # kg/kg_DM
}
feed{	# Corn silage
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FE4710 Fine chop 30% DM corn silage
   name 		= FO.CSI
   type 		= ingredient
   feed_eD 	= 10.6995   # MJ_ME/kg_DM
   feed_DMC =  0.3109   # kg_DM/kg_FM
   feed_OM 	=  0.9484   # kg/kg_DM
   feed_OMd =  0.7061   # %
   feed_CP 	=  0.0848   # kg/kg_DM
   feed_CPd =  0.5300   # %
   feed_NDF =  0.4415   # kg/kg_DM
   feed_ST 	=  0.2754   # kg/kg_DM
   feed_STd =  0.7660   # %
   feed_EE 	=  0.0310   # kg/kg_DM
}
feed{	# Faba & pea forage
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FV2700 Fresh faba bean forage
   name 		= FO.FPF
   type 		= ingredient
   feed_eD 	= 10.8203   # MJ_ME/kg_DM
   feed_DMC =  0.2546   # kg_DM/kg_FM
   feed_OM 	=  0.9115   # kg/kg_DM
   feed_OMd =  0.7188   # %
   feed_CP 	=  0.1578   # kg/kg_DM
   feed_CPd =  0.7156   # %
   feed_NDF =  0.4160   # kg/kg_DM
   feed_ST 	=  0.0913   # kg/kg_DM
   feed_STd =  0.7650   # %
   feed_EE 	=  0.0288   # kg/kg_DM
}
feed{	# Vegetable fodder
			# Type of feed: FORAGE
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: FV2840 Fresh kale
   name 		= FO.VEG
   type 		= ingredient
   feed_eD 	= 12.0901   # MJ_ME/kg_DM
   feed_DMC =  0.1348   # kg_DM/kg_FM
   feed_OM 	=  0.8674   # kg/kg_DM
   feed_OMd =  0.8260   # %
   feed_CP 	=  0.1684   # kg/kg_DM
   feed_CPd =  0.7794   # %
   feed_NDF =  0.3382   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0080   # kg/kg_DM
}
feed{	# Cereal seed & by-products
			# Type of feed: CONCENTRATE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CS0160 Wheat middlings, starch 30-40%
   name 		= CO.CER
   type 		= ingredient
   feed_eD 	= 12.3262   # MJ_ME/kg_DM
   feed_DMC =  0.8835   # kg_DM/kg_FM
   feed_OM 	=  0.9541   # kg/kg_DM
   feed_OMd =  0.7712   # %
   feed_CP 	=  0.1642   # kg/kg_DM
   feed_CPd =  0.6629   # %
   feed_NDF =  0.2909   # kg/kg_DM
   feed_ST 	=  0.4008   # kg/kg_DM
   feed_STd =  0.8041   # %
   feed_EE 	=  0.0584   # kg/kg_DM
}
feed{	# Oilseed cake <5% oil
			# Type of feed: CONCENTRATE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CX0050 Cottonseed meal, cr. fibre 15-20%
   name 		= CO.OSC5
   type 		= ingredient
   feed_eD 	= 12.0555   # MJ_ME/kg_DM
   feed_DMC =  0.8907   # kg_DM/kg_FM
   feed_OM 	=  0.9309   # kg/kg_DM
   feed_OMd =  0.7747   # %
   feed_CP 	=  0.4309   # kg/kg_DM
   feed_CPd =  0.7740   # %
   feed_NDF =  0.2931   # kg/kg_DM
   feed_ST 	=  0.0527   # kg/kg_DM
   feed_STd =  0.8200   # %
   feed_EE 	=  0.0236   # kg/kg_DM
}
feed{	# Oilseed cake
			# Type of feed: CONCENTRATE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CX0310 Sunflower meal, oil 5-20%
   name 		= CO.OSC
   type 		= ingredient
   feed_eD 	= 12.6524   # MJ_ME/kg_DM
   feed_DMC =  0.9207   # kg_DM/kg_FM
   feed_OM 	=  0.9368   # kg/kg_DM
   feed_OMd =  0.7350   # %
   feed_CP 	=  0.3499   # kg/kg_DM
   feed_CPd =  0.7570   # %
   feed_NDF =  0.3477   # kg/kg_DM
   feed_ST 	=  0.0444   # kg/kg_DM
   feed_STd =  0.8200   # %
   feed_EE 	=  0.1015   # kg/kg_DM
}
feed{	# Starchy tubers
			# Type of feed: CONCENTRATE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CP0030 Cassava
   name 		= CO.TUB
   type 		= ingredient
   feed_eD 	= 11.6622   # MJ_ME/kg_DM
   feed_DMC =  0.6480   # kg_DM/kg_FM
   feed_OM 	=  0.9510   # kg/kg_DM
   feed_OMd =  0.8367   # %
   feed_CP 	=  0.0750   # kg/kg_DM
   feed_CPd =  0.4888   # %
   feed_NDF =  0.1192   # kg/kg_DM
   feed_ST 	=  0.6447   # kg/kg_DM
   feed_STd =  0.7900   # %
   feed_EE 	=  0.0062   # kg/kg_DM
}
feed{	# Vegetable roots
			# Type of feed: CONCENTRATE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: FR0040 Carrot
   name 		= CO.ROO
   type 		= ingredient
   feed_eD 	= 12.8261   # MJ_ME/kg_DM
   feed_DMC =  0.1568   # kg_DM/kg_FM
   feed_OM 	=  0.9311   # kg/kg_DM
   feed_OMd =  0.8900   # %
   feed_CP 	=  0.0896   # kg/kg_DM
   feed_CPd =  0.5710   # %
   feed_NDF =  0.1295   # kg/kg_DM
   feed_ST 	=  0.0050   # kg/kg_DM
   feed_STd =  0.2000   # %
   feed_EE 	=  0.0110   # kg/kg_DM
}
feed{	# Faba & pea bean
			# Type of feed: CONCENTRATE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CN0060 Faba bean seeds
   name 		= CO.FPB
   type 		= ingredient
   feed_eD 	= 13.6219   # MJ_ME/kg_DM
   feed_DMC =  0.8721   # kg_DM/kg_FM
   feed_OM 	=  0.9610   # kg/kg_DM
   feed_OMd =  0.9057   # %
   feed_CP 	=  0.2689   # kg/kg_DM
   feed_CPd =  0.7843   # %
   feed_NDF =  0.1550   # kg/kg_DM
   feed_ST 	=  0.4601   # kg/kg_DM
   feed_STd =  0.7586   # %
   feed_EE 	=  0.0146   # kg/kg_DM
}
feed{	# Lupin
			# Type of feed: CONCENTRATE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CN0130 White lupin seeds
   name 		= CO.LUP
   type 		= ingredient
   feed_eD 	= 15.2995   # MJ_ME/kg_DM
   feed_DMC =  0.8880   # kg_DM/kg_FM
   feed_OM 	=  0.9617   # kg/kg_DM
   feed_OMd =  0.8800   # %
   feed_CP 	=  0.3657   # kg/kg_DM
   feed_CPd =  0.8000   # %
   feed_NDF =  0.2257   # kg/kg_DM
   feed_ST 	=  0.0700   # kg/kg_DM
   feed_STd =  0.8200   # %
   feed_EE 	=  0.0850   # kg/kg_DM
}
feed{	# Oilseed
			# Type of feed: CONCENTRATE
			# Maximum incorporation in diet: 60 %FM
			# Representative INRA feed: CN0110 Linseeds
   name 		= CO.SDO
   type 		= ingredient
   feed_eD 	= 17.6063   # MJ_ME/kg_DM
   feed_DMC =  0.9143   # kg_DM/kg_FM
   feed_OM 	=  0.9539   # kg/kg_DM
   feed_OMd =  0.7650   # %
   feed_CP 	=  0.2647   # kg/kg_DM
   feed_CPd =  0.7380   # %
   feed_NDF =  0.2515   # kg/kg_DM
   feed_ST 	=  0.0461   # kg/kg_DM
   feed_STd =  0.8200   # %
   feed_EE 	=  0.3208   # kg/kg_DM
}
feed{	# Compl. Minerals & Vitamins
			# Type of feed: COMPLEMENT
			# Maximum incorporation in diet: 5 %FM
			# Representative INRA feed: MC0010 Crushed chalk
   name 		= CPL.CMV
   type 		= ingredient
   feed_eD 	=  0.0000   # MJ_ME/kg_DM
   feed_DMC =  0.9500   # kg_DM/kg_FM
   feed_OM 	=  0.0000   # kg/kg_DM
   feed_OMd =  0.0000   # %
   feed_CP 	=  0.0000   # kg/kg_DM
   feed_CPd =  0.0000   # %
   feed_NDF =  0.0000   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0000   # kg/kg_DM
}
feed{	# Amino acids
			# Type of feed: COMPLEMENT
			# Maximum incorporation in diet: 5 %FM
			# Representative INRA feed: CAA020 L-threonin
   name 		= CPL.AMA
   type 		= ingredient
   feed_eD 	=  0.0000   # MJ_ME/kg_DM
   feed_DMC =  1.0000   # kg_DM/kg_FM
   feed_OM 	=  0.9960   # kg/kg_DM
   feed_OMd =  1.0000   # %
   feed_CP 	=  0.7450   # kg/kg_DM
   feed_CPd =  1.0000   # %
   feed_NDF =  0.0000   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0000   # kg/kg_DM
}
feed{	# Urea
			# Type of feed: COMPLEMENT
			# Maximum incorporation in diet: 5 %FM
			# Representative INRA feed: CV0020 Urea
   name 		= CPL.URE
   type 		= ingredient
   feed_eD 	=  3.3890   # MJ_ME/kg_DM
   feed_DMC =  0.9940   # kg_DM/kg_FM
   feed_OM 	=  1.0000   # kg/kg_DM
   feed_OMd =  0.9900   # %
   feed_CP 	=  2.8700   # kg/kg_DM
   feed_CPd =  1.0000   # %
   feed_NDF =  0.0000   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0000   # kg/kg_DM
}
feed{	# Molasses
			# Type of feed: COMPLEMENT
			# Maximum incorporation in diet: 10 %FM
			# Representative INRA feed: CP0170 Beet molasses
   name 		= CPL.MOL
   type 		= ingredient
   feed_eD 	=  9.7906   # MJ_ME/kg_DM
   feed_DMC =  0.7390   # kg_DM/kg_FM
   feed_OM 	=  0.8660   # kg/kg_DM
   feed_OMd =  0.8250   # %
   feed_CP 	=  0.1000   # kg/kg_DM
   feed_CPd =  0.5800   # %
   feed_NDF =  0.0015   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.0070   # kg/kg_DM
}
feed{	# Beet pulp
			# Type of feed: COMPLEMENT
			# Maximum incorporation in diet: 10 %FM
			# Representative INRA feed: CP0020 Pressed beet pulp
   name 		= CPL.PLP
   type 		= ingredient
   feed_eD 	= 11.5046   # MJ_ME/kg_DM
   feed_DMC =  0.4503   # kg_DM/kg_FM
   feed_OM 	=  0.9243   # kg/kg_DM
   feed_OMd =  0.8367   # %
   feed_CP 	=  0.0913   # kg/kg_DM
   feed_CPd =  0.6470   # %
   feed_NDF =  0.4827   # kg/kg_DM
   feed_ST 	=  0.0047   # kg/kg_DM
   feed_STd =  0.5467   # %
   feed_EE 	=  0.0097   # kg/kg_DM
}
feed{	# Milk
			# Type of feed: COMPLEMENT
			# Maximum incorporation in diet: 100 %FM
			# Representative INRA feed: CL0020 Whole milk powder
   name 		= CPL.MLK
   type 		= ingredient
   feed_eD 	= 18.8280   # MJ_ME/kg_DM
   feed_DMC =  0.9600   # kg_DM/kg_FM
   feed_OM	=  0.9350   # kg/kg_DM
   feed_OMd =  0.9400   # %
   feed_CP 	=  0.2540   # kg/kg_DM
   feed_CPd =  0.7800   # %
   feed_NDF =  0.0000   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.2510   # kg/kg_DM
}
feed{	# Oil
			# Type of feed: COMPLEMENT
			# Maximum incorporation in diet: 5 %FM
			# Representative INRA feed: CG0050 Soybean oil
   name 		= CPL.OIL
   type 		= ingredient
   feed_eD 	= 36.6937   # MJ_ME/kg_DM
   feed_DMC =  0.9980   # kg_DM/kg_FM
   feed_OM 	=  0.9995   # kg/kg_DM
   feed_OMd =  0.8900   # %
   feed_CP 	=  0.0000   # kg/kg_DM
   feed_CPd =  0.0000   # %
   feed_NDF =  0.0000   # kg/kg_DM
   feed_ST 	=  0.0000   # kg/kg_DM
   feed_STd =  0.0000   # %
   feed_EE 	=  0.9992   # kg/kg_DM
}