greet

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultNonCombustionSCC slca.SCC = "0028888801" // TODO: Perhaps figure out a way to do better.

DefaultNonCombustionSCC is used for everything we don't have an SCC for.

Variables

View Source
var DebugLevel = 0

DebugLevel sets the amount of debugging output that is written to the console. Higher numbers lead to more output.

Functions

func GetEmissionFactor

func GetEmissionFactor(emissions []*Emission, i int, fuel *Resource,
	db *DB) *unit.Unit

GetEmissionFactor returns the emissions factor for emission corresponding to index i in emissions. fuel is used to calculate some emissions factors based on fuel properties. It should be safe to pass a nil value for fuel for non-combustion emissions.

Types

type BasicParameters

type BasicParameters struct {
	YearSelected Expression `xml:"year_selected,attr"`
	LHV          bool       `xml:"lhv,attr"`
}

BasicParameters holds the GREET database basic parameters.

type Compatibility

type Compatibility struct {
	MatID ResourceID `xml:"mat_id,attr"`
}

Compatibility gives another resource this resource is compatible with.

type Coproduct

type Coproduct struct {
	ID                   slca.OutputID `xml:"id,attr"`
	Ref                  ResourceID    `xml:"ref,attr"`
	AmountYears          []*ValueYear  `xml:"amount>year"`
	Method               string        `xml:"method,attr"` // either "allocation" or "displacement"
	ConventionalProducts []*Product    `xml:"conventional_products>product"`
}

Coproduct is a holder for information about a single coproduct.

func (*Coproduct) CalcAllocationAmount

func (cp *Coproduct) CalcAllocationAmount(outputUnits unit.Dimensions,
	AllocationMethod string, db *DB) *unit.Unit

CalcAllocationAmount calculates the amount of this coproduct to be used when allocating resource use and emissions. If AllocationMethod is "", it allocates all emissions to the main output and none to the coproducts.

func (*Coproduct) GetAmount

func (cp *Coproduct) GetAmount(db *DB) *unit.Unit

GetAmount returns the amount of this coproduct that is produced.

func (*Coproduct) GetAmountBeforeLoss

func (cp *Coproduct) GetAmountBeforeLoss(db *DB) *unit.Unit

GetAmountBeforeLoss calculates the amount of this coproduct is produced. Because coproducts do not have losses, it gives the same result as GetAmount().

func (*Coproduct) GetID

func (cp *Coproduct) GetID() slca.OutputID

GetID returns the ID of this coproduct.

func (*Coproduct) GetLossEmissions

func (cp *Coproduct) GetLossEmissions(_ *DB) ([]*Gas, []*unit.Unit)

GetLossEmissions is required to fulfill the OutputLike interface, but coproducts don't have any loss emissions.

func (*Coproduct) GetName

func (cp *Coproduct) GetName(db *DB) string

GetName gets the name associated with the resource produced by this coproduct.

func (*Coproduct) GetProcess

func (cp *Coproduct) GetProcess(path *Pathway, db *DB) slca.Process

GetProcess returns the process associated with this Coproduct.

func (*Coproduct) GetResource

func (cp *Coproduct) GetResource(db slca.LCADB) slca.Resource

GetResource returns the resource associated with this coproduct.

func (*Coproduct) IsCoproduct

func (cp *Coproduct) IsCoproduct() bool

IsCoproduct is for implementing the OutputLike interface and is always true.

type Coproducts

type Coproducts struct {
	// Either "Mass", "Energy", "Market", "Volume" or ""
	AllocationMethod string `xml:"allocation_method,attr"`

	Coprods []*Coproduct `xml:"coproduct"`
}

Coproducts is a holder for data about the coproducts of a process and how to deal with them.

func (*Coproducts) Displacement

func (cps *Coproducts) Displacement(r *slca.OnsiteResults, db *DB)

Displacement calculates the amounts of different processes that are displaced by this process. The results are returned as negative numbers.

type DB

type DB struct {
	Version         string           `xml:"version,attr"`
	BasicParameters *BasicParameters `xml:"basic_parameters"`
	Data            *Data            `xml:"data"`

	// SpatialSCCs are all the SCC codes used by this database
	// for spatialization. SCC codes that are not
	// used for spatialization are not included here.
	SpatialSCC []slca.SCC
	// contains filtered or unexported fields
}

DB is a holder for the GREET database.

func Load

func Load(dbFile io.Reader) *DB

Load loads the GREET database from an XML file.

func (*DB) AddSCCs

func (db *DB) AddSCCs(stationaryProcessFile, vehicleFile, technologyFile io.Reader) error

AddSCCs adds SCC codes to the greet database by matching information in sscFile.

func (*DB) EditByID

func (db *DB) EditByID(changes *DB)

EditByID makes changes to db as specified by "changes". Edits are made by matching ID numbers in db and changes. Only existing objects can be edited. This function has not been exhaustively tested, so use at your own risk.

func (*DB) EditExpressionByID

func (db *DB) EditExpressionByID(ID string, newValue float64) error

EditExpressionByID finds the expression with an ID matching "ID" and sets the value to newValue. It returns an error if "ID" is not found or if there is more than one expression matching "ID" in the database.

func (*DB) EndUseFromID

func (db *DB) EndUseFromID(ID string) (slca.Pathway, error)

EndUseFromID returns the pathway mix, or vehicle with the given id.

func (*DB) EndUses

func (db *DB) EndUses() ([]slca.Pathway, []string)

EndUses returns information about the pathways, mixes, and vehicles in this database.

func (*DB) GetGas

func (db *DB) GetGas(name string) (*Gas, error)

GetGas returns the gas in the database with the specified name. It returns an error if there is no match.

func (*DB) GetMix

func (db *DB) GetMix(ID ModelID) *Mix

GetMix returns the Mix with the given ID.

func (*DB) GetPathway

func (db *DB) GetPathway(ID ModelID) *Pathway

GetPathway returns the pathway with the given id.

func (*DB) GetPathwayMixOrVehicleFromName

func (db *DB) GetPathwayMixOrVehicleFromName(name string) (slca.Pathway, error)

GetPathwayMixOrVehicleFromName returns the pathway, mix, or vehicle with the given name.

func (*DB) GetResource

func (db *DB) GetResource(id ResourceID, requester interface{}) *Resource

GetResource returns the resource with the specified ID. The requester input is only used for debugging if the resource is not found.

func (*DB) GetResourceFromName

func (db *DB) GetResourceFromName(name string) *Resource

GetResourceFromName returns the resource with the specified name.

func (*DB) GetResultVars

func (db *DB) GetResultVars() (ids, names []string)

GetResultVars returns the gases and resources that can be considered as model result types.

func (*DB) GetVariableValue

func (db *DB) GetVariableValue(varName string) *unit.Unit

GetVariableValue finds the desired variable in the database, evaluates it, and returns the result.

func (*DB) GetVehicleFromID

func (db *DB) GetVehicleFromID(ID ModelID) *Vehicle

