hongyuanjia / epluspar

Conduct parametric analysis on EnergyPlus models in R
https://hongyuanjia.github.io/epluspar
Other
9 stars 0 forks source link

Error encountered while trying to run an optimization with Epluspar R package. #32

Closed mdakyen closed 3 years ago

mdakyen commented 3 years ago

@hongyuanjia, greetings of the day.

report

Bellow is an objective function code, that is meant to evaluate discomfort hours, by extracting data from the table displayed above.

# Evaluate discomfort hours
  discomfort_hours <- function(idf) {

  # Local definition of time (hours) not meeting adaptive comfort model
 discomfort_time <- as.double(idf$last_job()$tabular_data(
   report_name = "AdaptiveComfortSummary",
   table_name = "Time Not Meeting the Adaptive Comfort Models during Occupied Hours",
   row_name = "OCCUPANTS",
   column_name = "ASHRAE55 80% Acceptability Limits"
  )
  $value)

# Evaluate the discomfort hours
 discomfort_time<-(discomfort_time/8760)*100

 # return discomfort hours
 discomfort_time

}

However, I encountered the following error when I tried to run the code. Please, can you help me resolve the problem, sir?

-- Initialization --------------------------------------------------------------------------------------
  * Create initial population
Checking if parameter(s) has been set ...
Checking if objective(s) has been set ...
Validating parameter function 'design_options' ...
Validating objective function(s)...
  [1] 'combined_primary_energy' --> OK
  [2] 'combined_global_cost' --> OK
Error: Objective function 'discomfort_hours' should return at least a length-one vector instead of a 0-length one.