-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.r
423 lines (346 loc) · 24 KB
/
ui.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
#function(request){
#################################################################
# Dashboard header
#################################################################
header <- dashboardHeader(
titleWidth =270,
title = "Avian Stochastic CRM",
tags$li(class = "dropdown", actionLink("appvrsn", label = tags$b("v2.3.3"), style = "font-size: 19px")),
tags$li(class = "dropdown", a(icon('github', "fa-2x"), href='https://github.com/dmpstats/stochCRM',
style = "padding-top: 10px; padding-bottom: 10px", target='_blank', id="lbl_codeLink")),
tags$li(class = "dropdown", a(icon('bug', "fa-2x"), href='https://github.com/dmpstats/stochCRM/issues', #exclamation-circle
style = "padding-top: 10px; padding-bottom: 10px", target='_blank', id="lbl_issuesLink")),
# tags$li(class = "dropdown", actionLink("bookmark_btt", label = NULL, icon("bookmark", "fa-2x", lib = "font-awesome"),
# style = "padding-top: 10px; padding-bottom: 10px")),
tags$li(class = "dropdown", actionLink("saveInputs_btt", label = NULL, icon("save", "fa-2x", lib = "font-awesome"),
style = "padding-top: 10px; padding-bottom: 10px")),
tags$li(class = "dropdown", actionLink("restoreInputs_btt", label = NULL, icon("window-restore", "fa-2x", lib = "font-awesome"),
style = "padding-top: 10px; padding-bottom: 10px")),
tags$li(class = "dropdown", a(img(src = "bioConsultSH_Logo_2.png", height = "40px"), href='https://bioconsult-sh.de/en/',
style = "padding-top: 5px; padding-bottom: 5px;", target='_blank', id="lbl_bioConsultLogoLink"),
style="float: right"),
tags$li(class = "dropdown", a(img(src = "HiDef Logo_2.png", height = "40px"), href='https://hidef.bioconsult-sh.de/',
style = "padding-top: 5px; padding-bottom: 5px;", target='_blank', id="lbl_hiDefLogoLink"),
style="float: right"),
tags$li(class = "dropdown", a(img(src = "DMP_logo_1.png", height = "40px"), href='https://www.dmpstats.com',
style = "padding-top: 5px; padding-bottom: 5px", target='_blank', id="lbl_dmpLogoLink"),
style="float: right"),
tags$li(class = "dropdown", a(img(src = "MS Logo Linear-01_2.png", height = "30px"), href='https://www.gov.scot/Topics/marine',
style = "padding-top: 10px; padding-bottom: 10px;", target='_blank', id="lbl_marineScotlandLink"),
style="float: right")
)
#################################################################
# Dashboard sidebar
#################################################################
sidebar <- dashboardSidebar(
width = 270,
# tags$style(".main-sidebar{ position: fixed;}"),
sidebarMenu(
id = "tabs",
#style = "position: fixed; overflow: visible;",
menuItem(
"Step 1: Turbine & Wind farm features", tabName = "tab_turbWindPars", icon = icon("tachometer-alt")
),
menuItem(text = "Step 2: Specie(s)", icon = icon("bullseye"),
selectizeInput(inputId = "selectSpecs", width = "100%", label=NULL, # label = "Step 1: Specie(s)",
choices = species, multiple=TRUE,
selected = defaultSpecies,
options = list(placeholder = "Select from list or add new species", create = TRUE)
)
),
menuItem(#selected = TRUE,
"Step 3: Species features", tabName = "speciesTab", icon = icon("twitter"),
menuItemOutput("menuSubItems_species")
# menuSubItem("Species 1", tabName = "tab_species1Pars", icon=icon("sliders"))
),
menuItem(#selected = TRUE,
"Step 4: Simulation & Results", tabName = "tab_simulation", icon = icon("chart-bar")
),
hr(),
#bookmarkButton(id="bookmark_btt"),
#tags$style(type='text/css', "#bookmark_btt { width:180px;}"),
br(),
bsAlert(anchorId = "alert"),
initStore("store", "shinyStore-ex1")
)
)
#################################################################
# Dashboard body
#################################################################
body <- dashboardBody(
#tabItems(
div(class="tab-content", id="tabItemsEnvelope", # required as reference to the dynamic UI tab for each species via insertUI()
tabItem(tabName="tab_turbWindPars",
fluidRow(
box(title = "Wind Farm Features",
width = 2,
status = "primary",
solidHeader = TRUE,
# --- Turbine Power
numericInput(width = "85%",
inputId = "numInput_windfarmPars_nTurbines",
label = label.help("Number of Turbines", "lbl_windfarmnTurbines"),
value = startUpValues$windFarmPars$windfarmPars_nTurbines, min = 1, step = 1),
bsTooltip(id = "lbl_windfarmnTurbines",
title = paste0("Total number of turbines in the wind farm array.",
" Used in conjunction with turbine model to calculate the target power of the wind farm."),
options = list(container = "body"), placement = "right", trigger = "hover"),
# --- Latitude
numericInput(width = "85%",
inputId = "numInput_windfarmPars_Latitude",
label = label.help("Latitude (deg)", "lbl_windfarmLatitude"), #"Latitude (deg)",
value = startUpValues$windFarmPars$windfarmPars_Latitude, min = -90, max = 90, step = 0.01),
bsTooltip(id = "lbl_windfarmLatitude",
title = paste0("Latitude of the wind farm in decimal degrees. Used to calculate day length at the site over the year."),
options = list(container = "body"), placement = "right", trigger = "hover"),
# --- Width
numericInput(width = "85%",
inputId = "numInput_windfarmPars_width",
label = label.help("Width (Km)", "lbl_windfarmWidth"), #"Width (Km)",
value = startUpValues$windFarmPars$windfarmPars_width, min = 1, step = 1),
bsTooltip(id = "lbl_windfarmWidth",
title = paste0("The wind farm width"),
options = list(container = "body"), placement = "right", trigger = "hover"),
# --- Tidal offset
numericInput(width = "85%",
inputId = "numInput_windfarmPars_tidalOffset",
label = label.help("Tidal Offset (m)", "lbl_tidalOffset"), #"Tidal Offset (m)",
value = startUpValues$windFarmPars$tidalOffset, min = 0, step = 0.1),
bsTooltip(id = "lbl_tidalOffset",
title = paste0("Tidal offset to correct for: (i) flight heights calculated in relation to mean sea-level",
" ; and (ii) turbine dimensions calculated in relation to Highest Astronomical Tide"),
options = list(container = "body"), placement = "right", trigger = "hover"),
br(),
knobInput(
inputId = "sldInput_windfarmPars_upWindDownWindProp",
label = label.help("Upwind flights (%)", "lbl_upWindDownWindProp"),
value = 50, min = 0, max = 100, step = 1,
displayPrevious = TRUE,
thickness = 0.4,
lineCap = "default", #"round",
inputColor = "#333",
fgColor = "#6B8E23",
angleArc = 180,
angleOffset = 270,
width = "80%"
# height = "140px"
),
bsTooltip(id = "lbl_upWindDownWindProp",
title = paste0("The percentage of upwind bird flights. Should be 50% unless direction of travel",
" is biased in a particular direction"),
options = list(container = "body"), placement = "right", trigger = "hover")
),
box(title = "Turbine Parameters",
width = 10,
status = "primary",
solidHeader = TRUE,
fluidRow(
box(width = 12,
splitLayout(
# --- Turbine power/model
numericInput(width = "60%",
inputId = "numInput_turbinePars_turbinePower",
label = label.help("Turbine Model (MW)", "lbl_turbinePower"),
value = startUpValues$turbinePars$turbPower, min = 1),
# ---- Number of blades
numericInput(width = "60%",
inputId = "numInput_turbinePars_numBlades",
label = label.help("No. of blades", "lbl_numBlades"),
value = startUpValues$turbinePars$numBlades, min = 1),
# ---- Rotor radius
numericInput(width = "60%",
inputId = "numInput_turbinePars_rotRadius",
label = label.help("Rotor Radius (m)", "lbl_rotorRadius"),
value = startUpValues$turbinePars$rotorRadius, min = 1, step = 0.1),
# ---- Air Gap
numericInput(width = "60%",
inputId = "numInput_turbinePars_airGap",
label = label.help("Air Gap (m)", "lbl_turbineAirGap"),
value = startUpValues$turbinePars$airGap, min = 1, step = 0.5),
# Maximum blade width
numericInput(width = "60%",
inputId = "numInput_turbinePars_maxBladeWdth",
label = label.help("Max blade width (m)", "lbl_maxBladeWdth"),
value = startUpValues$turbinePars$maxBladeWdth, min = 1, step = 0.1)
)
),
bsTooltip(id = "lbl_turbinePower",
title = paste0("The power output of each turbine"),
options = list(container = "body"), placement = "right", trigger = "hover"),
bsTooltip(id = "lbl_numBlades",
title = paste0("Number of blades in each turbine"),
options = list(container = "body"), placement = "right", trigger = "hover"),
bsTooltip(id = "lbl_rotorRadius",
title = paste0("The distance from the axis of rotation to blade tip"),
options = list(container = "body"), placement = "right", trigger = "hover"),
bsTooltip(id = "lbl_turbineAirGap",
title = paste0("Tip clearance height, i.e. the distance between the lowest rotor tip height",
" and sealevel (measured as Highest Astronomical Tide)"),
options = list(container = "body"), placement = "right", trigger = "hover"),
bsTooltip(id = "lbl_maxBladeWdth",
title = paste0("The maximum width of the rotor blade"),
options = list(container = "body"), placement = "right", trigger = "hover")
),
br(),
fluidRow(
box(width = 12,
tags$b(HTML(paste0("Monthly Operation", actionLink("lbl_monthOPs", label=NULL,
icon=icon('info-circle'))))),
bsTooltip(id = "lbl_monthOPs",
title = paste0("Information on turbine activity per month: % of wind availability (treated as constant) and % of",
" maintenance downtime (~ Normal)"),
options = list(container = "body"), placement = "right", trigger = "hover"),
br(),
br(),
rHandsontableOutput("hotInput_turbinePars_monthOps", width = "100%"),
tags$style(type="text/css", "#hotInput_turbinePars_monthOps th {font-weight:bold;}"),
br(),
br(),
column(6,
plotOutput("plot_turbinePars_monthOps_windAvb", width = "100%", height = 250)
),
column(6,
plotOutput("plot_turbinePars_monthOps_downtime", width = "100%", height = 250)
)
)
),
br(),
fluidRow(
box(width = 12,
tags$b(HTML(paste0("Rotation Speed and Blade Pitch"))),
br(),
br(),
helpText("Choose between simulating rotor speed and pitch from probability distributions OR from a relationship with wind speed"),
fluidRow(
column(4,
radioGroupButtons(inputId = "radGrpInput_turbinePars_rotationAndPitchOption",
individual = TRUE,
justified = TRUE,
label = NULL,
choices = c("Probability distributions" = "probDist",
"Wind Speed relationship" = "windSpeedReltn"),
checkIcon = list(yes = tags$i(class = "fa fa-circle",
style = "color: steelblue"),
no = tags$i(class = "fa fa-circle-o",
style = "color: steelblue")))
)),
br(),
br(),
conditionalPanel(
condition = "input.radGrpInput_turbinePars_rotationAndPitchOption == 'probDist'",
fluidRow(
column(4,
box(width = 12,
NormNumericInput(paramID = "turbinePars_rotnSpeed", specID = "",
varName = "Rotation (rpm)",
infoId = "lbl_rotSpeedProbDist",
infoText = paste0("Turbine rotor speed (~ Truncated Normal with lower bound at 0). ",
"SD should be 0 unless suitable info on rotor speed variability is available"),
E_value = startUpValues$turbinePars$rotnSpeed_E, SD_value = startUpValues$turbinePars$rotnSpeed_SD),
plotOutput("plot_turbinePars_rotnSpeed", width = 310, height = 200),
br(),
verbatimTextOutput("qtls_turbinePars_rotnSpeed")
)
),
column(4,
box(width = 12,
NormNumericInput(paramID = "turbinePars_bladePitch", specID = "",
varName = "Pitch (deg)",
infoId = "lbl_bladePitchProbDist",
infoText = paste0("Blade pitch, i.e. the angle of the blade relative to rotor plane (~Truncated Normal with lower bound at 0). ",
"SD should be 0 unless suitable info on pitch variability is available"),
E_value = startUpValues$turbinePars$bladePitch_E, SD_value = startUpValues$turbinePars$bladePitch_SD),
plotOutput("plot_turbinePars_bladePitch", width = 310, height = 200),
br(),
verbatimTextOutput("qtls_turbinePars_bladePitch")
)
)
)
),
conditionalPanel(
condition = "input.radGrpInput_turbinePars_rotationAndPitchOption == 'windSpeedReltn'",
fluidRow(
column(4,
rHandsontableOutput("hotInput_turbinePars_rotationVsWind", width = "100%"),
tags$style(type="text/css", "#hotInput_turbinePars_rotationVsWind th {font-weight:bold;}")
),
column(4,
rHandsontableOutput("hotInput_turbinePars_pitchVsWind", width = "100%"),
tags$style(type="text/css", "#hotInput_turbinePars_pitchVsWind th {font-weight:bold;}")
),
column(4,
NormNumericInput(paramID = "miscPars_windSpeed", specID = "",
varName = "Wind Speed (m/s)",
infoId = "lbl_winSpeed",
infoText = paste0("Wind speed (~Truncated Normal with lower bound at 0)"),
E_value = startUpValues$turbinePars$windSpeed_E, SD_value = startUpValues$turbinePars$windSpeed_SD),
plotOutput("plot_miscPars_windSpeed", width = 310, height = 200),
verbatimTextOutput("qtls_miscPars_windSpeed")
)
)
)
)
)
)
)
),
tabItem(tabName="tab_simulation", class = "active",
fluidRow(
box(title = "Simulation Options", width = 2, status = "primary", solidHeader = TRUE, #background = "aqua",
# checkboxInput(inputId = "chkBoxInput_simulPars_largeArrarCorr", label = tags$b("Apply large Array Correction"),
# value = TRUE),
tags$b(HTML(paste0("Large Array Correction", actionLink("lbl_arrayCorrect", label=NULL,
icon=icon('info-circle'))))),
bsTooltip(id = "lbl_arrayCorrect",
title = paste0("Adjustment to the probability of bird collision to account for the depletion ",
"of bird density in later rows of windfarms with a large array of turbines"),
options = list(container = "body"), placement = "right", trigger = "hover"),
switchInput(inputId = "chkBoxInput_simulPars_largeArrarCorr", onStatus = "success", offStatus = "danger",
value = TRUE),
hr(),
sliderInput(inputId = "sldInput_simulPars_numIter", label = "Number of Iterations",
min = 1000, max = 5000, step = 100, value = 1000),
hr(),
actionButton(inputId = "actButtonInput_simulPars_GO", label = tags$b("Run Simulation"),
icon = icon("cogs"), width = "100%")
),
box(title = "Model Ouputs", width = 10, status = "primary", solidHeader = TRUE,
uiOutput("simResults_UI")
)
)
)
),
# popup msg for the elements in the header
bsTooltip(id = "lbl_issuesLink",
title = paste0("Submit issues, queries & suggestions. Thanks!"),
options = list(container = "body"), placement = "bottom", trigger = "hover"),
bsTooltip(id = "lbl_codeLink",
title = paste0("Code and user manual"),
options = list(container = "body"), placement = "bottom", trigger = "hover"),
bsTooltip(id = "appvrsn",
title = paste0("Release notes"),
options = list(container = "body"), placement = "bottom", trigger = "hover"),
bsTooltip(id = "saveInputs_btt",
title = "Store currently specified input values",
options = list(container = "body"), placement = "bottom", trigger = "hover"),
bsTooltip(id = "restoreInputs_btt",
title = "Restore inputs to latest stored values",
options = list(container = "body"), placement = "bottom", trigger = "hover")
)
bootstrapPage(
useShinyjs(),
#extendShinyjs(text = jsCode),
extendShinyjs(text= jsCode,functions=c("backgroundCol")),
useSweetAlert(),
# Add custom CSS & Javascript;
tagList(tags$head(
tags$link(rel="stylesheet", type="text/css",href="styles.css"),
tags$script(type="text/javascript", src = "busy.js"),
tags$style(".swal-modal {width: 30%;}")
)),
dashboardPage(header, sidebar, body),
div(class = "busy",
tags$b(h4("Working on it...")),
img(src="loading.gif")
)
)