GetVehicleFromID finds the vehicle in the database with the matching ID.

func (*DB) GetVehicleFromName

func (db *DB) GetVehicleFromName(name string) *Vehicle

GetVehicleFromName finds the vehicle in the database with the matching ID.

func (*DB) GetYear

func (db *DB) GetYear() float64

GetYear returns the analysis year for this database.

func (*DB) InterpolateValue

func (db *DB) InterpolateValue(y []*ValueYear) *unit.Unit

InterpolateValue returns the value associated with the year set in the GREET database, interpolating if necessary.

func (*DB) InterpolateValueWithLag

func (db *DB) InterpolateValueWithLag(y []*ValueYear, lag float64) *unit.Unit

InterpolateValueWithLag returns the value associated with the year set in the GREET database minus the specified lag (in years), interpolating if necessary.

func (*DB) SpatialSCCs

func (db *DB) SpatialSCCs() []slca.SCC

SpatialSCCs returns all of the SCC codes used by this database for spatialization.

func (*DB) Write

func (db *DB) Write(w io.Writer) (int, error)

Write writes out a database to w in indented XML format.

type Data

type Data struct {
	Pathways                []*Pathway               `xml:"pathways>pathway"`
	ResourceGroups          []*ResourceGroup         `xml:"resources>groups>group"`
	Resources               []*Resource              `xml:"resources>resources>resource"`
	TransportationProcesses []*TransportationProcess `xml:"processes>transportation"`
	StationaryProcesses     []*StationaryProcess     `xml:"processes>stationary"`
	Technologies            []*Technology            `xml:"technologies>technology"`
	Modes                   []*Mode                  `xml:"modes>mode"`
	Locations               Locations                `xml:"locations"`
	GasGroups               []*GasGroup              `xml:"gases>groups>group"`
	Gases                   []*Gas                   `xml:"gases>gases>gas"`

	// VehicleTechnologyLag gives the lag in years between the current year
	// and the vehicle model year.
	VehicleTechnologyLag struct {
		Value Expression `xml:"value,attr"`
	} `xml:"vehicles>vehicle_technology_lag"`

	Vehicles    []*Vehicle    `xml:"vehicles>vehicle"`
	Mixes       []*Mix        `xml:"mixes>mix"`
	InputTables []*InputTable `xml:"inputs>input"`
}

Data is a holder for the LCA data within the GREET database.

type Edge

type Edge struct {
	// The OutputVertexID references a vertex in the current Pathway.
	// It is the upstream vertex.
	OutputVertexID VertexID `xml:"output-vertex,attr"`

	// Output ID references an output. The actual location of the output
	// should be in a process or another pathway.
	OutputID slca.OutputID `xml:"output-id,attr"`

	// InputVertexID either references a vertex in the current pathway
	// (the downstream vertex), or it matches the ID of one of the outputs
	// from the pathway. If it matches a pathway output, then it means
	// that this edge is to a pathway output rather than another vertex.
	InputVertexID VertexID `xml:"input-vertex,attr"`

	// InputID either matches one of the inputs in the process associated
	// with InputVertexID, or it matches one of the pathway output IDs.
	// If it matches a pathway output, then it means
	// that this edge is to a pathway output rather than another vertex.
	InputID InputID `xml:"input-id,attr"`
}

An Edge connects two vertices in a pathway or one vertex in a pathway to a pathway output.

func (*Edge) GetInputVertex

func (e *Edge) GetInputVertex(db *DB) *Vertex

GetInputVertex gets the input vertex for this edge.

func (*Edge) GetOutputVertex

func (e *Edge) GetOutputVertex(db *DB) *Vertex

GetOutputVertex gets the output vertex for this edge.

type Emission

type Emission struct {
	Ref        GasID      `xml:"ref,attr"`
	Factor     Expression `xml:"factor,attr"`
	Amount     Expression `xml:"amount,attr"`
	Calculated bool       `xml:"calculated,attr"`
}

Emission is a holder for emissions data in the GREET database.

func (*Emission) GetGas

func (e *Emission) GetGas(db *DB) *Gas

GetGas returns the gas associated with this emission

type EmissionRatio

type EmissionRatio struct {
	GasID GasID `xml:"gas_id,attr"`
	Rate  Param `xml:"rate"`
}

An EmissionRatio specifies the fraction of the total mass of an input that is emitted as a certain gas.

type EmissionYear

type EmissionYear struct {
	Year      string      `xml:"value,attr"`
	Emissions []*Emission `xml:"emission"`
}

EmissionYear is a holder for emissions information for a specific year in the GREET database.

func (*EmissionYear) GetYear

func (e *EmissionYear) GetYear() float64

GetYear converts the year of this emission from string to float format.

type EnergyIntensity

type EnergyIntensity struct {
	EnergyIntensity Param      `xml:"ei"`
	Ref             ResourceID `xml:"ref,attr"`
	Name            string     `xml:"name,attr"`
}

EnergyIntensity specifies the energy intensity of a Mode. Only used for rail.

type EvaporationShare

type EvaporationShare struct {
	Ref   GasID      `xml:"ref,attr"`
	Share Expression `xml:"share,attr"`
}

EvaporationShare gives the fraction of a given resource that evaporates as a given gas.

type Expression

type Expression string

Expression is an expression that can be evaluated

type Fuel

type Fuel struct {
	FuelRef    ResourceID   `xml:"fuel_ref,attr"`
	Pathway    ModelID      `xml:"pathway,attr"`
	Mix        ModelID      `xml:"mix,attr"`
	ShareStr   Expression   `xml:"share,attr"`
	TechToID   TechnologyID `xml:"tech_to,attr"`
	TechFromID TechnologyID `xml:"tech_from,attr"`
}

Fuel specifies a type of fuel used by a Mode.

func (*Fuel) GetFuel

func (f *Fuel) GetFuel(db *DB) *Resource

GetFuel returns the fuel that is being provided.

func (*Fuel) GetPathway

func (f *Fuel) GetPathway(db *DB) (slca.Process, *Pathway)

GetPathway returns the pathway or mix that provides the fuel.

func (*Fuel) GetShare

func (f *Fuel) GetShare(db *DB) *unit.Unit

GetShare returns the fraction of use of this fuel.

func (*Fuel) GetTechFrom

func (f *Fuel) GetTechFrom(db *DB) *Technology

GetTechFrom returns the technology that is providing inbound transportation

func (*Fuel) GetTechTo

func (f *Fuel) GetTechTo(db *DB) *Technology

GetTechTo returns the technology that is providing outbound transportation

type FuelShare

type FuelShare struct {
	Name  string      `xml:"name,attr"`
	ID    FuelShareID `xml:"id,attr"`
	Fuels []*Fuel     `xml:"fuel"`
}

FuelShare gives information on the different fuels used by a Mode.

type FuelShareID

type FuelShareID string

FuelShareID holds the ID code for a FuelShare

type Gas

