pub struct Asset {
state: AssetState,
process: Rc<Process>,
process_parameter: Rc<ProcessParameter>,
region_id: RegionID,
capacity: Capacity,
commission_year: u32,
}
Expand description
An asset controlled by an agent.
Fields§
§state: AssetState
The status of the asset
process: Rc<Process>
The Process
that this asset corresponds to
process_parameter: Rc<ProcessParameter>
The ProcessParameter
corresponding to the asset’s region and commission year
region_id: RegionID
The region in which the asset is located
capacity: Capacity
Capacity of asset (for candidates this is a hypothetical capacity which may be altered)
commission_year: u32
The year the asset was/will be commissioned
Implementations§
Source§impl Asset
impl Asset
Sourcepub fn new_candidate(
process: Rc<Process>,
region_id: RegionID,
capacity: Capacity,
commission_year: u32,
) -> Result<Self>
pub fn new_candidate( process: Rc<Process>, region_id: RegionID, capacity: Capacity, commission_year: u32, ) -> Result<Self>
Create a new candidate asset
Sourcepub fn new_future(
agent_id: AgentID,
process: Rc<Process>,
region_id: RegionID,
capacity: Capacity,
commission_year: u32,
) -> Result<Self>
pub fn new_future( agent_id: AgentID, process: Rc<Process>, region_id: RegionID, capacity: Capacity, commission_year: u32, ) -> Result<Self>
Create a new future asset
Sourcefn new_with_state(
state: AssetState,
process: Rc<Process>,
region_id: RegionID,
capacity: Capacity,
commission_year: u32,
) -> Result<Self>
fn new_with_state( state: AssetState, process: Rc<Process>, region_id: RegionID, capacity: Capacity, commission_year: u32, ) -> Result<Self>
Private helper to create an asset with the given state
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_limits(
&self,
time_slice: &TimeSliceID,
) -> RangeInclusive<Activity>
pub fn get_activity_limits( &self, time_slice: &TimeSliceID, ) -> RangeInclusive<Activity>
Get the activity limits for this asset in a particular time slice
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_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_input_cost_from_prices(
&self,
input_prices: &HashMap<(CommodityID, RegionID, TimeSliceID), MoneyPerFlow>,
time_slice: &TimeSliceID,
) -> MoneyPerActivity
pub fn get_input_cost_from_prices( &self, input_prices: &HashMap<(CommodityID, RegionID, TimeSliceID), MoneyPerFlow>, time_slice: &TimeSliceID, ) -> MoneyPerActivity
Get the cost of input flows using the commodity prices in input_prices
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
Sourcefn get_flows_map(&self) -> &IndexMap<CommodityID, ProcessFlow>
fn get_flows_map(&self) -> &IndexMap<CommodityID, ProcessFlow>
Get the process flows map for this asset
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 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 set_capacity(&mut self, capacity: Capacity)
pub fn set_capacity(&mut self, capacity: Capacity)
Set the capacity for this asset (only for Candidate assets)
Sourcepub fn increase_capacity(&mut self, capacity: Capacity)
pub fn increase_capacity(&mut self, capacity: Capacity)
Increase the capacity for this asset (only for Candidate assets)
Sourcefn decommission(&mut self, decommission_year: u32)
fn decommission(&mut self, decommission_year: u32)
Decommission this asset
Sourcefn commission_future(&mut self, id: AssetID)
fn commission_future(&mut self, id: AssetID)
Commission a future asset
Sourcepub fn select_candidate_for_investment(&mut self, agent_id: AgentID)
pub fn select_candidate_for_investment(&mut self, agent_id: AgentID)
Select a Candidate asset for investment, converting it to a Selected state
Sourcefn commission_selected(&mut self, id: AssetID)
fn commission_selected(&mut self, id: AssetID)
Commission a selected asset and give ownership to the specified agent
At this point we also check that the capacity is valid (panics if not).
Sourcepub fn as_candidate(&self, capacity: Option<Capacity>) -> Asset
pub fn as_candidate(&self, capacity: Option<Capacity>) -> Asset
Creates a Candidate asset matching a given Commissioned asset
Optionally, the capacity can be set to a different value.
Trait Implementations§
impl StructuralPartialEq for Asset
Auto Trait Implementations§
impl Freeze for Asset
impl RefUnwindSafe for Asset
impl !Send for Asset
impl !Sync for Asset
impl Unpin for Asset
impl UnwindSafe for Asset
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,
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