Closed JamesCheng21 closed 5 years ago
Currently epScan only supports numeric fields. Here numeric fields indicate fields should have \type integer
or \type real
in their IDD definitions.
Looking at the definition of Schedule:Compact
in IDD, you would see that all fields are not explicitly marked as numbers, which means they will be treated as characters. This is because beside schedule values, every field in Schedule:Compact
could be also Through: date
, For: day of week
, Until: time
.
Schedule:Compact,
\extensible:1 - repeat last field, remembering to remove ; from "inner" fields.
\min-fields 5
\memo Irregular object. Does not follow the usual definition for fields. Fields A3... are:
\memo Through: Date
\memo For: Applicable days (ref: Schedule:Week:Compact)
\memo Interpolate: Average/Linear/No (ref: Schedule:Day:Interval) -- optional, if not used will be "No"
\memo Until: <Time> (ref: Schedule:Day:Interval)
\memo <numeric value>
\memo words "Through","For","Interpolate","Until" must be included.
\format compactSchedule
A1 , \field Name
\required-field
\type alpha
\reference ScheduleNames
A2 , \field Schedule Type Limits Name
\type object-list
\object-list ScheduleTypeLimitsNames
A3 , \field Field 1
\begin-extensible
A4 , \field Field 2
...
By default, eplusr uses "final"
validation strictness level, which includes all possible checkings during object modifications.
eplusr::eplusr_option("validate_level")
# [1] "final"
eplusr::level_checks()
# $required_object
# [1] TRUE
#
# $unique_object
# [1] TRUE
#
# $unique_name
# [1] TRUE
#
# $extensible
# [1] TRUE
#
# $required_field
# [1] TRUE
#
# $autofield
# [1] TRUE
#
# $type
# [1] TRUE
#
# $choice
# [1] TRUE
#
# $range
# [1] TRUE
#
# $reference
# [1] TRUE
#
So directly assign a number to Field XX
will fail.
idf <- empty_idf(8.8)
idf$add(Schedule_Compact = list("sch", NULL, "Through: 12/31", "For: AllDays", "Until: 24:00", 1))
# ✖ [1] Errors found during validation.
# ══════════════════════════════════════════════════════════════════════════
#
# ── [1] Invalid Character ─────────────────────────────────────────────────
# Fields below should be characters but are not:
#
# Class: <Schedule:Compact>
# └─ Object [ID:Input #1] <sch>
# └─ 6: "1"; !- Field 4
One possible workaround would be just to disable the type
checking. You can achieve this by doing:
checks <- eplusr::level_checks()
checks$type <- FALSE
eplusr::eplusr_option(validate_level = checks)
idf$add(Schedule_Compact = list("sch"))
# $sch
# <IdfObject: `Schedule:Compact`> [ID:54] `sch`
# Class: <Schedule:Compact>
# ├─ 1: "sch", !- Name
# │─ 2: <"Blank">, !- Schedule Type Limits Name
# │─ 3: <"Blank">, !- Field 1
# │─ 4: <"Blank">, !- Field 2
# └─ 5: <"Blank">; !- Field 3
#
idf$Schedule_Compact$sch$Field_1 <- 1
idf$Schedule_Compact$sch
# <IdfObject: `Schedule:Compact`> [ID:2] `sch`
# Class: <Schedule:Compact>
# ├─ 1: "sch", !- Name
# │─ 2: <"Blank">, !- Schedule Type Limits Name
# │─ 3: "1", !- Field 1
# │─ 4: <"Blank">, !- Field 2
# └─ 5: <"Blank">; !- Field 3
Since eplusr just follows the IDD definition, instead of changing the behavior of eplusr, I would say a better way to go is to add a preprocess in epScan::SensitivityJob$param()
to automatically turn off type checking whenever it sees input parameter definitions includes an actual Schedule:Compact
schedule value.
eplusr will report an " invalid character" error while changing the temperature of schedule in epScan.