Difference between revisions of "City-level climate policy model"
m (→Dependencies) |
(→Formula) |
||
Line 77: | Line 77: | ||
library(ggplot2) | library(ggplot2) | ||
+ | test <- 0 | ||
issues <- op_baseGetData("opasnet_base", "Op_en5811") | issues <- op_baseGetData("opasnet_base", "Op_en5811") | ||
+ | me <- "Urban area" | ||
+ | formula <- function(dependencies, me, ...) { | ||
+ | data <- issues[issues$Topic == me, ] | ||
+ | |||
+ | return(data) | ||
+ | } | ||
+ | ova <- new("ovariable", dependencies = data.frame(Name = "test"), | ||
+ | formula = formula | ||
+ | ) | ||
+ | ova | ||
+ | EvalOutput(ova, me = "Transport") | ||
+ | |||
equations <- tidy(op_baseGetData("opasnet_base", "Op_enXXXX"), objname = "equations") | equations <- tidy(op_baseGetData("opasnet_base", "Op_enXXXX"), objname = "equations") | ||
− | formula <- function(me | + | ### This formula creates a causal model with linear dependencies between ovariables Policy.target, Action.on, ... |
+ | # The dependencies are defined in a data table equations. | ||
+ | formula <- function(dependencies, me, ...) { | ||
ComputeDependencies(dependencies, ...) | ComputeDependencies(dependencies, ...) | ||
+ | |||
+ | # Find coefficients of equations that are relevant for this ovariable. | ||
coefficients <- new("ovariable", | coefficients <- new("ovariable", | ||
name = "coefficients", | name = "coefficients", | ||
− | data = equations[equations$Role == "Child" & equations$ | + | data = equations[equations$Equation == equations[equations$Role == "Child" & equations$Step == me, "Equation"], ] |
) | ) | ||
− | out <- | + | |
+ | out <- data.frame() | ||
+ | for(i in dependencies$Name) { | ||
+ | out <- rbind(out, get(i)@output * coefficients) | ||
+ | } | ||
+ | out <- tapply(out$Result, out["Equation"], sum) | ||
return(out) | return(out) | ||
− | |||
− | |||
} | } | ||
Policy.targets <- new("ovariable", | Policy.targets <- new("ovariable", | ||
name = "Policy.targets", | name = "Policy.targets", | ||
− | data = tidy(issues[issues$Table == "Policy | + | data = tidy(issues[issues$Table == "Policy target" , ], objname = "Policy.target") |
+ | ) | ||
+ | |||
+ | Action.on <- new("ovariable", | ||
+ | name = "Action.on", | ||
+ | data = tidy(issues[issues$Table == "Action on" , ], objname = "Action.on"), | ||
+ | dependencies = data.frame(Name = c( | ||
+ | "equation", | ||
+ | "Policy.target" | ||
+ | )), | ||
+ | formula = formula | ||
+ | ) | ||
+ | |||
+ | Primary.impact.on <- new("ovariable", | ||
+ | name = "Primary.impact.on", | ||
+ | data = tidy(issues[issues$Table == "Primary impact on" , ], objname = "Primary impact on"), | ||
+ | dependencies = data.frame(Name = c( | ||
+ | "equation", | ||
+ | "Policy.target", | ||
+ | "Action.on" | ||
+ | )), | ||
+ | formula = formula | ||
+ | ) | ||
+ | |||
+ | End.use.of.energy <- new("ovariable", | ||
+ | name = "End.use.of.energy", | ||
+ | data = tidy(issues[issues$Table == "End use of energy" , ], objname = "End.use.of.energy"), | ||
+ | dependencies = data.frame(Name = c( | ||
+ | "equation", | ||
+ | "Policy.target", | ||
+ | "Action.on", | ||
+ | "Primary.impact.on" | ||
+ | )), | ||
+ | formula = formula | ||
+ | ) | ||
+ | |||
+ | Emission <- new("ovariable", | ||
+ | name = "Emission", | ||
+ | data = tidy(issues[issues$Table == "Emission" , ], objname = "Emission"), | ||
+ | dependencies = data.frame(Name = c( | ||
+ | "equation", | ||
+ | "Policy.target", | ||
+ | "Action.on", | ||
+ | "Primary.impact.on", | ||
+ | "End.use.of.energy" | ||
+ | )), | ||
+ | formula = formula | ||
+ | ) | ||
+ | |||
+ | Time.budget <- new("ovariable", | ||
+ | name = "Time.budget", | ||
+ | data = tidy(issues[issues$Table == "Time budget" , ], objname = "Time.budget"), | ||
+ | dependencies = data.frame(Name = c( | ||
+ | "equation", | ||
+ | "Policy.target", | ||
+ | "Action.on", | ||
+ | "Primary.impact.on", | ||
+ | "End.use.of.energy", | ||
+ | "Emission" | ||
+ | )), | ||
+ | formula = formula | ||
+ | ) | ||
+ | |||
+ | Exposure <- new("ovariable", | ||
+ | name = "Exposure", | ||
+ | data = tidy(issues[issues$Table == "Exposure" , ], objname = "Exposure"), | ||
+ | dependencies = data.frame(Name = c( | ||
+ | "equation", | ||
+ | "Policy.target", | ||
+ | "Action.on", | ||
+ | "Primary.impact.on", | ||
+ | "End.use.of.energy", | ||
+ | "Emission", | ||
+ | "Time.budget" | ||
+ | )), | ||
+ | formula = formula | ||
) | ) | ||
− | + | Policy.outcome <- new("ovariable", | |
− | name = " | + | name = "Policy.outcome", |
− | data = tidy(issues[issues$Table == " | + | data = tidy(issues[issues$Table == "Policy.outcome" , ], objname = "Policy.outcome"), |
− | dependencies = data.frame(Name = c(" | + | dependencies = data.frame(Name = c( |
+ | "equation", | ||
+ | "Policy.target", | ||
+ | "Action.on", | ||
+ | "Primary.impact.on", | ||
+ | "End.use.of.energy", | ||
+ | "Emission", | ||
+ | "Time.budget", | ||
+ | "Exposure", | ||
+ | "Policy.outcome" | ||
+ | )), | ||
formula = formula | formula = formula | ||
) | ) | ||
− | |||
− | |||
</rcode> | </rcode> | ||
Revision as of 08:24, 13 September 2012
This page is a assessment.
The page identifier is Op_en5811 |
---|
Moderator:Jouni (see all) |
This page is a stub. You may improve it into a full page, and then a rating bar will appear here. |
Upload data
|
Contents
Scope
Question
Boundaries
Scenarios
Intended users
Participants
Answer
Rationale
Dependencies
This is a generic table format and assessment structure for most inputs of the model. This is based on File:UrgencheConceptualModel.xlsx
We need too tables, one with all issues listed (with estimates where there is direct data), and another for equations that connect issues. The assessment has seven steps:
- Policy target
- Action on
- Primary impact on
- End use of energy
- Emission
- Time budget
- Exposure
- Policy outcome
This table contains the issues:
Obs | Step | Topic | Issue | Unit | Result | Description |
---|---|---|---|---|---|---|
1 | Policy target | Urban area | Urban density | m2/km2 | floor space | |
2 | Policy target | Urban area | Urban plan/zoning | |||
3 | Policy target | Urban area | Street network | lane-km(/km2) | ||
4 | Policy target | Urban area | Rail network | rail-km(/km2) | ||
5 | Policy target | Urban area | Walk/bike network | km(/km2) | ||
6 | Policy target | Transport | Local person transport | total person-km/a | ||
7 | Policy target | Transport | (intercity personal transport) | |||
8 | Policy target | Transport | Local transport of goods | |||
9 | Policy target | Transport | (long range goods transport) | |||
10 | Policy target | Transport | (street) transport electrification | % person-km | ||
11 | Etc |
The connections between items is created using this kind of a table (here a wiki table format is used, but actually it should be a data table on a page called City-level climate policy model/equations). Proximity to work and school is used as an example. All causal dependencies are interpreted in the following way, where each equation defines one child:
Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): Child = \Sigma Parent_i * Coefficient_i
Equation | Step | Topic | Issue | Role | Coefficient | Description |
---|---|---|---|---|---|---|
1 | Impact on | Urban environment functionality | Proximity to work and school | Child | ||
1 | Action on | Urban development | Population density | Parent | 1 | |
1 | Action on | Urban development | Land use efficiency | Parent | 2.2 | |
1 | Policy target | Urban area | Urban plan/zoning | Parent | 3.6 |
Formula
See also
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>