type Gas struct {
	Ref                    string        `xml:"ref,attr"`
	Share                  string        `xml:"share,attr"`
	Name                   string        `xml:"name,attr"`
	ID                     GasID         `xml:"id,attr"`
	CRatio                 Expression    `xml:"c_ratio,attr"` // mass ratio
	SRatio                 Expression    `xml:"s_ratio,attr"` // mass ratio
	GlobalWarmingPotential string        `xml:"global_warming_potential,attr"`
	Membership             []*Membership `xml:"membership"`
}

Gas is a holder for emissions types in the GREET database.

func (*Gas) GetCRatio

func (g *Gas) GetCRatio(db *DB) *unit.Unit

GetCRatio returns the fraction carbon in this gas.

func (*Gas) GetID

func (g *Gas) GetID() string

GetID returns the ID number for this gas

func (*Gas) GetName

func (g *Gas) GetName() string

GetName returns the gas name.

func (*Gas) GetSRatio

func (g *Gas) GetSRatio(db *DB) *unit.Unit

GetSRatio returns the fraction sulfur in this gas.

type GasGroup

type GasGroup struct {
	ID   string `xml:"id,attr"`
	Name string `xml:"name,attr"`
}

GasGroup is a holder for gas grouping information in the GREET database.

type GasID

type GasID string

GasID holds the ID code for a gas

type Guid

type Guid string

Guid is a globally unique ID

type IOCarbonInput

type IOCarbonInput struct {
	ID    InputID `xml:"id,attr"`
	Ratio float64 `xml:"ratio,attr"`
}

IOCarbonInput is a holder for the fraction biogenic vs. fossil carbon.

type IOCarbonMap

type IOCarbonMap struct {
	Outputs []*IOCarbonOutput `xml:"output"`
}

IOCarbonMap is a holder for information about biogenic and fossil carbon

type IOCarbonOutput

type IOCarbonOutput struct {
	ID     slca.OutputID  `xml:"id,attr"`
	Inputs *IOCarbonInput `xml:"input"`
}

IOCarbonOutput is a holder for information about biogenic and fossil carbon

type Input

type Input struct {
	ID InputID `xml:"id,attr"`

	// The Source of the input. Should either be Previous, Mix, Well, or Pathway.
	Source string `xml:"source,attr"`

	// The mix that is the source of this input if Source = "Mix"
	Mix ModelID `xml:"mix,attr"`

	// The pathway that is the source of this input if Source = "Pathway".
	Pathway ModelID `xml:"pathway,attr"`

	// Is this considered the main input?
	ConsideredAsMain bool `xml:"considered_as_main,attr"`

	// Whether requirements and resource use are counted in this input. If "False",
	// only count emissions.
	AccountedInEnergyBalance string `xml:"accounted_in_energy_balance,attr"`

	// The resource that is input.
	Ref ResourceID `xml:"ref,attr"`

	// The share of this input. Used in input groups.
	Share Param `xml:"share"`

	// Technologies that use this input as a fuel source or operate on it.
	TechnologyShares []*TechnologyShare `xml:"technology"`

	// The amount of this input. Used in non-grouped inputs.
	AmountYears []*ValueYear `xml:"amount>year"`

	// EmissionRatios specify fractions of the total mass of the input that
	// are emitted as different gases.
	EmissionRatios []EmissionRatio `xml:"emission_ratio"`
}

Input is a holder for the GREET Input data type.

func (*Input) EmissionsAndResourceUse

func (in *Input) EmissionsAndResourceUse(r *slca.OnsiteResults, proc slca.Process,
	path *Pathway, noncombustion subprocess, db *DB)

EmissionsAndResourceUse calculates emissions caused and resources used by this input.

func (*Input) GetAmount

func (in *Input) GetAmount(db *DB) *unit.Unit

GetAmount gets the amount of this input.

func (*Input) GetAmountDefaultUnits

func (in *Input) GetAmountDefaultUnits(db *DB) *unit.Unit

GetAmountDefaultUnits gets the amount of this input in the default units for the input resource.

func (*Input) GetEmissionRatios

func (in *Input) GetEmissionRatios(db *DB) ([]*Gas, []*unit.Unit)

GetEmissionRatios returns the emission ratios associated with this input.

func (*Input) GetResource

func (in *Input) GetResource(db *DB) *Resource

GetResource gets the resource associated with this input.

func (*Input) GetShare

func (in *Input) GetShare(db *DB) *unit.Unit

GetShare returns the share of this input (usually as part of an input group).

func (*Input) GetSource

func (in *Input) GetSource(path *Pathway, db *DB) (slca.Process, *Pathway)

GetSource gets the source of the current input. It return the upstream process and the upstream pathway.

type InputColumn

type InputColumn struct {
	Name       string      `xml:"name,attr"`
	ID         string      `xml:"id,attr"`
	Parameters []Parameter `xml:"param"`
}

InputColumn is a holder for a GREET input data table column.

type InputGroup

type InputGroup struct {
	Type        string       `xml:"type,attr"` // This should be "efficiency" or "amount"
	Efficiency  []*ValueYear `xml:"efficiency>year"`
	Amount      []*ValueYear `xml:"amount>year"`
	InputShares []*Input     `xml:"shares>input"`
	Inputs      []*Input     `xml:"input"`
}

InputGroup is a holder for a group of inputs sharing a common efficiency or adding up to a single amount.

func (*InputGroup) EmissionsAndResourceUse

func (ig *InputGroup) EmissionsAndResourceUse(r *slca.OnsiteResults, proc slca.Process,
	path *Pathway, output OutputLike, noncombustion subprocess, db *DB)

EmissionsAndResourceUse calculates emissions caused and resources used by this input group. The returned value is a pointer and is cached for future use, so be sure to clone the result before modifying it.

type InputID

type InputID Guid

InputID holds the ID code for an input

type InputTable

type InputTable struct {
	ID         string        `xml:"id,attr"`
	TabID      string        `xml:"tabid,attr"`
	Notes      string        `xml:"notes,attr"`
	ModifiedOn string        `xml:"modified_on,attr"`
	ModifiedBy string        `xml:"modified_by,attr"`
	Columns    []InputColumn `xml:"column"`
}

InputTable is a holder for a GREET input data table.

type Location

type Location struct {
	Name       string                `xml:"name,attr"`
	Picture    string                `xml:"picture,attr"`
	ID         LocationID            `xml:"id,attr"`
	Notes      string                `xml:"notes,attr"`
	Membership []*LocationMembership `xml:"membership"`
}

Location holds information about a transportation source or destination location.

type LocationGroup

type LocationGroup struct {
	Name  string          `xml:"name,attr"`
	ID    LocationGroupID `xml:"id,attr"`
	Notes string          `xml:"notes,attr"`
}

LocationGroup holds information about how different locations can be combined into groups.

type LocationGroupID

type LocationGroupID string

LocationGroupID holds the ID code for a location group

type LocationID

type LocationID string

LocationID holds the ID code for a location

type LocationMembership

type LocationMembership struct {
	GroupID LocationGroupID `xml:"group_id,attr"`
}

