pub struct AssetRef(Rc<Asset>);Expand description
Tuple Fields§
§0: Rc<Asset>Implementations§
Source§impl AssetRef
impl AssetRef
Sourcefn into_for_each_child<F>(self, next_group_id: &mut u32, f: F)
fn into_for_each_child<F>(self, next_group_id: &mut u32, f: F)
Apply a function to each of this asset’s children, consuming the asset in the process.
If this asset is divisible, the first argument to f will be this asset after it has been
converted to a parent and the second will be each child.
If this asset is non-divisible (i.e. does not have a discrete capacity), then f will be
called with the first argument set to None and the second will be self.
When the asset has a discrete capacity, each of the children will be made up of a single unit of the original asset’s unit size.
Panics if this asset’s state is not Future or Selected.
Methods from Deref<Target = Asset>§
Sourcepub fn state(&self) -> &AssetState
pub fn state(&self) -> &AssetState
Get the state of this asset
Sourcepub fn process_parameter(&self) -> &ProcessParameter
pub fn process_parameter(&self) -> &ProcessParameter
The process parameter for this asset
Sourcepub fn max_decommission_year(&self) -> u32
pub fn max_decommission_year(&self) -> u32
The last year in which this asset should be decommissioned
Sourcepub fn get_activity_per_capacity_limits(
&self,
time_slice: &TimeSliceID,
) -> RangeInclusive<ActivityPerCapacity>
pub fn get_activity_per_capacity_limits( &self, time_slice: &TimeSliceID, ) -> RangeInclusive<ActivityPerCapacity>
Get the activity limits per unit of capacity for this asset in a particular time slice
Sourcepub fn get_activity_limits_for_selection(
&self,
time_slice_selection: &TimeSliceSelection,
) -> RangeInclusive<Activity>
pub fn get_activity_limits_for_selection( &self, time_slice_selection: &TimeSliceSelection, ) -> RangeInclusive<Activity>
Get the activity limits for this asset for a given time slice selection
Sourcepub fn iter_activity_limits(
&self,
) -> impl Iterator<Item = (TimeSliceSelection, RangeInclusive<Activity>)> + '_
pub fn iter_activity_limits( &self, ) -> impl Iterator<Item = (TimeSliceSelection, RangeInclusive<Activity>)> + '_
Iterate over activity limits for this asset
Sourcepub fn iter_activity_per_capacity_limits(
&self,
) -> impl Iterator<Item = (TimeSliceSelection, RangeInclusive<ActivityPerCapacity>)> + '_
pub fn iter_activity_per_capacity_limits( &self, ) -> impl Iterator<Item = (TimeSliceSelection, RangeInclusive<ActivityPerCapacity>)> + '_
Iterate over activity per capacity limits for this asset
Sourcepub fn get_total_output_per_activity(&self) -> FlowPerActivity
pub fn get_total_output_per_activity(&self) -> FlowPerActivity
Gets the total SED/SVD output per unit of activity for this asset
Note: Since we are summing coefficients from different commodities, this ONLY makes sense if these commodities have the same units (e.g., all in PJ). Users are currently not made to give units for commodities, so we cannot possibly enforce this. Something to potentially address in future.
Sourcepub fn get_operating_cost(
&self,
year: u32,
time_slice: &TimeSliceID,
) -> MoneyPerActivity
pub fn get_operating_cost( &self, year: u32, time_slice: &TimeSliceID, ) -> MoneyPerActivity
Get the operating cost for this asset in a given year and time slice
Sourcepub fn get_revenue_from_flows(
&self,
prices: &CommodityPrices,
time_slice: &TimeSliceID,
) -> MoneyPerActivity
pub fn get_revenue_from_flows( &self, prices: &CommodityPrices, time_slice: &TimeSliceID, ) -> MoneyPerActivity
Get the total revenue from all flows for this asset.
If a price is missing, it is assumed to be zero.
Sourcepub fn get_revenue_from_flows_excluding_primary(
&self,
prices: &CommodityPrices,
time_slice: &TimeSliceID,
) -> MoneyPerActivity
pub fn get_revenue_from_flows_excluding_primary( &self, prices: &CommodityPrices, time_slice: &TimeSliceID, ) -> MoneyPerActivity
Get the total revenue from all flows excluding the primary output.
If a price is missing, it is assumed to be zero.
Sourcepub fn get_input_cost_from_prices(
&self,
prices: &CommodityPrices,
time_slice: &TimeSliceID,
) -> MoneyPerActivity
pub fn get_input_cost_from_prices( &self, prices: &CommodityPrices, time_slice: &TimeSliceID, ) -> MoneyPerActivity
Get the total cost of purchasing input commodities per unit of activity for this asset.
If a price is missing, there is assumed to be no cost.
Sourcefn get_revenue_from_flows_with_filter<F>(
&self,
prices: &CommodityPrices,
time_slice: &TimeSliceID,
filter_for_flows: F,
) -> MoneyPerActivity
fn get_revenue_from_flows_with_filter<F>( &self, prices: &CommodityPrices, time_slice: &TimeSliceID, filter_for_flows: F, ) -> MoneyPerActivity
Get the total revenue from a subset of flows.
Takes a function as an argument to filter the flows. If a price is missing, it is assumed to be zero.
Sourcefn get_generic_activity_cost(
&self,
prices: &CommodityPrices,
year: u32,
time_slice: &TimeSliceID,
) -> MoneyPerActivity
fn get_generic_activity_cost( &self, prices: &CommodityPrices, year: u32, time_slice: &TimeSliceID, ) -> MoneyPerActivity
Get the generic activity cost per unit of activity for this asset.
These are all activity-related costs that are not associated with specific SED/SVD outputs. Includes levies, flow costs, costs of inputs and variable operating costs
Sourcepub fn iter_marginal_costs_with_filter<'a>(
&'a self,
prices: &'a CommodityPrices,
year: u32,
time_slice: &'a TimeSliceID,
filter: impl Fn(&CommodityID) -> bool + 'a,
) -> Box<dyn Iterator<Item = (CommodityID, MoneyPerFlow)> + 'a>
pub fn iter_marginal_costs_with_filter<'a>( &'a self, prices: &'a CommodityPrices, year: u32, time_slice: &'a TimeSliceID, filter: impl Fn(&CommodityID) -> bool + 'a, ) -> Box<dyn Iterator<Item = (CommodityID, MoneyPerFlow)> + 'a>
Iterate over marginal costs for a filtered set of SED/SVD output commodities for this asset
For each SED/SVD output commodity, the marginal cost is calculated as the sum of:
- Generic activity costs (variable operating costs, cost of purchasing inputs, plus all levies and flow costs not associated with specific SED/SVD outputs), which are shared equally over all SED/SVD outputs
- Production levies and flow costs for the specific SED/SVD output commodity
Sourcepub fn iter_marginal_costs<'a>(
&'a self,
prices: &'a CommodityPrices,
year: u32,
time_slice: &'a TimeSliceID,
) -> Box<dyn Iterator<Item = (CommodityID, MoneyPerFlow)> + 'a>
pub fn iter_marginal_costs<'a>( &'a self, prices: &'a CommodityPrices, year: u32, time_slice: &'a TimeSliceID, ) -> Box<dyn Iterator<Item = (CommodityID, MoneyPerFlow)> + 'a>
Iterate over marginal costs for all SED/SVD output commodities for this asset
See iter_marginal_costs_with_filter for details.
Sourcepub fn get_annual_capital_cost_per_capacity(&self) -> MoneyPerCapacity
pub fn get_annual_capital_cost_per_capacity(&self) -> MoneyPerCapacity
Get the annual capital cost per unit of capacity for this asset
Sourcepub fn get_annual_fixed_costs_per_activity(
&self,
annual_activity: Activity,
) -> MoneyPerActivity
pub fn get_annual_fixed_costs_per_activity( &self, annual_activity: Activity, ) -> MoneyPerActivity
Get the annual fixed costs (AFC) per unit of activity for this asset
Total capital costs and fixed opex are shared equally over the year in accordance with the annual activity.
Sourcepub fn get_annual_fixed_costs_per_flow(
&self,
annual_activity: Activity,
) -> MoneyPerFlow
pub fn get_annual_fixed_costs_per_flow( &self, annual_activity: Activity, ) -> MoneyPerFlow
Get the annual fixed costs (AFC) per unit of output flow for this asset
Total capital costs and fixed opex are shared equally across all output flows in accordance with the annual activity and total output per unit of activity.
Sourcepub fn max_activity(&self) -> Activity
pub fn max_activity(&self) -> Activity
Maximum activity for this asset
Sourcepub fn get_flow(&self, commodity_id: &CommodityID) -> Option<&ProcessFlow>
pub fn get_flow(&self, commodity_id: &CommodityID) -> Option<&ProcessFlow>
Get a specific process flow
Sourcepub fn iter_flows(&self) -> impl Iterator<Item = &ProcessFlow>
pub fn iter_flows(&self) -> impl Iterator<Item = &ProcessFlow>
Iterate over the asset’s flows
Sourcepub fn iter_output_flows(&self) -> impl Iterator<Item = &ProcessFlow>
pub fn iter_output_flows(&self) -> impl Iterator<Item = &ProcessFlow>
Iterate over the asset’s output SED/SVD flows
Sourcepub fn primary_output(&self) -> Option<&ProcessFlow>
pub fn primary_output(&self) -> Option<&ProcessFlow>
Get the primary output flow (if any) for this asset
Sourcepub fn is_commissioned(&self) -> bool
pub fn is_commissioned(&self) -> bool
Whether this asset has been commissioned
Sourcepub fn commission_year(&self) -> u32
pub fn commission_year(&self) -> u32
Get the commission year for this asset
Sourcepub fn decommission_year(&self) -> Option<u32>
pub fn decommission_year(&self) -> Option<u32>
Get the decommission year for this asset
Sourcepub fn process_id(&self) -> &ProcessID
pub fn process_id(&self) -> &ProcessID
Get the process ID for this asset
Sourcepub fn num_children(&self) -> Option<u32>
pub fn num_children(&self) -> Option<u32>
Get the number of children this asset has.
If this asset is not a parent, then None is returned.
Sourcepub fn group_id(&self) -> Option<AssetGroupID>
pub fn group_id(&self) -> Option<AssetGroupID>
Get the group ID for this asset, if any
Sourcepub fn capacity(&self) -> AssetCapacity
pub fn capacity(&self) -> AssetCapacity
Get the capacity for this asset
Sourcepub fn total_capacity(&self) -> Capacity
pub fn total_capacity(&self) -> Capacity
Get the total capacity for this asset
Sourcefn decrement_unit_count(&self)
fn decrement_unit_count(&self)
Decrease the unit count (number of units) of this asset by one.
Note that this method uses interior mutability so that we can operate on an immutable ref to
self. Accordingly, calling this method will result in a change in the capacity for all
Rc copies of the asset, which is potentially dangerous. This method is therefore private
and should only be used for the case where we want to decrease the unit count for parent
assets.
Sourcepub fn get_mothballed_year(&self) -> Option<u32>
pub fn get_mothballed_year(&self) -> Option<u32>
Get the mothballed year for the asset
Sourcepub fn unit_size(&self) -> Option<Capacity>
pub fn unit_size(&self) -> Option<Capacity>
Get the unit size for this asset’s capacity (if any)
Sourcepub fn max_installable_capacity(
&self,
commodity_portion: Dimensionless,
) -> Option<AssetCapacity>
pub fn max_installable_capacity( &self, commodity_portion: Dimensionless, ) -> Option<AssetCapacity>
For non-commissioned assets, get the maximum capacity permitted to be installed based on the investment constraints for the asset’s process.
The limit is taken from the process’s investment constraints for the asset’s region and commission year, and the portion of the commodity demand being considered.
For divisible assets, the returned capacity will be rounded down to the nearest multiple of the asset’s unit size.
Trait Implementations§
Source§impl Hash for AssetRef
impl Hash for AssetRef
Source§fn hash<H: Hasher>(&self, state: &mut H)
fn hash<H: Hasher>(&self, state: &mut H)
Hash an asset according to its state:
- Commissioned assets are hashed based on their ID alone
- Selected assets are hashed based on
process_id,region_id,commission_yearandagent_id - Candidate assets are hashed based on
process_id,region_idandcommission_year - Parent assets are hashed based on
agent_idandgroup_id - Future and Decommissioned assets cannot currently be hashed
Source§impl Ord for AssetRef
impl Ord for AssetRef
Source§impl PartialOrd for AssetRef
impl PartialOrd for AssetRef
impl Eq for AssetRef
Auto Trait Implementations§
impl Freeze for AssetRef
impl !RefUnwindSafe for AssetRef
impl !Send for AssetRef
impl !Sync for AssetRef
impl Unpin for AssetRef
impl !UnwindSafe for AssetRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more