Documentation
¶
Index ¶
- Constants
- type Bus
- type Client
- func (c *Client) BuildNumber() (int, error)
- func (c *Client) EquipmentType(hnd int) (int, error)
- func (c *Client) FindBus(name string, kv float64) (int, error)
- func (c *Client) FindBusNo(n int) (int, error)
- func (c *Client) GetData(hnd int, tokens ...int) Data
- func (c *Client) Info() string
- func (c *Client) LoadDataFile(name string) error
- func (c *Client) NextEquipment(eqType int) HandleIterator
- func (c *Client) NextEquipmentByTag(eqType int, tags ...string) HandleIterator
- func (c *Client) ReadChangeFile(name string) error
- func (c *Client) Release() error
- func (c *Client) SaveDataFile(name string) error
- func (c *Client) Version() (string, error)
- type Data
- type HandleIterator
- type NextEquipment
- type NextEquipmentByTag
Examples ¶
Constants ¶
const ( KiB = 1 << (10 * 1) MiB = 1 << (10 * 2) )
Byte size constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
HND int // ASPEN Oneliner equipment handle
Name string // BUSsName
KVNominal float64 // BUSdKVnominal
Number int // BUSnNumber
Area int // BUSnArea
Zone int // BUSnZone
Tap int // BUSnTapBus
Comment string // BUSsComment (aka Memo field)
}
Bus represents a bus equipment data structure. This does not represent all fields from ASPEN model, future fields may be added as needed.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a new goolx api client.
func (*Client) BuildNumber ¶
BuildNumber parses the build number from the olxapi.dll info function.
func (*Client) EquipmentType ¶
EquipmentType returns the equipment type code for the equipment with the provided handle
func (*Client) FindBusNo ¶
FindBusNo returns the bus with the provided bus number. Or returns 0 and an error if not found.
func (*Client) GetData ¶
GetData returns data for the object handle, and all parameter tokens provided. The data for each token can be retrieved using the Scan method on the Data type. This is similar to the Row.Scan in the sql package.
func (*Client) LoadDataFile ¶
LoadDataFile loads *.olr file from disk
func (*Client) NextEquipment ¶
func (c *Client) NextEquipment(eqType int) HandleIterator
NextEquipment returns an EquipmentIterator type. The EquipmentIterator will loop through all equipment handles in the case until it reaches the end. This is done using the Next() and Hnd() methods. Note: ASPEN equipment handle integers are not unique and are generated on data access. Therefore care should be taken when using handle across functions or applications. It is recommended to use the handle immediately after retrieving to get unique equipment identifiers.
func (*Client) NextEquipmentByTag ¶
func (c *Client) NextEquipmentByTag(eqType int, tags ...string) HandleIterator
NextEquipmentByTag returns a NextEquipmentTag type which satisfies the HandleIterator interface.
func (*Client) ReadChangeFile ¶
ReadChangeFile reads *.chf file from disk and applies to case
func (*Client) SaveDataFile ¶
SaveDataFile saves *.olr file to disk
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data represents data returned via the GetData method.
func (*Data) Scan ¶
Scan copies the data from the matched parameter token into the values pointed at by dest. The order of the destination pointers should match the parameters queried with GetData. Will return an error if any parameters produced an error during GetData call. Data will not be populated in this case.
Example ¶
var busHnd int
api := NewClient()
data := api.GetData(busHnd, olxapi.BUSsName, olxapi.BUSdKVP)
// Scan loads the data into the pointers provided populating the Bus structure in this example.
bus := Bus{}
data.Scan(&bus.Name, &bus.KVNominal)
type HandleIterator ¶
HandleIterator is a iterator interface for equipment handles.
type NextEquipment ¶
type NextEquipment struct {
// contains filtered or unexported fields
}
NextEquipment is an equipment handle iterator for getting the next equipment handle of the provided type. The Next() method will retrieve the next handle if available and populate it for access by Hnd(). If Next() returns false, then there was an error or the list was exhausted. Once the iterator is exhausted it cannot be reused.
func (*NextEquipment) Hnd ¶
func (n *NextEquipment) Hnd() int
Hnd returns the current equipment handle, Next() must be called first.
func (*NextEquipment) Next ¶
func (n *NextEquipment) Next() bool
Next retrieves the next equipment handle of type. Returns true if successful, and false if not. Hnd() should not be used if Next() is false. This can be used in for loops.
type NextEquipmentByTag ¶
type NextEquipmentByTag struct {
// contains filtered or unexported fields
}
NextEquipmentByTag is an equipment handle iterator for getting the next equipment handle of the provided type with the listed tags. The Next() method will retrieve the next handle if available and populate it for access by Hnd(). If Next() returns false, then there was an error or the list was exhausted. Once the iterator is exhausted it cannot be reused.
func (*NextEquipmentByTag) Hnd ¶
func (n *NextEquipmentByTag) Hnd() int
Hnd returns the current equipment handle, Next() must be called first.
func (*NextEquipmentByTag) Next ¶
func (n *NextEquipmentByTag) Next() bool
Next retrieves the next equipment handle of type. Returns true if successful, and false if not. Hnd() should not be used if Next() is false. This can be used in for loops.