LocationMembership gives information about which group a location belongs to.

type Locations

type Locations struct {
	LocationGroups []LocationGroup `xml:"groups>group"`
	Locations      []*Location     `xml:"location"`
}

Locations is a holder for transportation source and destination locations.

type Membership

type Membership struct {
	GroupID string `xml:"group_id"`
}

Membership gives a group that a resource is a member of.

type Mix

type Mix struct {
	sync.RWMutex
	ID                      ModelID        `xml:"id,attr"`
	Name                    string         `xml:"name,attr"`
	UseDefaultValues        bool           `xml:"use_default_values,attr"`
	ShareType               string         `xml:"share_type,attr"` // "energy" or "mass"
	CreatedResource         ResourceID     `xml:"created_resource,attr"`
	PathwayRefs             []*MixPathway  `xml:"pathway"`
	MixRefs                 []*MixResource `xml:"resource"`
	PreferredFunctionalUnit *Unit          `xml:"prefered_functional_unit"`
	Outputs                 []*Output      `xml:"output"`
	// contains filtered or unexported fields
}

Mix is a holder for GREET data about pathway mixes.

func (*Mix) GetID

func (m *Mix) GetID() ModelID

GetID returns the mix ID

func (*Mix) GetIDStr

func (m *Mix) GetIDStr() string

GetIDStr returns the mix ID in string form.

func (*Mix) GetMainOutput

func (m *Mix) GetMainOutput(db slca.LCADB) slca.Output

GetMainOutput returns the main output from this mix.

func (*Mix) GetName

func (m *Mix) GetName() string

GetName returns the mix name.

func (*Mix) GetOutput

func (m *Mix) GetOutput(r slca.Resource, db slca.LCADB) slca.Output

GetOutput returns the output of this mix that outputs the requested resource.

func (*Mix) GetOutputProcess

func (m *Mix) GetOutputProcess(_ *Resource, _ slca.LCADB) slca.Process

GetOutputProcess returns the receiver.

func (*Mix) MainProcessAndOutput

func (m *Mix) MainProcessAndOutput(db slca.LCADB) (slca.Process, slca.Output)

MainProcessAndOutput returns the process that outputs the main output of the receiver, and also returns that output.

func (*Mix) OnsiteResults

func (m *Mix) OnsiteResults(_ slca.Pathway, o slca.Output, lcadb slca.LCADB) *slca.OnsiteResults

OnsiteResults is required for a mix to fulfill the slca.Process interface, but pathways don't directly create any emissions. The returned value is a pointer and is cached for future use, so be sure to clone the result before modifying it.

func (*Mix) SpatialRef

func (m *Mix) SpatialRef(aqm string) *slca.SpatialRef

SpatialRef returns this spatial reference for this mix (which is NoSpatial).

func (*Mix) Type

func (m *Mix) Type() slca.ProcessType

Type returns the type of the process.

type MixPathway

type MixPathway struct {
	Ref      string        `xml:"ref,attr"`
	OutputID slca.OutputID `xml:"output,attr"`
	Shares   []*ValueYear  `xml:"shares>year"`
	Notes    string        `xml:"notes,attr"`
}

MixPathway is a holder for the corresponding GREET datatype. It defines the pathways that are upstream of the current mix.

type MixResource

type MixResource struct {
	Mix    ModelID      `xml:"mix,attr"`
	Shares []*ValueYear `xml:"shares>year"`
	Notes  string       `xml:"notes,attr"`
}

MixResource is a holder for the corresponding GREET datatype. It defines the mixes that are upstream of the current mix.

type Mode

type Mode struct {
	Name         string `xml:"name,attr"`
	Type         string `xml:"type,attr"`
	ID           ModeID `xml:"id,attr"`
	AverageSpeed Param  `xml:"average_speed"` // [length/time]

	// Load factor is the percentage of installed power that is used for the trip
	LoadFactorFrom Param `xml:"load_factor_from"` // [Dimless]
	LoadFactorTo   Param `xml:"load_factor_to"`   // [Dimless]

	FuelEconomyFrom Param `xml:"fuel_economy_from"`
	FuelEconomyTo   Param `xml:"fuel_economy_to"`

	// TypicalFC is the mass of fuel consumption per unit of output work
	// (Brake specific fuel consumption (BSFC)).
	TypicalFC Param `xml:"typical_fc"` // [mass/energy]

	// TypicalHP is the amount of power required when the vehicle is unloaded.
	TypicalHP Param `xml:"typical_hp"` // [power]

	// HPFactor is the amount of additional power required per unit mass of payload.
	HPFactor Param `xml:"hp_factor"` // [power/mass]

	// EnergyIntensity is energy used per unit distance per unit payload mass. It is only reported
	// directly for the rail mode.
	EnergyIntensity Param `xml:"ei"` // [energy/distance/mass]

	// BSFCAdjustment defines how (brake-specific) fuel consumption varies with
	// varying load factor.
	BSFCAdjustment Param `xml:"bsfc_adjustment"`

	FuelShares []*FuelShare `xml:"fuel_shares>share"`
	Payloads   []*Payload   `xml:"payload>material_transported"`

	// Energy intensity for pipelines
	EnergyIntensities []*EnergyIntensity `xml:"energy_intensity>material_transported"`
}

Mode is a holder for information about a transportation mode.

func (*Mode) CalculateEnergyIntensity

func (m *Mode) CalculateEnergyIntensity(materialTransported *Resource,
	fuel *Fuel, db *DB) (from, to *unit.Unit)

CalculateEnergyIntensity returns the energy used per unit distance per unit payload mass for this mode, for both the outbound and inbound legs of the journey.

func (*Mode) GetAverageSpeed

func (m *Mode) GetAverageSpeed(db *DB) *unit.Unit

GetAverageSpeed returns the average speed for this mode.

func (*Mode) GetBSFCAdjustment

func (m *Mode) GetBSFCAdjustment(db *DB) *unit.Unit

GetBSFCAdjustment returns the brake-specific fuel consumption adjustment factor.

func (*Mode) GetFuelEconomyFrom

func (m *Mode) GetFuelEconomyFrom(db *DB) *unit.Unit

GetFuelEconomyFrom returns the fuel economy in the from or inbound direction.

func (*Mode) GetFuelEconomyTo

func (m *Mode) GetFuelEconomyTo(db *DB) *unit.Unit

GetFuelEconomyTo returns the fuel economy in the to or outbound direction.

func (*Mode) GetHPFactor

func (m *Mode) GetHPFactor(db *DB) *unit.Unit

GetHPFactor gets the power adjustment factor.

func (*Mode) GetLoadFactorFrom

func (m *Mode) GetLoadFactorFrom(db *DB) *unit.Unit

GetLoadFactorFrom returns the load factor in the from or inbound direction.

func (*Mode) GetLoadFactorTo

func (m *Mode) GetLoadFactorTo(db *DB) *unit.Unit

GetLoadFactorTo returns the load factor in the to or outbound direction.

func (*Mode) GetPayload

