engforge.eng.costs
Defines a CostModel & Economics Component that define & orchestrate cost accounting respectively.
CostModels can have a cost_per_item and additionally calculate a cumulative_cost from internally defined `CostModel`s.
CostModel’s can have cost_property’s which detail how and when a cost should be applied & grouped. By default each CostModel has a cost_per_item which is reflected in item_cost cost_property set on the initial term as a unit category. Multiple categories of cost are also able to be set on cost_properties as follows
Cost Models can represent multiple instances of a component, and can be set to have a num_items multiplier to account for multiple instances of a component. CostModels can have a term_length which will apply costs over the term, using the cost_property.mode to determine at which terms a cost should be applied.
``` @forge class Widget(Component,CostModel):
#use num_items as a multiplier for costs, cost_properties can have their own custom num_items value. num_items:float = 100
@cost_property(mode=’initial’,category=’capex,manufacturing’,num_items=1) def cost_of_XYZ(self) -> float:
return cost
Economics models sum CostModel.cost_properties recursively on the parent they are defined. Economics computes the grouped category costs for each item recursively as well as summary properties like annualized values and levelized cost. Economic output is determined by a fixed_output or overriding calculate_production(self,parent) to dynamically calculate changing economics based on factors in the parent.
Default costs can be set on any CostModel.Slot attribute, by using default_cost(<slot_name>,<cost>) on the class, this will provide a default cost for the slot if no cost is set on the instance. Custom costs can be set on the instance with custom_cost(<slot_name>,<cost>). If cost is a CostModel, it will be assigned to the slot if it is not already assigned.
The economics term_length applies costs over the term, using the cost_property.mode to determine at which terms a cost should be applied.
@forge class Parent(System,CostModel)
econ = Slot.define(Economics) #will calculate parent costs as well cost = Slot.define(Widget) #slots automatically set to none if no input provided
Parent(econ=Economics(term_length=25,discount_rate=0.05,fixed_output=1000))
Functions
analyzes the reference and returns the number of items |
Classes
Initialize a filter. |
|
CostModel is a mixin for components or systems that reports its costs through the cost system property, which by default sums the item_cost and sub_items_cost. |
|
Economics is a component that summarizes costs and reports the economics of a system and its components in a recursive format. |
|
A thin wrapper over system_property that will be accounted by Economics Components and apply term & categorization |