Learn R Programming

foreSIGHT (version 0.9.81)

performanceSpaces: performanceSpaces

Description

Simulates and maps system performance using climate scenarios generated using scenarioGenerator. Currently only visualises 2D panels.

Usage

performanceSpaces(data = NULL,
                  plotTag = NULL,
                  plotArgs = NULL,
                  systemModel = NULL,
                  systemArgs = NULL,
                  simDirectory = "Simulation1",
                  performance=NULL,
                  IOmode="suppress"
                  )

Arguments

data

A list containing data frames of the form Year Month Day P Temp output from scenarioGenerator

plotTag

A character vector which designates how the performance space is visualised. Options are: "Heat", "Contours" or "OAT".

plotArgs

A list controlling how the performance space is visualised with the following components:

title

a string that is used as the title label.

legendtitle

a string that is used to label the legend.

xlim

x axis limits.

ylim

y axis limits.

performancelimits

z axis limits.

lowfill

a string specifying the colour for lower values of performance. Default is "red". For use with plotTag="Heat".

highfill

a string specificying the colour for the high values of performance. Default is "yellow". A colour ramp will be created between this and the lowfill. For use with plotTag="Heat".

contour

a TRUE/FALSE toggle for whether or not contour lines are overlaid. Default is TRUE. For use with plotTag="Heat".

contourlevels

a vector specifying the levels at which controus will be drawn. For use with plotTag = "Contours".

systemModel

a function name. The function name of the system model used to generate system performance. The system model must have the arguments data and systemArgs.

systemArgs

A list containing all the arguments that are required to control the system model.

simDirectory

A string used to label the output directory.

performance

A vector of performance values from an external system model.

IOmode

A string that specifies the input-output mode for the scenarios = "verbose", "dev" or "suppress".

Value

Returns a 2D plot of system performance.

See Also

See Also: scenarioGenerator and plotLayers

Examples

Run this code
# NOT RUN {
data(tankSimpleScale)

# tank_simple_scenarios<-scenarioGenerator(obs=tank_obs,                     
#                           modelTag = modelTag,
#                           attPerturb=attPerturb,
#                           exSpArgs = exSpArgs)

# Example 1: Heat Map Example
systemArgs<-list(roofArea=100,
                 nPeople=1,
                 tankVol=2000,
                 firstFlush=1,
                 write.file=FALSE,
                 metric="reliability")

plotArgs=list(title="Scenario Neutral Space",
               legendtitle="Reliability",
               xlim=c(-2,2),
               ylim=c(0.7,1.3),
               performancelimits=c(0.6,0.85))

plot<-performanceSpaces(data=tank_simple_scenarios,
                        plotTag="Heat",
                        systemModel = tankWrapper,
                        systemArgs = systemArgs)

plot$plot

# Note options
# plotArgs$contour=FALSE
# plotArgs$lowfill="antiquewhite"   ###From supported R colour names
# plotArgs$highfill="#88CCEE"       ###Hexidecimal specification also okay
# }
# NOT RUN {
# }
# NOT RUN {
#Example 2
result<-performanceSpaces(data=tank_simple_scenarios,
                          plotTag = "Contours",
                          plotArgs=plotArgs,
                          systemModel = tankWrapper,
                          systemArgs = systemArgs)

result$plot
# }
# NOT RUN {
#Example 3
# }
# NOT RUN {
plotArgs$contourlevels=c(0.67,0.71)

result<-performanceSpaces(data=tank_simple_scenarios,
                          plotTag = "Contours",
                          plotArgs=plotArgs,
                          systemModel = tankWrapper,
                          systemArgs = systemArgs)

result$plot
# }
# NOT RUN {
# }
# NOT RUN {
###Example 4 - One-at-a-time/"OAT" plot
data(oatScenarios)
systemArgs=list(roofArea=50,
                 nPeople=1,
                 tankVol=3000,
                 firstFlush=1,
                 write.file=FALSE,
                 metric="reliability")

plotArgs=list(title="Scenario Neutral Space",
               legendtitle="Reliability",
               xlim=c(-2,2),
               ylim=c(0.7,1.3),
               performancelimits=c(0.6,0.85))

oat_plot=performanceSpaces(data=oat_out,
                           plotTag = "OAT",
                           plotArgs=plotArgs,
                           systemModel = tankWrapper,
                           systemArgs = systemArgs)
oat_plot
# }

Run the code above in your browser using DataLab