func (m *Mode) GetPayload(r *Resource, db *DB) *unit.Unit

GetPayload returns the payload for this mode carrying the specified resource.

func (*Mode) GetPipelineEnergyIntensity

func (m *Mode) GetPipelineEnergyIntensity(r *Resource, db *DB) *unit.Unit

GetPipelineEnergyIntensity gets the energy intensity for the mode in transporting the given resource. It only works for pipelines.

func (*Mode) GetRailEnergyIntensity

func (m *Mode) GetRailEnergyIntensity(db *DB) *unit.Unit

GetRailEnergyIntensity returns the energy intensity for the rail mode.

func (*Mode) GetTypicalFC

func (m *Mode) GetTypicalFC(db *DB) *unit.Unit

GetTypicalFC returns the typical fuel consumption.

func (*Mode) GetTypicalHP

func (m *Mode) GetTypicalHP(db *DB) *unit.Unit

GetTypicalHP returns the typical power consumption.

type ModeID

type ModeID Guid

ModeID holds the ID code for a travel mode

type ModelID

type ModelID string

ModelID holds the ID code for a Process model (TransportationProcess or StationaryProcess)

type NLoss

type NLoss struct {
	Rate       Expression `xml:"rate,attr"`
	Dependency string     `xml:"dependency,attr"`
}

NLoss is a holder for product loss fraction during a transportation step.

type OtherEmission

type OtherEmission struct {
	// TODO: What does MostRecent mean?
	MostRecent string       `xml:"mostRecent,attr"`
	Ref        GasID        `xml:"ref,attr"`
	ValueYears []*ValueYear `xml:"year"`
	Notes      string       `xml:"notes,attr"`
}

OtherEmission is a holder for "other" emissions from StationaryProcesses.

func (*OtherEmission) Amount

func (e *OtherEmission) Amount(db *DB) *unit.Unit

Amount returns the amount of emission.

func (*OtherEmission) Gas

func (e *OtherEmission) Gas(db *DB) *Gas

Gas returns the gas associated with this emission

type Output

type Output struct {
	ID          slca.OutputID `xml:"id,attr"`
	ResourceID  ResourceID    `xml:"resource,attr"`
	Ref         ResourceID    `xml:"ref,attr"`
	AmountYears []*ValueYear  `xml:"amount>year"`
	NLoss       *NLoss        `xml:"nloss"`
}

Output is a holder for the type and amount of a resource that is output from a process or pathway.

func (*Output) CalcAllocationAmount

func (o *Output) CalcAllocationAmount(outputUnit unit.Dimensions, AllocationMethod string,
	db *DB) *unit.Unit

CalcAllocationAmount calculates the amount of this output to be used when allocating resource use and emissions. If AllocationMethod is "", it allocates all emissions to the main output and none to the coproducts.

func (*Output) GetAmount

func (o *Output) GetAmount(db *DB) *unit.Unit

GetAmount calculates the amount of this output after accounting for losses.

func (*Output) GetAmountBeforeLoss

func (o *Output) GetAmountBeforeLoss(db *DB) *unit.Unit

GetAmountBeforeLoss calculates the amount of this output without accounting for losses.

func (*Output) GetID

func (o *Output) GetID() slca.OutputID

GetID returns the ID of this output.

func (*Output) GetLossEmissions

func (o *Output) GetLossEmissions(db *DB) ([]*Gas, []*unit.Unit)

GetLossEmissions calculates emissions through evaporation of a product (or other losses).

func (*Output) GetNLoss

func (o *Output) GetNLoss(db *DB) *unit.Unit

GetNLoss returns the loss rate associated with this output.

func (*Output) GetName

func (o *Output) GetName(db *DB) string

GetName returns the name out the resource output by this output.

func (*Output) GetProcess

func (o *Output) GetProcess(path *Pathway, db *DB) slca.Process

GetProcess returns the process associated with this output.

func (*Output) GetResource

func (o *Output) GetResource(db slca.LCADB) slca.Resource

GetResource returns the resource associated with this output.

func (*Output) IsCoproduct

func (o *Output) IsCoproduct() bool

IsCoproduct returns whether this output is a coproduct. It is an output, not a coproduct, the the answer is always false.

type OutputLike

type OutputLike interface {
	IsCoproduct() bool
	GetName(*DB) string
	GetAmount(*DB) *unit.Unit
	GetAmountBeforeLoss(*DB) *unit.Unit
	GetResource(slca.LCADB) slca.Resource
	GetProcess(*Pathway, *DB) slca.Process
	GetID() slca.OutputID
	CalcAllocationAmount(outputUnits unit.Dimensions,
		AllocationMethod string, db *DB) *unit.Unit
	GetLossEmissions(*DB) ([]*Gas, []*unit.Unit)
}

OutputLike is an interface that allows the use of outputs and coproducts together.

type Param

type Param struct {
	// TODO: What does MostRecent mean?
	MostRecent string       `xml:"mostRecent,attr"`
	ValueYears []*ValueYear `xml:"year"`
}

Param is one type of variable parameter from the GREET database (different from Parameter).

type Parameter

type Parameter struct {
	Name       string     `xml:"name,attr"`
	ID         string     `xml:"id,attr"`
	Value      Expression `xml:"value,attr"`
	ValueYears *Param     `xml:"values"`
}

Parameter is one type of variable parameter from the GREET database (different from Param). It holds the data in a GREET input table cell.

type Pathway

type Pathway struct {
	sync.RWMutex
	ID         ModelID       `xml:"id,attr"`
	Name       string        `xml:"name,attr"`
	Notes      string        `xml:"notes,attr"`
	MainOutput slca.OutputID `xml:"main-output,attr"`
	Vertices   []*Vertex     `xml:"vertex"`
	Edges      []*Edge       `xml:"edge"`
	Outputs    []*Output     `xml:"output"`
}

Pathway is holder for a pathway in the GREET model. Refer to the GREET documentation for more information.

func (*Pathway) GetID

func (path *Pathway) GetID() ModelID

GetID gets the pathway ID.

func (*Pathway) GetIDStr

func (path *Pathway) GetIDStr() string

GetIDStr gets the pathway ID in string format

func (*Pathway) GetMainOutput

func (path *Pathway) GetMainOutput(_ slca.LCADB) slca.Output

GetMainOutput returns the main output from this pathway.

func (*Pathway) GetName

func (path *Pathway) GetName() string

GetName gets the name of this pathway.

func (*Pathway) GetOutput

func (path *Pathway) GetOutput(rI slca.Resource, lcadb slca.LCADB) slca.Output

GetOutput returns the output from this pathway that outputs resource r.

func (*Pathway) GetOutputProcess

func (path *Pathway) GetOutputProcess(r *Resource, lcadb slca.LCADB) slca.Process

GetOutputProcess returns the process that outputs resource r. It assumes only one process outputs resource r from this pathway.

func (*Pathway) MainProcessAndOutput

func (path *Pathway) MainProcessAndOutput(lcadb slca.LCADB) (slca.Process, slca.Output)

