Constructor for trade object.
Usage
newTrade(
name = "",
desc = "",
commodity = character(),
routes = data.frame(),
trade = data.frame(),
fixom = data.frame(),
varom = data.frame(),
cluster = data.frame(),
invcost = data.frame(),
olife = data.frame(),
start = data.frame(start = -Inf, stringsAsFactors = FALSE),
end = data.frame(end = Inf, stringsAsFactors = FALSE),
vintage = data.frame(),
capacity = data.frame(),
aux = data.frame(),
aeff = data.frame(),
cap2act = 1,
optimizeRetirement = FALSE,
misc = list(),
...
)Arguments
- name
character. Name of the trade object, used in sets.
- desc
character. Description of the trade object.
- commodity
character. The traded commodity short name.
- routes
data.frame. Source and destination regions. For bivariate trade define both directions in separate rows.
- from
character. Source region.
- to
character. Destination region.
- trade
data.frame. Technical parameters of trade per directed route. Two kinds of flow bound live here and they are not interchangeable:
ava.*is ABSOLUTE, in physical commodity units per timeslice, and does not scale with capacity;af.*is RELATIVE, a fraction of the object's own capacity (cap2actxvTradeCapx the timeslice share), and is the direct analogue oftechnology@af. Useaf.*to rate individual lines of a multi-route object, where the absolute bound would have to be a number correct for exactly one capacity – and capacity is the decision.- vintage
character. Vintage label selecting the variant this row applies to, NA for every vintage. See the
vintageslot.- cluster
character. Cluster (loss tranche) label selecting the tranche this row applies to, NA for every tranche. See the
clusterslot.- src
character. Source region of the flow, NA for every source region on the route.
- dst
character. Destination region of the flow, NA for every destination region on the route.
- year
integer. Year to apply the parameter, NA for every year.
- timeslice
character. Time timeslice to apply the parameter, NA for every timeslice.
- ava.lo
numeric. Lower bound on the traded flow from
srctodst, in physical commodity units per timeslice.- ava.up
numeric. Upper bound on the traded flow from
srctodst, in physical commodity units per timeslice.- ava.fx
numeric. Fixed value of the traded flow from
srctodst, in physical commodity units per timeslice. This parameter overridesava.loandava.up.- af.lo
numeric. Lower bound on the flow from
srctodstas a FRACTION of the object's capacity:af.lo x cap2act x vTradeCap x share. Forces a minimum loading on that direction.- af.up
numeric. Upper bound on the flow from
srctodstas a FRACTION of the object's capacity:af.up x cap2act x vTradeCap x share. This is how a single trade object carrying several routes gives each line its own rating –af.up = 0.5on one leg limits it to half the corridor whatever the corridor turns out to be. Note thataf.upof 1 is already implied byeqTradeCapFlowand cannot bind.- af.fx
numeric. Fixed loading of the direction
src->dstas a fraction of capacity. Overridesaf.loandaf.up.- teff
numeric. Trade efficiency: the fraction of the flow sent from
srcthat is delivered todst(1 = lossless).- reactance
numeric. Series reactance
xof the line, in the model's own impedance units. Carried for AC lines and used by nothing unless the model is interpolated withkvl = TRUE, when it becomes the coefficient of Kirchhoff's voltage law. Presence of a finitereactanceis what marks a route as a PASSIVE AC branch: a controllable DC link has none, because its flow is chosen rather than set by impedance. Must be SYMMETRIC across the two directed rows of a line – the voltage law constrains the net flow – and a line under KVL must be declared in both directions. Where several physical circuits have been merged into one route, the value is the EQUIVALENT reactance,1/x_eq = sum(1/x_i), not any one circuit's.- resistance
numeric. Series resistance
rof the line, same units and same symmetry requirement asreactance. Recorded for round-tripping with power-system models (PyPSA'sLinecarries both). It does not drive losses by itself – losses are the per-routeteff– but it is the inputlossTranches()turns into a piecewise-linear loss curve: pass it with the rating it was measured against, sinceloss_full = r * Fand a resistance alone does not determine a loss fraction.
- fixom
data.frame. Fixed operation and maintenance costs, per unit of standing capacity per year. Like the other trade cost slots this is a RATE PER ENDPOINT REGION, named in its
regioncolumn – see the note oninvcost.- varom
data.frame. Costs charged on the traded flow, PER ROUTE. Unlike the capacity costs above – which are a rate per endpoint region – these are indexed by
(src, dst, year, timeslice), so they can differ by direction. The two columns mean different things:varom– variable operation and maintenance, a REAL resource cost. Charged where the flow ORIGINATES (src) and added to total system cost, exactly astechnology@varomis. Use it for wheeling fees, transit taxes or any real charge per unit shipped. BecomespTradeIrCost.markup– a border price or bilateral charge: a TRANSFER. The importing region pays it and the exporting region receives it, so it moves cost between regions and leaves the objective unchanged – the same distinction as a tax versus a cap. BecomespTradeIrMarkup.Before 0.85 both columns were summed into a single term that cancelled between
eqImportIrCostandeqExportIrCost, sovaromcould not express an operating cost at all; it now enters the objective once, positively, atsrc. (A separate parameterpTradeVaromwas once declared in the GLPK and GAMS templates and read by no equation; it has been removed and was never this slot.)- invcost
data.frame. Investment cost of the trade capacity, as a RATE PER ENDPOINT REGION per unit of capacity. Trade capacity is region-free – one number per corridor – but its costs are region-indexed, and each region named in
regionpays its own rate on the whole capacity. A corridor whose two endpoints each pay 100 therefore costs 200 in total. Leavingregionunset applies the rate at every endpoint of the route; energyRt reports that rather than correcting it, because the same rate is what a partial-region study would see – solve a subset of the endpoints and it bears only their share, which is the intended behaviour. Name the regions to vary the rate between them.fixom,retcostandeacfollow the same convention.- vintage
character. Vintage label selecting the variant this row applies to, NA for every vintage. See the
vintageslot.- cluster
character. Cluster (loss tranche) label selecting the tranche this row applies to, NA for every tranche. See the
clusterslot.- region
character. Endpoint region bearing this rate. NA applies the rate at every endpoint of the route; name the regions to vary it between them. Must be one of the model's own regions – a coarser geoscale level is accepted by validation but never reaches the objective.
- year
integer. Year to apply the parameter, NA for every year.
- invcost
numeric. Investment cost.
- wacc
numeric. Weighted average cost of capital used to annuitise
invcostfor this corridor. Overrides the model-widewacc(see the modeldiscountargument). The social discount rate is never used here.- payback
numeric. Cost-recovery period in years. Where given it replaces
olifein the annuity AND in the years over which the annuity is charged, so the investment is repaid overpaybackyears while the capacity keeps operating for its full operational life. Must be positive and not exceedolife. Unset (or 0) means recover overolife. Implemented for the GLPK solver only.- eac
numeric. Equivalent annual cost, supplied directly instead of being computed from
invcost,waccand the lifetime. Where given it wins; where absent the annuity is computed. Mutually exclusive withinvcostper row.- retcost
numeric. Costs of early retirement of the trade capacity, default is 0.
- olife
deprecated, use the
olifecolumn ofvintage.- start
deprecated, use the
startcolumn ofvintage.- end
deprecated, use the
endcolumn ofvintage.- vintage
data.frame. Investment window and operational life of the trade object, one row per vintage. Replaces the former
start,endandolifeslots. A vintage is a separately investable variant that keeps the characteristics of its build year for its whole life, so several vintages of one corridor mean several capacities on the same(src, dst)route, with their flows summed in the commodity balance.regionis present for a uniform shape across process classes but is unused for trade: its scope comes from the route endpoints.clusterselects a loss tranche declared in theclusterslot.- vintage
character. Vintage label, normally the build year as a string. NA for an un-vintaged trade.
- region
character. Unused for trade (no
regionslot); present for consistency with the other classes.- cluster
character. Cluster (loss tranche) this row applies to, NA for every tranche. See the
clusterslot.- start
integer. The first year the trade object is available for investment. NA means unbounded (up to
end).- end
integer. The last year the trade object is available for investment. NA means unbounded (from
starton).- olife
integer. Operational life of the trade object in years.
- capacity
data.frame. Capacity parameters of the trade object:
stock(the legacy corridor still standing at each milestone), thecap.*bounds on total capacity, thencap.*bounds on the build RATE and theret.*bounds on the early retirement rate. Region-free: a route IS a pair of regions, so a per-region capacity would be ambiguous.- aux
data.frame. Auxiliary commodity of trade.
- acomm
character. Name of the auxiliary commodity (used in sets).
- unit
character. Unit of the auxiliary commodity.
- aeff
data.frame. Auxiliary commodity efficiency parameters.
- vintage
character. Vintage label selecting the variant this row applies to, NA for every vintage. See the
vintageslot.- cluster
character. Cluster (loss tranche) label selecting the tranche this row applies to, NA for every tranche. See the
clusterslot.- acomm
character. Name of the auxiliary commodity (used in sets).
- region
character. Region name to apply the parameter, NA for every region.
- year
integer. Year to apply the parameter, NA for every year.
- timeslice
character. Time timeslice to apply the parameter, NA for every timeslice.
- trade2ainp
numeric. Trade-to-auxiliary-input-commodity coefficient (multiplier).
- trade2aout
numeric. Trade-to-auxiliary-output-commodity coefficient (multiplier).
- cap2act
numeric. Capacity to activity ratio.
- optimizeRetirement
logical. Incidates if the retirement of the trade object should be optimized. Also requires the same parameter in the
modelorscenarioclass to be set to TRUE to be effective.- misc
list. Additional information.
Details
Trade objects are used to represent inter-regional exchange in the model. Without trade, every region is isolated and can only use its own resources. The class defines trade routes, efficiency, costs, and other parameters related to the process. Number of routes per trade object is not limited. One trade object can have a part or entire trade network of the model. However, it has a distinct name and all the routs will be optimized together. Create separate trade objects to optimize different parts of the trade network (aka transmission lines).
Examples
PIPELINE1 <- newTrade(
name = "PIPELINE1",
desc = "Some transport pipeline",
commodity = "OIL",
routes = data.frame(
src = c("R1", "R2"),
dst = c("R2", "R3")
),
trade = data.frame(
src = c("R1", "R2"),
dst = c("R2", "R3"),
teff = c(0.99, 0.98)
),
olife = list(olife = 60)
)
draw(PIPELINE1)
PIPELINE2 <- newTrade(
name = "PIPELINE2",
desc = "Some transport pipeline",
commodity = "OIL",
routes = data.frame(
src = c("R1", "R1", "R2", "R3"),
dst = c("R2", "R3", "R3", "R2")
),
trade = data.frame(
src = c("R1", "R1", "R2", "R3"),
dst = c("R2", "R3", "R3", "R2"),
teff = c(0.912, 0.913, 0.923, 0.932)
),
aux = data.frame(
acomm = c("ELC", "CH4"),
unit = c("MWh", "kt")
),
aeff = data.frame(
acomm = c("ELC", "CH4", "ELC", "CH4"),
src = c("R1", "R1", "R2", "R3"),
dst = c("R2", "R2", "R3", "R2"),
csrc2ainp = c(.5, NA, .3, NA),
cdst2ainp = c(.4, NA, .6, NA),
csrc2aout = c(NA, .1, NA, .2)
),
olife = list(olife = 60)
)
draw(PIPELINE2, node = "R1")
draw(PIPELINE2, node = "R2")
draw(PIPELINE2, node = "R3")
