idf_object {eplusr} | R Documentation |
Create an IdfObject
object.
Description
idf_object()
takes a parent Idf
object, an object name or class name, and
returns a corresponding IdfObject.
Usage
idf_object(parent, object = NULL, class = NULL)
Arguments
parent |
An Idf object. |
object |
A valid object ID (an integer) or name (a string). If |
class |
A valid class name (a string). If |
Details
If object
is not given, an empty IdfObject of specified class is created,
with all field values filled with defaults, if possible. Note that
validation is performed when creating, which means that an error may occur if
current validate level does not allow empty required fields.
The empty IdfObject is directly added into the parent Idf object. It is
recommended to use $validate()
method in IdfObject to see what kinds of
further modifications are needed for those empty fields and use $set()
method to set field values.
Value
An IdfObject object.
Examples
## Not run:
model <- read_idf(system.file("extdata/1ZoneUncontrolled.idf", package = "eplusr"))
# get an IdfObject using object ID
idf_object(model, 14)
# get an IdfObject using object name (case-insensitive)
idf_object(model, "zone one")
# `class` argument is useful when there are objects with same name in
# different class
idf_object(model, "zone one", "Zone")
# create a new zone
eplusr_option(validate_level = "draft")
zone <- idf_object(model, class = "Zone")
zone
eplusr_option(validate_level = "final")
zone$validate()
## End(Not run)