MainProcessAndOutput returns the process that outputs the main output of the receiver, and also returns that output.

func (*Pathway) Type

func (path *Pathway) Type() string

Type returns the type: "Pathway".

func (*Pathway) VertexForMainOutput

func (path *Pathway) VertexForMainOutput() *Vertex

VertexForMainOutput returns the vertex associated with the main output of the pathway.

func (*Pathway) VertexForOutput

func (path *Pathway) VertexForOutput(o *Output, db *DB) *Vertex

VertexForOutput returns the vertex associated with the given pathway output.

type PathwayLike

type PathwayLike interface {
	GetName() string
	GetID() ModelID
	GetMainOutput(slca.LCADB) slca.Output
	GetOutput(slca.Resource, slca.LCADB) slca.Output
	GetOutputProcess(*Resource, slca.LCADB) slca.Process
}

PathwayLike is an interface for things that can be treated like a pathway.

type Payload

type Payload struct {
	Payload Expression `xml:"payload,attr"`
	Ref     ResourceID `xml:"ref,attr"`
}

Payload specifies the amount of a given resource that a Mode can carry.

type Product

type Product struct {
	Ref       ResourceID `xml:"ref,attr"`
	PathwayID ModelID    `xml:"pathway,attr"`
	MixID     ModelID    `xml:"mix,attr"`
	RatioStr  Expression `xml:"ratio,attr"`
}

Product is a holder for information about the product that is being displaced by a coproduct.

func (*Product) GetProcess

func (p *Product) GetProcess(r *Resource, db *DB) (slca.Process, *Pathway)

GetProcess returns the process and pathway this coproduct is displacing.

func (*Product) GetRatio

func (p *Product) GetRatio(db *DB) *unit.Unit

GetRatio returns the displacement ratio for this coproduct.

func (*Product) GetResource

func (p *Product) GetResource(db slca.LCADB) *Resource

GetResource returns the resource associated with this product.

type Resource

type Resource struct {
	HiddenAsMain    bool                `xml:"hidden_as_main,attr"`
	CanBePrimary    bool                `xml:"can_be_primary,attr"`
	MarketValue     Expression          `xml:"market_value,attr"`
	Density         Expression          `xml:"density,attr"`
	HeatingValueHHV Expression          `xml:"heating_value_hhv,attr"`
	HeatingValueLHV Expression          `xml:"heating_value_lhv,attr"`
	Temperature     string              `xml:"temperature,attr"`
	Pressure        string              `xml:"pressure,attr"`
	ID              ResourceID          `xml:"id,attr"`
	Name            string              `xml:"name,attr"`
	CRatio          Expression          `xml:"c_ratio,attr"`
	SRatioDefault   Expression          `xml:"s_ratio,attr"`
	SRatioYear      []*ValueYear        `xml:"s_ratio>year"`
	State           string              `xml:"state,attr"`
	Family          string              `xml:"family,attr"`
	NickName        []string            `xml:"nick_name"`
	Membership      []*Membership       `xml:"membership"`
	Compatibility   []*Compatibility    `xml:"compatibility"`
	Evaporation     []*EvaporationShare `xml:"evaporation>gas"`
}

Resource is a holder for the GREET model Resource type. Refer to the GREET documentation for more information.

func (*Resource) ConvertToDefaultUnits

func (r *Resource) ConvertToDefaultUnits(amt *unit.Unit, dbI slca.LCADB) *unit.Unit

ConvertToDefaultUnits converts the amount of the resource to the default units for this resource: energy for resources in in the "energy" state and mass for all other states. If the resource doesn't contain enough information to make the conversion, however, the original value will be returned.

func (*Resource) ConvertToEnergy

func (r *Resource) ConvertToEnergy(amt *unit.Unit, db *DB) *unit.Unit

ConvertToEnergy converts an amount of this resource to energy units.

func (*Resource) ConvertToMarketValue

func (r *Resource) ConvertToMarketValue(amt *unit.Unit, db *DB) *unit.Unit

ConvertToMarketValue converts an amount of this resource to its market value

func (*Resource) ConvertToMass

func (r *Resource) ConvertToMass(amt *unit.Unit, db *DB) *unit.Unit

ConvertToMass converts an amount of this resource to mass units.

func (*Resource) ConvertToVolume

func (r *Resource) ConvertToVolume(amt *unit.Unit, db *DB) *unit.Unit

ConvertToVolume converts an amount of this resource to volume units.

func (*Resource) GetCRatio

func (r *Resource) GetCRatio(db *DB) *unit.Unit

GetCRatio returns the fraction carbon in this resource.

func (*Resource) GetDensity

func (r *Resource) GetDensity(db *DB) *unit.Unit

GetDensity returns the density of this resource.

func (*Resource) GetEvaporationShares

func (r *Resource) GetEvaporationShares(db *DB) ([]*Gas, []*unit.Unit)

GetEvaporationShares returns the gas that this resource evaporates to, and the fraction that is evaporated.

func (*Resource) GetHeatingValueMass

func (r *Resource) GetHeatingValueMass(db *DB) *unit.Unit

GetHeatingValueMass returns the mass-specific heating value for this resource.

func (*Resource) GetHeatingValueVolume

func (r *Resource) GetHeatingValueVolume(db *DB) *unit.Unit

GetHeatingValueVolume returns the volume-specific heating value for this resource.

func (*Resource) GetID

func (r *Resource) GetID() string

GetID gets the ID of this Resource.

func (*Resource) GetMarketValue

func (r *Resource) GetMarketValue(db *DB) *unit.Unit

GetMarketValue returns the market value for this resource.

func (*Resource) GetName

func (r *Resource) GetName() string

GetName gets the name of this resource.

func (*Resource) GetSRatio

func (r *Resource) GetSRatio(db *DB) *unit.Unit

GetSRatio returns the fraction sulfur in this resource.

func (*Resource) IsCompatible

func (r *Resource) IsCompatible(other *Resource) bool

IsCompatible returns true if two resources are compatible.

type ResourceGroup

type ResourceGroup struct {
	ID        string `xml:"id,attr"`
	Name      string `xml:"name"`
	IncludeIn string `xml:"include_in"`
}

ResourceGroup is a group of resources.

type ResourceID

type ResourceID string

ResourceID holds the ID code for a resource

type StationaryProcess

type StationaryProcess struct {
	sync.RWMutex            `xml:"-"`
	ID                      ModelID          `xml:"id,attr"`
	Name                    string           `xml:"name,attr"`
	IOCarbonMap             *IOCarbonMap     `xml:"io-carbon-map"`
	PreferredFunctionalUnit *Unit            `xml:"prefered_functional_unit"`
	Outputs                 []*Output        `xml:"output"`
	Inputs                  []*Input         `xml:"input"`
	InputGroups             []*InputGroup    `xml:"group"`
	Coproducts              *Coproducts      `xml:"coproducts"`
	OtherEmissions          []*OtherEmission `xml:"other_emissions>emission"`
	Notes                   string           `xml:"notes,attr"`

	// Spatial reference information for this process
	SpatialReference *slca.SpatialRef

	// NoncombustionSCC is used for speciating non-combustion emissions.
	NoncombustionSCC slca.SCC
	// contains filtered or unexported fields
}

