ecoIndex

package
v0.0.0-...-7bae67f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

background

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

fatCattle

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

initIndexParams

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

slaughterCattle

weaning

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

View Source
var AumCost []float64
View Source
var BackgroundAumCost []float64
View Source
var BackgroundDays float64 // length of the backgrounding program after weaning
View Source
var DiscountRate float64
View Source
var FeedlotFeedCost float64
View Source
var InProgramProportion float64 // proportion of calves that initially may qualify for a grid program - e.g., CHB, CAB
View Source
var IndexComponents []animal.Component_t
View Source
var IndexTerminal bool
View Source
var IndexType string
View Source
var NetReturns float64
View Source
var ParamIndex map[string]interface{}

setup the map of the array of json name:value pairs - notice "interface{}"

View Source
var StartYearOfNetReturns int

Functions

func CowCosts

func CowCosts(nYears int) float64

Cost per year for cows

func CowsToHeifers

func CowsToHeifers()

So they are sold when a terminal index

func EvaluateBackgroundingIndex

func EvaluateBackgroundingIndex(nYears int, burninMarker int, param map[string]interface{}, gvCholesky mat.Cholesky, rvCholesky mat.Cholesky) float64

Process an index with sale at after backgrounding

func EvaluateFatCattleIndex

func EvaluateFatCattleIndex(nYears int, burninMarker int, param map[string]interface{}, gvCholesky mat.Cholesky, rvCholesky mat.Cholesky) float64

Process an index with sale as finished cattle

func EvaluateSlaughterCattleIndex

func EvaluateSlaughterCattleIndex(nYears int, burninMarker int, param map[string]interface{}, gvCholesky mat.Cholesky, rvCholesky mat.Cholesky) float64

Process an index with sale as finished cattle

func EvaluateWeaningIndex

func EvaluateWeaningIndex(nYears int, burninMarker int, param map[string]interface{}, gvCholesky mat.Cholesky, rvCholesky mat.Cholesky) float64

Process an index with sale at weaning

func InitGrid

func InitGrid()

If slaughtercattle IndexType then initialize grid pricing

func InitIndexParams

func InitIndexParams(indexParam *string)

Read the index hjson file

func IsInIndex

func IsInIndex(b animal.Component_t) bool

Is this in the index

func IsIndexTerminal

func IsIndexTerminal() bool

func LoadIndexComponents

func LoadIndexComponents()

Setup the index traits

func ProcessNetReturns

func ProcessNetReturns(indexParam *string, nYears int, burninMarker int,
	param map[string]interface{}, gvCholesky mat.Cholesky, rvCholesky mat.Cholesky)

main call

func SetActiveCowList

func SetActiveCowList()

// Reset Records back to heifers

func HeiferReset() {
	for i := range animal.HeiferResetList {
		animal.Records[i].Sex = animal.Heifer
		animal.Records[i].BreedingRecords = nil
		animal.Records[i].Dead = 0
		animal.Records[i].YearCowCulled = 0
		animal.Records[i].Active = false

	}
}

// Reset Records back to active cows

func CowReset() {
	for l := range animal.CowResetList {
		i := animal.CowResetList[l].Id - 1
		animal.Records[i].Sex = animal.Cow
		animal.Records[i].BreedingRecords = nil
		animal.Records[i].Dead = 0
		animal.Records[i].YearCowCulled = 0
		animal.Records[i].Active = true
		animal.Records[i].BreedingRecords = animal.CowResetList[l].BreedingRecords
	}
}

func WeaningNetReturnsToFixedCosts

func WeaningNetReturnsToFixedCosts(nYears int) float64
The total discounted net returns to fixed costs for weaning

and optionally write a table to stdout Returns average cost/mating

func WeaningVariableCostsPerMating

func WeaningVariableCostsPerMating(nYears int) float64

This is used to caalculate the weaning costs per year for all indexes except weaning, because weaning does it below in the net returns calculation.

func WhatSaleEndpoint

func WhatSaleEndpoint() (indexType string)

Return the type of index the hjson builds

Types

type GridValue_t

type GridValue_t struct {
	QualityGrade string // Prime, Program, Choice, Select,Standard
	YieldGrade   int    // 1, 2, 3, 4, 5
}

type TraitSexMinWtMaxWt_t

type TraitSexMinWtMaxWt_t struct {
	Trait         string  // Same as traits in master hjson - e.g., WW is weaning weight
	Sex           string  // Sex S=steer and H=heifer calf
	MinWt         float64 //If the weight of the animals is >=
	MaxWt         float64 // and the weight of the animals is <
	PricePerPound float64 // read as per cwt but converted to per lb
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL