Training exposure: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(created pages for training)
 
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Costs and valuations]]
[[Category:Costs and valuations]]
[[Category:Opasnet training]]
[[Category:Contains R code]]
{{variable|moderator=Jouni|stub=Yes}}
{{variable|moderator=Jouni|stub=Yes}}


== Question ==
== Question ==


What costs curves should be used for different energy products?
What is the exposure in the [[Training assessment]]?


== Answer ==
== Answer ==


<t2b index="Row,Actor,Fuel,Use,Reference,Unit,Observation" locations="Result,Description" unit="-">
<rcode embed=1 graphics=1>
1|Kuopion energia|Coal and peat|Demand|Current|€,ton|0, -0.06|
 
2|Kuopio market|Coal and peat|Supply|Current|€,ton|0, 0.5|
library(OpasnetUtils)
</t2b>
library(ggplot2)


Parameter c<sub>i</sub> are estimated from data: it is the current supply or demand given the current price (used as the point where p = 0).
objects.latest("Op_en5674", code_name = "initiate")
exposure
exposure <- EvalOutput(exposure) # for printing


<rcode
oprint(summary(exposure)) # fashionable design
name="answer"
label="Run code"
include="
page:Object-oriented_programming_in_Opasnet|name:answer|
page:OpasnetBaseUtils|name:generic|
page:Cost_curves_for_energy|name:formula
"
>


out <- formula.Op_en5478(dependencies.Op_en5478)
ggplot(exposure@output, aes(x = exposureResult, weight = 1, fill = Year)) +
cat("Computed changes in energy production and consumption in a new situation.\n")
geom_density() +
print(out)
theme_grey(base_size = 24)


</rcode>
</rcode>
Line 33: Line 29:
== Rationale ==
== Rationale ==


For detailed rationale, see [[Energy balance]].
===Data===


<math>\Sigma f_i(p) = \Sigma (a_i p^2 + b_i p + c_i) = 0</math>
<t2b index="Exposure agent,Year" obs="Result" desc="Description" unit="µg /m3">
PM2.5|2012|1 - 4|
PM2.5|2020|10 - 11|
</t2b>


<math>p = \frac{-\Sigma b_i \pm \sqrt{(\Sigma b_i)^2 - 4 \Sigma a_i \Sigma c_i}} {2 \Sigma a_i}</math>
=== Calculations ===


Cost curves are parameterised in the way that the current price p = 0 and therefore the current supply or demand is c<sub>i</sub>.
<rcode label="Initiate ovariable" name="initiate">


When a demand or supply changes, a new price p must be calculated based on f<sub>i</sub>, and then the supplies and demands of other actors can be calculated, resulting in a new balance.
library(OpasnetUtils) # relevant libraries


{{comment|# |There is an alternative way to describe the functions:
# Define ovariable
* Zero price is considered as 0 €/product unit. The true market price must be known. This function's parameters are more difficult to estimate.|--[[User:Jouni|Jouni]] 06:16, 28 January 2012 (EET)}}


{{comment|# |There is also alternative possibilities for functional forms (p is the price of the product):
exposure <- Ovariable("exposure", ddata = "Op_en5674")
* Exponential: P0 + P1 * exp(P2*p - P3)
colnames(exposure@data) <- gsub("[ \\.]", "_", colnames(exposure@data))
|--[[User:Jouni|Jouni]] 17:04, 28 January 2012 (EET)}}
=== Dependencies ===


=== Formula ===
objects.store(exposure) # save for later use


<rcode
cat("Ovariable exposure saved.\n")
name="formula"
label="Initiate functions"
include="
page:Object-oriented_programming_in_Opasnet|name:answer|
page:OpasnetBaseUtils|name:generic
"
>
 
formula.Op_en5478 <- function(x) {
data <- tidy(op_baseGetData("opasnet_base", x$curves[1]), direction = "wide")
curves <- strsplit(as.character(data$Parameters), split = ",")
coefficients <- data.frame(array(NA, dim = c(length(curves), 10)))
 
for(j in 1:length(curves)) {
coefficients[j, 1:length(curves[[j]])] <- curves[[j]]
}
coefficients[nrow(coefficients) + 1, 1] <- x$deviation
for(k in 1:ncol(coefficients)) {
coefficients[, k] <- ifelse(is.na(coefficients[, k]), 0, as.numeric(coefficients[, k]))
}
x.new <- polyroot(as.vector(colSums(coefficients)))
x.new <- ifelse(abs(Im(x.new)) < 1e-6, Re(x.new), 1e+30) # Take only the real roots.
x.new <- x.new[abs(x.new) == min(abs(x.new))] # Pick the root that is closest to zero (=BAU).
y.new <- 0
for(k in 1:ncol(coefficients)) {
y.new <- y.new + coefficients[, k] * x.new^(k-1)
}
temp <- data[1, ]
temp[1, ] <- "Deviation"
data <- rbind(data, temp)
data <- cbind(data, data.frame(Result = y.new))
return(data)
}
 
dependencies.Op_en5478 <- list(
curves = c("Op_en5478", "Cost curves for energy"),
bau = c("Op_en5469", "Energy balance in Kuopio"),
deviation = -5
)


</rcode>
</rcode>
Line 98: Line 55:
==See also==
==See also==


{{urgenche}}
{{Opasnet training}}


==Keywords==
==Keywords==
Line 107: Line 64:


==Related files==
==Related files==
{{mfiles}}

Latest revision as of 08:18, 3 June 2015



Question

What is the exposure in the Training assessment?

Answer

+ Show code

Rationale

Data

Training exposure: Difference between revisions(µg /m3)
ObsExposure agentYearResultDescription
1PM2.520121 - 4
2PM2.5202010 - 11

Calculations

+ Show code

See also

Materials and examples for training in Opasnet and open assessment
Help pages Wiki editingHow to edit wikipagesQuick reference for wiki editingDrawing graphsOpasnet policiesWatching pagesWriting formulaeWord to WikiWiki editing Advanced skills
Training assessment (examples of different objects) Training assessmentTraining exposureTraining health impactTraining costsClimate change policies and health in KuopioClimate change policies in Kuopio
Methods and concepts AssessmentVariableMethodQuestionAnswerRationaleAttributeDecisionResultObject-oriented programming in OpasnetUniversal objectStudyFormulaOpasnetBaseUtilsOpen assessmentPSSP
Terms with changed use ScopeDefinitionResultTool


Keywords

References


Related files