Class IdfObject
- Namespace
- EpNet
- Assembly
- EpNet.dll
Represents an individual idf object, as a enumeration of fields
public class IdfObject : IEquatable<IdfObject>
- Inheritance
-
objectIdfObject
- Implements
- Extension Methods
Constructors
IdfObject()
Creates a new IdfObject instance
public IdfObject()
IdfObject(IEnumerable<string>)
Creates a new IdfObject instance from a IEnumerable of of field strings.
public IdfObject(IEnumerable<string> fields)
Parameters
fields
IEnumerable<string>List of fields (IdfClass + fields)
IdfObject(params string[])
Creates a new IdfObject instance from a list of fields
public IdfObject(params string[] fields)
Parameters
fields
string[]List of fields (IdfClass + fields)
Properties
Comments
public List<string> Comments { get; set; }
Property Value
- List<string>
Count
Number of fields in the object.
public int Count { get; }
Property Value
- int
Number of fields.
Fields
public List<Field> Fields { get; }
Property Value
- List<Field>
IdfClass
Idf class of the object (e.g.Runperiod, BuildingSurface:Detailed, Zone...).
public string IdfClass { get; set; }
Property Value
- string
Name of the IdfClass
IdfReader
Reference to the parent IdfReader that owns this IdfObject.
public IdfReader IdfReader { get; set; }
Property Value
- IdfReader
Parent IdfReader
this[int]
Returns the field in a specific position from the idf object
public Field this[int index] { get; }
Parameters
index
intZero-based index of the field.
Property Value
- Field
Field object.
this[string]
Returns the field with a specified name from the idf object
public Field this[string name] { get; }
Parameters
name
stringStandard name of the field (as found in Energy+.idd file)
Property Value
- Field
Field object
Name
Returns the first value of the idfobject. Usually the name.
public string Name { get; set; }
Property Value
- string
Name of the idfobject
PreComments
List of idf comments preceding the object.
public List<string> PreComments { get; set; }
Property Value
- List<string>
Comments preceding the idf object.
Methods
AddField(string, string)
Append one field to an idf object.
public void AddField(string field, string comment = "")
Parameters
AddFields(params string[])
Append fields to an idf object. Comments are defaulted to blank.
public void AddFields(params string[] fields)
Parameters
fields
string[]List of fields
Clone()
Returns a copy of the specified idf object for the same IdfReader.
public IdfObject Clone()
Returns
- IdfObject
Cloned idf object.
Clone(IdfReader)
Returns a clone of the specified idf object.
public IdfObject Clone(IdfReader idfReader)
Parameters
idfReader
IdfReaderIdfReader this clone will be linked to
Returns
- IdfObject
Cloned idf object.
ContainsValue(string)
Returns true if any field of the idfobject contains the provided string value
public bool ContainsValue(string value)
Parameters
value
stringvalue to search for
Returns
- bool
true if contains the value. false otherwise.
DefaultComments()
Sets the default comments for all fields in the object based on their names in the Idd.
public void DefaultComments()
Equals(IdfObject)
Determines whether this instance and a specified object, have the same field values.
public bool Equals(IdfObject obj)
Parameters
obj
IdfObject
Returns
- bool
true if all the fields are the same as in this instance; otherwise, false.
EqualsParameters(IdfObject)
Determines whether all the fields, but the name, in two specified idf objects are equal.
public bool EqualsParameters(IdfObject idfObject)
Parameters
idfObject
IdfObjectSecond object to be compared with.
Returns
- bool
true if equal but name
GetComment(int)
Retrieves the comment associated with a field at the specified index.
public string GetComment(int index)
Parameters
index
intThe zero-based index of the field.
Returns
- string
The comment as a string.
GetName(int)
Retrieves the name of the field at the specified index, as defined in the Idd.
public string GetName(int index)
Parameters
index
intThe zero-based index of the field.
Returns
- string
The field name as a string.
GetNumber(int)
Retrieves the numeric value of a field at the specified index. Returns 0 if it is not a numeric field.
public double GetNumber(int index)
Parameters
index
intThe zero-based index of the field.
Returns
- double
The field value as a double.
GetNumber(string)
Retrieves the numeric value of a field by its name. Returns 0 if it is not a numeric field.
public double GetNumber(string name)
Parameters
name
stringThe name of the field.
Returns
- double
The field value as a double.
GetValue(int)
Retrieves the value of a field at the specified index.
public string GetValue(int index)
Parameters
index
intThe zero-based index of the field.
Returns
- string
The field value as a string.
GetValue(string)
Retrieves the value of a field by its name.
public string GetValue(string name)
Parameters
name
stringThe name of the field.
Returns
- string
The field value as a string.
InsertField(int, string, string)
Insert one field to an idf object at the specified index.
public void InsertField(int index, string field, string comment = "")
Parameters
index
intThe zero-based index at which the field will be inserted
field
stringField value
comment
stringField comment
InsertFields(int, params string[])
Insert a list of fields to an idf object at the specified index. Comments are defaulted to blank.
public void InsertFields(int index, params string[] fields)
Parameters
RemoveField(int)
Remove one field to an idf object.
public void RemoveField(int index)
Parameters
index
intField index
RemoveFields(int, int)
Remove fields to an idf object.
public void RemoveFields(int index, int count)
Parameters
SetComment(int, string)
Sets the comment for a field at the specified index.
public void SetComment(int index, string comment)
Parameters
SetNumber(int, double)
Sets the numeric value of a field at the specified index.
public void SetNumber(int index, double number)
Parameters
SetNumber(string, double)
Sets the numeric value of a field by its name.
public void SetNumber(string name, double number)
Parameters
SetValue(int, string)
Sets the value of a field at the specified index.
public void SetValue(int index, string value)
Parameters
SetValue(string, string)
Sets the value of a field by its name.
public void SetValue(string name, string value)
Parameters
ToString()
Gets the formatted text representation of the idf object in EnergyPlus format including comments.
public override string ToString()
Returns
- string
idf text string.
ToString(bool)
Gets the formatted text representation of the idf object in EnergyPlus format
public string ToString(bool comments)
Parameters
comments
boolsets whether comments are included in the output string.
Returns
- string
idf text string.
Values(int, int, int)
Returns a selection of the string values of the fields
public IEnumerable<string> Values(int start = 1, int skip = 1, int end = 1000)
Parameters
start
intFirst position to start
skip
intValues to skip between previous and next selected value
end
intLast position to select
Returns
- IEnumerable<string>
List of selected values
Operators
operator ==(IdfObject, IdfObject)
Determines whether all the fields, including the name, in two specified idf objects are equal.
public static bool operator ==(IdfObject a, IdfObject b)
Parameters
Returns
- bool
true if the value of a is the same as the value of b; otherwise, false.
operator !=(IdfObject, IdfObject)
Determines if two specified idf objects are different by at least one field.
public static bool operator !=(IdfObject a, IdfObject b)
Parameters
Returns
- bool
false if the all the fields in a are the same as the fields in b; otherwise, true.