StationaryProcess is a holder for stationary process data from the GREET database.

func (*StationaryProcess) GetID

func (p *StationaryProcess) GetID() ModelID

GetID returns the ID of this process.

func (*StationaryProcess) GetIDStr

func (p *StationaryProcess) GetIDStr() string

GetIDStr returns the ID of this process in string format.

func (*StationaryProcess) GetMainOutput

func (p *StationaryProcess) GetMainOutput(db slca.LCADB) slca.Output

GetMainOutput gets the main output of this process. It panics if there is more than one main output.

func (*StationaryProcess) GetName

func (p *StationaryProcess) GetName() string

GetName returns the name of this process.

func (*StationaryProcess) GetOutput

func (p *StationaryProcess) GetOutput(rI slca.Resource, db slca.LCADB) slca.Output

GetOutput gets the output (or coproduct) of this process that outputs the given resource. It assumes that there is only one output or coproduct for each resource. It panics if none of the outputs output the given resource.

func (*StationaryProcess) OnsiteResults

func (p *StationaryProcess) OnsiteResults(pathI slca.Pathway, outputI slca.Output, lcadb slca.LCADB) *slca.OnsiteResults

OnsiteResults calculates the onsite emissions from and resource use of this process per unit output, where "output" is the output that is required from the process, "path" is the pathway the process is a part of.

func (*StationaryProcess) SpatialRef

func (p *StationaryProcess) SpatialRef(aqm string) *slca.SpatialRef

SpatialRef returns the spatial reference for the receiver.

func (*StationaryProcess) Type

Type returns the process type.

type Step

type Step struct {
	DestRef      LocationID  `xml:"dest_ref,attr"`
	OriginRef    LocationID  `xml:"origin_ref,attr"`
	Ref          ModeID      `xml:"ref,attr"`
	Distance     Param       `xml:"distance"`
	Share        Param       `xml:"share"`
	FuelShareRef FuelShareID `xml:"fuel_share_ref,attr"`
	BackHaul     bool        `xml:"back_haul,attr"` // Is an empty backhaul required?
	ID           string      `xml:"id,attr"`
	NLoss        *NLoss      `xml:"nloss"`
}

Step is a holder for a step in a transportation process.

func (*Step) GetDistance

func (s *Step) GetDistance(db *DB) *unit.Unit

GetDistance returns the distance traveled by this step.

func (*Step) GetLossAmount

func (s *Step) GetLossAmount(res *Resource, amountTransported *unit.Unit,
	db *DB) *unit.Unit

GetLossAmount calculates the loss of the transported resource during this step.

func (*Step) GetLossEmissions

func (s *Step) GetLossEmissions(res *Resource, amountTransported *unit.Unit, db *DB) (
	[]*Gas, []*unit.Unit)

GetLossEmissions calculates emissions through evaporation of a product (or other losses).

func (*Step) GetModeAndFuelShare

func (s *Step) GetModeAndFuelShare(db *DB) (*Mode, *FuelShare)

GetModeAndFuelShare gets the mode and fuel share associated with this step

func (*Step) GetNLoss

func (s *Step) GetNLoss(db *DB) *unit.Unit

GetNLoss returns the fraction of product that is lost during this step.

func (*Step) GetShare

func (s *Step) GetShare(db *DB) *unit.Unit

GetShare gets the share of the product that is transported by this step.

type Technology

type Technology struct {
	ID            TechnologyID    `xml:"id,attr"`
	Name          string          `xml:"name,attr"`
	InputRef      ResourceID      `xml:"inputRef,attr"`
	OutputRef     ResourceID      `xml:"outputRef,attr"`
	MassTransfer  string          `xml:"massTransfer,attr"`
	BaseTech      string          `xml:"basetech,attr"`
	EmissionsYear []*EmissionYear `xml:"year"`

	SCC slca.SCC
}

Technology is a holder for the GREET technology type. Refer to the GREET documentation for more information.

func (*Technology) GetEmissions

func (t *Technology) GetEmissions(db *DB) ([]*Gas, []*unit.Unit)

GetEmissions returns the emissions associated with this technology

func (*Technology) GetID

func (t *Technology) GetID() VertexID

GetID returns the ID of this Technology.

func (*Technology) GetInputResource

func (t *Technology) GetInputResource(db *DB) *Resource

GetInputResource gets the resource used as an input for this technology

func (*Technology) GetName

func (t *Technology) GetName() string

GetName returns the name of this technology.

func (*Technology) GetOutputResource

func (t *Technology) GetOutputResource(db *DB) *Resource

GetOutputResource gets the resource output by this technology

func (*Technology) GetSCC

func (t *Technology) GetSCC() slca.SCC

GetSCC returns the SCC code associated with this technology.

type TechnologyID

type TechnologyID string

TechnologyID holds the ID code for a technology

type TechnologyShare

type TechnologyShare struct {
	Ref              TechnologyID `xml:"ref,attr"`
	Share            Param        `xml:"share"`
	AccountInBalance bool         `xml:"account_in_balance,attr"`
}

TechnologyShare holds information about the fraction of work done by a technology.

func (*TechnologyShare) GetShare

func (ts *TechnologyShare) GetShare(db *DB) *unit.Unit

GetShare returns the share associated with this TechnologyShare

func (*TechnologyShare) GetTechnology

func (ts *TechnologyShare) GetTechnology(db *DB) *Technology

GetTechnology returns the Technology associated with this TechnologyShare

type TransportationProcess

type TransportationProcess struct {
	sync.RWMutex            `xml:"-"`
	ID                      ModelID      `xml:"id,attr"`
	Name                    string       `xml:"name,attr"`
	IOCarbonMap             *IOCarbonMap `xml:"io-carbon-map"`
	PreferredFunctionalUnit *Unit        `xml:"prefered_functional_unit"`
	Outputs                 []*Output    `xml:"output"`
	Inputs                  []*Input     `xml:"input"`
	MoistureStr             Expression   `xml:"moisture,attr"`
	Steps                   []*Step      `xml:"step"`
	Notes                   string       `xml:"notes,attr"`
	// contains filtered or unexported fields
}

TransportationProcess is a holder for transportation process data from the GREET database.

func (*TransportationProcess) GetID

func (p *TransportationProcess) GetID() ModelID

GetID returns the ID of this process.

func (*TransportationProcess) GetIDStr

func (p *TransportationProcess) GetIDStr() string

GetIDStr returns the ID of this process in string format.

func (*TransportationProcess) GetInput

func (p *TransportationProcess) GetInput() *Input

GetInput gets the single input to this process. It panics if there is more than one input.

func (*TransportationProcess) GetMainOutput

func (p *TransportationProcess) GetMainOutput(db slca.LCADB) slca.Output

GetMainOutput gets the main output of this process. It panics if there is more than one main output.

func (*TransportationProcess) GetName

func (p *TransportationProcess) GetName() string

GetName gets the name of this process.

func (*TransportationProcess) GetOutput

func (p *TransportationProcess) GetOutput(res slca.Resource, db slca.LCADB) slca.Output

GetOutput gets the output of this process that outputs the given resource. Transportation processes should only have one output, so it panics if there is more or less than one output or if the output does not output the given resource.

func (*TransportationProcess) OnsiteResults

func (p *TransportationProcess) OnsiteResults(pathI slca.Pathway, outputI slca.Output, lcadb slca.LCADB) *slca.OnsiteResults

OnsiteResults calculates the onsite emissions from and resource use of this process per unit output, where "output" is the output that is required from the process, "path" is the pathway the process is a part of. The returned value is a pointer and is cached for future use, so be sure to clone the result before modifying it.

func (*TransportationProcess) SpatialRef

func (p *TransportationProcess) SpatialRef(aqm string) *slca.SpatialRef

SpatialRef returns the spatial reference for the receiver. TODO: Need to implement something for this.

func (*TransportationProcess) Type

Type returns the process type.

type Unit

type Unit struct {
	Unit    string  `xml:"unit,attr"`
	Amount  float64 `xml:"amount,attr"`
	Enabled bool    `xml:"enabled,attr"`
}

Unit is a holder for a value with units.

type ValueYear

type ValueYear struct {
	Value Expression `xml:"value,attr"`
	Year  string     `xml:"year,attr"`
}

ValueYear is a holder for a value that applies to a specific year.

func (*ValueYear) GetValue

func (v *ValueYear) GetValue(db *DB) *unit.Unit

GetValue returns the value.

func (*ValueYear) GetYear

func (v *ValueYear) GetYear() float64

GetYear returns the year.

type Vehicle

type Vehicle struct {
	sync.Mutex
	ID    ModelID `xml:"id,attr"`
	Name  string  `xml:"name,attr"`
	Notes string  `xml:"notes,attr"`

	// Modes gives information on the mode the vehicle is operating in.
	// Plug-in hybrid vehicles can operate in multiple modes.
	Modes []struct {
		Name string  `xml:"name,attr"`
		ID   ModelID `xml:"id,attr"`

		VMTShare []*ValueYear `xml:"vmtShare>year"`

		// Plant holds information about a vehicle power plant.
		Plant struct {
			Name  string `xml:"name,attr"`
			ID    Guid   `xml:"id,attr"`
			Notes string `xml:"notes,attr"`

			Fuel struct {
				Resource           ResourceID   `xml:"ref,attr"`
				Pathway            ModelID      `xml:"pathway,attr"`
				Consumption        []*ValueYear `xml:"consumption>year"`
				ChargingEfficiency []*ValueYear `xml:"charging_efficiency>year"`
			} `xml:"fuel"`

			Emissions []struct {
				Gas   GasID        `xml:"id,attr"`
				Value []*ValueYear `xml:"value_ts>year"`
			} `xml:"emission"`
		} `xml:"plant"`
	} `xml:"mode"`

	LifetimeVMT []*ValueYear `xml:"lifetime_vmt>year"`

	// Manufacturing holds information about
	// emissions and resource use from the manufacturing
	// of groups of vehicle components.
	Manufacturing []struct {
		Name string `xml:"name,attr"`

		// Materials holds information on materials
		// used in vehicle manufacturing.
		Materials []struct {
			Resource   ResourceID `xml:"resource_id,attr"`
			Source     ModelID    `xml:"entity_id,attr"`
			SourceType string     `xml:"source_type,attr"`

			// Quantity is the amount needed of this
			// pathway per unit.
			Quantity []*ValueYear `xml:"quantity>year"`

			// Replacements is the number of times each
			// unit will need to be replaced during
			// the vehicle lifetime.
			Replacements []*ValueYear `xml:"replacements>year"`

			// Units is the number of units per vehicle.
			Units []*ValueYear `xml:"units>year"`
		} `xml:"material"`
	} `xml:"manufacturing"`

	NonCombustionEmissions []struct {
		Gas    GasID        `xml:"id,attr"`
		Values []*ValueYear `xml:"year"`
	} `xml:"nonCombustionEmission"`

	// SCC is the SCC code for this vehicle.
	SCC slca.SCC
	// contains filtered or unexported fields
}

Vehicle is a holder for information about a vehicle in the GREET database.

func (*Vehicle) GetID

func (v *Vehicle) GetID() ModelID

GetID returns the vehicle ID

func (*Vehicle) GetIDStr

func (v *Vehicle) GetIDStr() string

GetIDStr returns the ID of this vehicle in string format

func (*Vehicle) GetMainOutput

func (v *Vehicle) GetMainOutput(_ slca.LCADB) slca.Output

GetMainOutput always returns nil because vehicles have no process outputs.

func (*Vehicle) GetName

func (v *Vehicle) GetName() string

GetName returns the name of this vehicle.

func (*Vehicle) GetOutput

func (v *Vehicle) GetOutput(_ slca.Resource, _ slca.LCADB) slca.Output

GetOutput always returns nil because vehicles have no process outputs.

func (*Vehicle) MainProcessAndOutput

func (v *Vehicle) MainProcessAndOutput(db slca.LCADB) (slca.Process, slca.Output)

MainProcessAndOutput returns the process that outputs the main output of the receiver, and also returns that output.

func (*Vehicle) OnsiteResults

func (v *Vehicle) OnsiteResults(_ slca.Pathway, _ slca.Output, lcadb slca.LCADB) *slca.OnsiteResults

OnsiteResults calculates the from-vehicle emissions and vehicle resource use per unit output as part of a life cycle calculation, as well as requirements of other pathways. The returned results are emissions and resource use per meter driven by the vehicle.

func (*Vehicle) SpatialRef

func (v *Vehicle) SpatialRef(aqm string) *slca.SpatialRef

SpatialRef returns the spatial reference for the receiver. TODO: Need to implement something for this.

func (*Vehicle) Type

func (v *Vehicle) Type() slca.ProcessType

Type returns the type of this process.

type Vertex

type Vertex struct {
	ID      VertexID `xml:"id,attr"`
	ModelID ModelID  `xml:"model-id,attr"`
	Type    string   `xml:"type,attr"` // 0=process; 1=pathway; 2=mix
}

Vertex is a holder for the Vertex datatype in the GREET database.

func (*Vertex) GetProcess

func (this *Vertex) GetProcess(requestingPath *Pathway, resource *Resource,
	db *DB) (slca.Process, *Pathway)

GetProcess finds the corresponding process model for this vertex. It can be a *StationaryProcess, *TransportationProcess, *Pathway, or *Mix. If it is a stationary or transportation process, it is assumed to be part of the requestingPathway.

type VertexID

type VertexID Guid

VertexID holds the ID code for a vertex

Jump to

Keyboard shortcuts

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