goolx

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 8 Imported by: 3

README

Go Reference Go Report Card

Overview

Disclaimer: This project is not endorsed or affiliated with ASPEN Inc.

goolx is an unofficial Go wrapper around ASPEN's Oneliner API. It can be utilized to create programs which interact with Oneliner through the provided API functions. Additionally, it provides helper functions for common analysis tasks.

The goal of this module is to provide generic unopinionated abstractions for fault analysis. These functions can be used as a building block for useful fault analysis application development.

This library is in Version 0.x.x, and may have breaking API changes during development.

Installation

It is required users of this Go module have authorized licenses for the underlying ASPEN software v15.4 or newer. Obtaining this third-party software is outside the scope of this README.

The module can be installed using the following go get command.

go get -u github.com/readpe/goolx

This library is only designed for use on Windows 386 architecture. To properly build, ensure your GOOS and GOARCH environment variables are set appropriately:

GOOS=windows
GARCH=386

Usage Example

import (
	"fmt"
	"log"

	"github.com/readpe/goolx"
	"github.com/readpe/goolx/olxapi"
)

func main() {
	c := goolx.NewClient()
	defer c.Release() // releases api dll at function return

	// Print the olxapi info.
	info := c.Info()
	fmt.Println(info)

	// Load a oneliner case into memory.
	err := c.LoadDataFile("system.olr")
	if err != nil {
		log.Fatal(err)
	}

	// Loop through all buses in case using NextEquipment iterator.
	buses := c.NextEquipment(olxapi.TCBus)
	for buses.Next() {
		hnd := buses.Hnd()

		// Get bus data
		b, err := goolx.GetBus(c, hnd)
		if err != nil {
			log.Println(fmt.Errorf("could not get bus data: %v", err))
			continue
		}
		fmt.Printf("found bus %s %fkV with handle: %d", b.Name, b.KVNominal, b.HND)
	}
}

Acknowledgements

Thanks to ASPEN Inc. for providing the Python API which inspired the development of this module.

Documentation

Index

Examples

Constants

View Source
const (
	TCNothing   = 0
	TCBus       = 1
	TCLoad      = 2
	TCLoadUnit  = 3
	TCShunt     = 4
	TCShuntUnit = 5
	TCGen       = 6
	TCGenUnit   = 7
	TCSVD       = 8
	TCBranch    = 9
	TCLine      = 10
	TCXFMR      = 11
	TCXFMR3     = 12
	TCPS        = 13
	TCSCAP      = 14
	TCMU        = 15
	TCArea      = 16
	TCZone      = 17
	TCNote      = 18
	TCSYS       = 19
	TCRLYGroup  = 20
	TCRLYOC     = 21
	TCRLYOCG    = 21
	TCRLYOCP    = 22
	TCRLYDS     = 23
	TCRLYDSG    = 23
	TCRLYDSP    = 24
	TCFuse      = 25
	TCPF        = 26
	TCSC        = 27
	TCSwitch    = 28
	TCRECLSR    = 29
	TCRECLSRP   = 29
	TCRECLSRG   = 30
	TCScheme    = 31
	TCBreaker   = 32
	TCCCGEN     = 33
	TCRLYD      = 34
	TCRLYV      = 35
	TCPILOT     = 36
	TCZCorrect  = 37
	TCBlob      = 38
	TCDCLine2   = 39
	TCLineKink  = 40
	TCRLYLink   = 41
	TCLTC       = 42
	TCLTC3      = 43
	TCSettings  = 44
	TCCount     = 44
	TCPicked    = 100
	TCPicked1   = 100
	TCPicked2   = 101
	TCPicked3   = 102

	// Special obj handles
	HNDSYS = 1
	HNDPF  = 2
	HNDSC  = 3

	OLXAPIFailure = 0
	OLXAPIOk      = 1

	// Fault browser code
	SFLast     = -1
	SFNext     = -2
	SFFirst    = 1
	SFPrevious = -4

	// Array size
	MXMSGLEN   = 512
	MAXPATH    = 260
	MXDSPARAMS = 255
	MXZONE     = 8
	MAXCCV     = 10
	MXSBKF     = 10
)

Equipment Types

View Source
const (
	VTSTRING      = 1
	VTDOUBLE      = 2
	VTINTEGER     = 3
	VTARRAYSTRING = 4
	VTARRAYDOUBLE = 5
	VTARRAYINT    = 6

	BUSsName          = 101
	BUSsLocation      = 102
	BUSsComment       = 103
	GUsID             = 104
	GUsOnDate         = 105
	GUsOffDate        = 106
	SUsID             = 107
	SUsOnDate         = 108
	SUsOffDate        = 109
	LUsID             = 110
	LUsOnDate         = 111
	LUsOffDate        = 112
	BUSdKVnominal     = 201
	BUSdKVP           = 202
	BUSdAngleP        = 203
	BUSdSPCx          = 204
	BUSdSPCy          = 205
	LDdPload          = 206
	LDdQload          = 207
	GEdScheduledV     = 208
	GEdRefAngle       = 209
	GEdScheduledP     = 210
	GEdScheduledQ     = 211
	GEdPgen           = 212
	GEdQgen           = 213
	GEdVSourcePU      = 214
	GEdCurrLimit1     = 215
	GEdCurrLimit2     = 216
	SVdVmax           = 217
	SVdVmin           = 218
	SVdB              = 219
	GUdMVArating      = 220
	GUdRz             = 221
	GUdXz             = 222
	GUdMVA            = 223
	GUdPmin           = 224
	GUdPmax           = 225
	GUdQmin           = 226
	GUdQmax           = 227
	GUdSchedP         = 228
	GUdSchedQ         = 229
	SUdG              = 230
	SUdB              = 231
	SUdG0             = 232
	SUdB0             = 233
	LUdPload          = 234
	LUdQload          = 235
	BUSnNumber        = 301
	BUSnArea          = 302
	BUSnZone          = 303
	BUSnTapBus        = 304
	BUSnSubGroup      = 305
	BUSnSlack         = 306
	BUSnVisible       = 307
	LDnActive         = 308
	LDnBusHnd         = 309
	GEnCtrlBusHnd     = 310
	GEnSlack          = 311
	GEnActive         = 312
	GEnFixedPQ        = 313
	GEnBusHnd         = 314
	GUnOnline         = 315
	SVnActive         = 316
	SVnCtrlBusHnd     = 317
	SVnCtrlMode       = 318
	SVvnNoStep        = 619
	SVnBusHnd         = 320
	SHnBusHnd         = 321
	SUnOnline         = 322
	SUn3WX            = 323
	LUnOnline         = 324
	LUvdMW            = 501
	LUvdMVAR          = 502
	GUvdR             = 503
	GUvdX             = 504
	SVvdBinc          = 505
	SVvdB0inc         = 506
	BRnType           = 301
	BRnHandle         = 302
	BRnBus1Hnd        = 303
	BRnBus2Hnd        = 304
	BRnBus3Hnd        = 305
	BRnRlyGrp1Hnd     = 306
	BRnRlyGrp2Hnd     = 307
	BRnRlyGrp3Hnd     = 308
	BRnInService      = 309
	SYsFComment       = 101
	SYdBaseMVA        = 202
	SYnNObus          = 303
	SYnNOgen          = 304
	SYnNOload         = 305
	SYnNOshunt        = 306
	SYnNOline         = 307
	SYnNOseriescap    = 308
	SYnNOxfmr         = 309
	SYnNOxfmr3        = 310
	SYnNOps           = 311
	SYnNOmutual       = 312
	SYnNODSRly        = 313
	SYnNOOCRly        = 314
	SYnNORclsr        = 315
	SYnNODiffRly      = 316
	SYnNOVRly         = 317
	SYnNOIED          = 318
	LNsName           = 101
	LNsID             = 102
	LNsLengthUnit     = 103
	LNsType           = 104
	LNsOnDate         = 105
	LNsOffDate        = 106
	LNdR              = 201
	LNdX              = 202
	LNdR0             = 203
	LNdX0             = 204
	LNdG1             = 205
	LNdB1             = 206
	LNdG2             = 207
	LNdB2             = 208
	LNdG10            = 209
	LNdB10            = 210
	LNdG20            = 211
	LNdB20            = 212
	LNdLength         = 213
	LNnBus1Hnd        = 301
	LNnBus2Hnd        = 302
	LNnRlyGr1Hnd      = 303
	LNnRlyGr2Hnd      = 304
	LNnInService      = 305
	LNnMuPairHnd      = 306
	LNvdRating        = 501
	XRsName           = 101
	XRsID             = 102
	XRsCfgP           = 103
	XRsCfgS           = 104
	XRsCfgST          = 105
	XRsCfg1           = 103
	XRsCfg2           = 104
	XRsCfg2T          = 105
	XRsOnDate         = 106
	XRsOffDate        = 107
	XRdRG1            = 201
	XRdXG1            = 202
	XRdRG2            = 203
	XRdXG2            = 204
	XRdRGN            = 205
	XRdXGN            = 206
	XRdMVA            = 207
	XRdPriTap         = 208
	XRdSecTap         = 209
	XRdTap1           = 210
	XRdTap2           = 211
	XRdR              = 212
	XRdX              = 213
	XRdB              = 214
	XRdR0             = 215
	XRdX0             = 216
	XRdB0             = 217
	XRdMinTap         = 218
	XRdMaxTap         = 219
	XRdMaxVW          = 220
	XRdMinVW          = 221
	XRdLTCstep        = 222
	XRdG1             = 223
	XRdB1             = 224
	XRdG2             = 225
	XRdB2             = 226
	XRdG10            = 227
	XRdB10            = 228
	XRdG20            = 229
	XRdB20            = 230
	XRdMVA1           = 231
	XRdMVA2           = 232
	XRdMVA3           = 233
	XRdBaseMVA        = 234
	XRdLTCCenterTap   = 235
	XRnBus1Hnd        = 301
	XRnBus2Hnd        = 302
	XRnLTCCtrlBusHnd  = 303
	XRnMetered        = 304
	XRnInService      = 305
	XRnLTCside        = 306
	XRnLTCtype        = 307
	XRnAuto           = 308
	XRnRlyGr1Hnd      = 309
	XRnRlyGr2Hnd      = 310
	XRnLTCPriority    = 311
	XRnLTCGanged      = 312
	X3sName           = 101
	X3sID             = 102
	X3sCfgP           = 103
	X3sCfgS           = 104
	X3sCfgT           = 105
	X3sCfgST          = 106
	X3sCfgTT          = 107
	X3sCfg1           = 103
	X3sCfg2           = 104
	X3sCfg3           = 105
	X3sCfg2T          = 106
	X3sCfg3T          = 107
	X3sOnDate         = 108
	X3sOffDate        = 109
	X3dPriTap         = 201
	X3dSecTap         = 202
	X3dTerTap         = 203
	X3dTap1           = 204
	X3dTap2           = 205
	X3dTap3           = 206
	X3dRps            = 207
	X3dXps            = 208
	X3dR0ps           = 209
	X3dX0ps           = 210
	X3dRpt            = 211
	X3dXpt            = 212
	X3dR0pt           = 213
	X3dX0pt           = 214
	X3dRst            = 215
	X3dXst            = 216
	X3dR0st           = 217
	X3dX0st           = 218
	X3dB              = 219
	X3dB0             = 220
	X3dRG1            = 221
	X3dRG2            = 222
	X3dRG3            = 223
	X3dXG1            = 224
	X3dXG2            = 225
	X3dXG3            = 226
	X3dRGN            = 227
	X3dXGN            = 228
	X3dMVA1           = 229
	X3dMVA2           = 230
	X3dMVA3           = 231
	X3dBaseMVA        = 232
	X3dLTCCenterTap   = 233
	X3dMinVW          = 234
	X3dMaxVW          = 235
	X3dMinTap         = 236
	X3dMaxTap         = 237
	X3dLTCstep        = 238
	X3nInService      = 301
	X3nBus1Hnd        = 302
	X3nBus2Hnd        = 303
	X3nBus3Hnd        = 304
	X3nAuto           = 305
	X3nFictBusNo      = 306
	X3nRlyGr1Hnd      = 307
	X3nRlyGr2Hnd      = 308
	X3nRlyGr3Hnd      = 309
	X3nLTCPriority    = 310
	X3nLTCGanged      = 311
	XR3nLTCCtrlBusHnd = 312
	PSsName           = 101
	PSsID             = 102
	PSsOnDate         = 103
	PSsOffDate        = 104
	PSdAngle          = 201
	PSdR              = 202
	PSdX              = 203
	PSdB              = 204
	PSdR0             = 205
	PSdX0             = 206
	PSdB0             = 207
	PSdR2             = 208
	PSdX2             = 209
	PSdB2             = 210
	PSdAngleMax       = 211
	PSdAngleMin       = 212
	PSdMWmax          = 213
	PSdMWmin          = 214
	PSdMVA1           = 215
	PSdMVA2           = 216
	PSdMVA3           = 217
	PSnInService      = 318
	PSnBus1Hnd        = 319
	PSnBus2Hnd        = 320
	PSnControlMode    = 321
	PSnRlyGr1Hnd      = 322
	PSnRlyGr2Hnd      = 323
	SCsName           = 101
	SCsID             = 102
	SCsOnDate         = 103
	SCsOffDate        = 104
	SCdX              = 201
	SCdR              = 202
	SCdX0             = 203
	SCdR0             = 204
	SCdIpr            = 205
	SCnBus1Hnd        = 306
	SCnBus2Hnd        = 307
	SCnInService      = 308
	SCnSComp          = 309
	SCnRlyGr1Hnd      = 310
	SCnRlyGr2Hnd      = 311
	MUdFrom1          = 201
	MUdFrom2          = 202
	MUdTo1            = 203
	MUdTo2            = 204
	MUdX              = 205
	MUdR              = 206
	MUnHndLine1       = 307
	MUnHndLine2       = 308
	MUnOrient1        = 309
	MUnOrient2        = 310
	MUvdX             = 511
	MUvdR             = 512
	MUvdFrom1         = 513
	MUvdFrom2         = 514
	MUvdTo1           = 515
	MUvdTo2           = 516
	RGsNote           = 101
	RGdBreakerTime    = 201
	RGnInService      = 302
	RGnBranchHnd      = 303
	RGnPrimaryHnd     = 304
	RGnBackupHnd      = 305
	RGnTripLogicHnd   = 306
	RGnReclLogicHnd   = 307
	RGnOps            = 308
	RGvdRecloseInt    = 501
	OGsID             = 101
	OGsAssetID        = 102
	OGsType           = 103
	OGsComment        = 104
	OGsLibrary        = 105
	OPsID             = 106
	OPsAssetID        = 107
	OPsType           = 108
	OPsComment        = 109
	OPsLibrary        = 110
	FSsID             = 111
	FSsAssetID        = 112
	FSsType           = 113
	FSsComment        = 114
	FSsLibrary        = 115
	OGdCT             = 201
	OGdTap            = 202
	OGdTDial          = 203
	OGdInst           = 204
	OGdInstDelay      = 205
	OGdTimeAdd        = 206
	OGdTimeMult       = 207
	OGdTimeAdd2       = 208
	OGdTimeMult2      = 209
	OGdResetTime      = 210
	OPdCT             = 211
	OPdTap            = 212
	OPdTDial          = 213
	OPdInst           = 214
	OPdInstDelay      = 215
	OPdTimeAdd        = 216
	OPdTimeMult       = 217
	OPdTimeAdd2       = 218
	OPdTimeMult2      = 219
	OPdVCtrlRestPcnt  = 220
	OPdResetTime      = 221
	OPnRlyGrHnd       = 301
	OGnRlyGrHnd       = 302
	OGnInService      = 303
	OGnDirectional    = 304
	OGnIDirectional   = 305
	OGnPolar          = 306
	OGnFlatDelay      = 307
	OGnDCOffset       = 308
	OGnSignalOnly     = 309
	OPnInService      = 310
	OPnDirectional    = 311
	OPnIDirectional   = 312
	OPnPolar          = 313
	OPnByCTConnect    = 314
	OPnFlatDelay      = 315
	OPnDCOffset       = 316
	OPnSignalOnly     = 317
	OPnVoltControl    = 318
	FSnRlyGrHnd       = 319
	FSnInService      = 320
	FSnCurve          = 321
	OGvdDirSetting    = 501
	OPvdDirSetting    = 502
	DGsID             = 101
	DGsAssetID        = 102
	DGsType           = 103
	DGsDSType         = 104
	DGsComment        = 105
	DGsLibrary        = 106
	DGsParam          = 107
	DPsID             = 108
	DPsAssetID        = 109
	DPsType           = 110
	DPsDSType         = 111
	DPsComment        = 112
	DPsLibrary        = 113
	DPsParam          = 114
	DGdCT             = 201
	DGdVT             = 202
	DGdKmag           = 203
	DGdKang           = 204
	DGdMinI           = 205
	DPdCT             = 206
	DPdVT             = 207
	DPdMinI           = 208
	DGnInService      = 301
	DGnRlyGrHnd       = 302
	DGnParamCount     = 303
	DGnSignalOnly     = 304
	DPnInService      = 305
	DPnRlyGrHnd       = 306
	DPnParamCount     = 307
	DPnSignalOnly     = 308
	DGvdParams        = 501
	DGvParams         = 402
	DGvParamLabels    = 403
	DGvdDelay         = 504
	DGvdReach         = 505
	DGvdReach1        = 506
	DPvdParams        = 507
	DPvParams         = 408
	DPvParamLabels    = 409
	DPvdDelay         = 510
	DPvdReach         = 511
	DPvdReach1        = 512
	CPsID             = 101
	CPsAssetID        = 102
	CPsTypeFast       = 103
	CPsTypeSlow       = 104
	CPsComment        = 105
	CPsLibrary        = 106
	CGsID             = 107
	CGsAssetID        = 108
	CGsTypeFast       = 109
	CGsTypeSlow       = 110
	CGsComment        = 111
	CGsLibrary        = 112
	CPdPickupF        = 201
	CPdPickupS        = 202
	CPdTimeAddF       = 203
	CPdTimeAddS       = 204
	CPdTimeMultF      = 205
	CPdTimeMultS      = 206
	CPdMinTF          = 207
	CPdMinTS          = 208
	CPdHiAmps         = 209
	CPdHiAmpsDelay    = 210
	CPdRecIntvl1      = 211
	CPdRecIntvl2      = 212
	CPdRecIntvl3      = 213
	CPdIntrTime       = 214
	CGdPickupF        = 215
	CGdPickupS        = 216
	CGdTimeAddF       = 217
	CGdTimeAddS       = 218
	CGdTimeMultF      = 219
	CGdTimeMultS      = 220
	CGdMinTF          = 221
	CGdMinTS          = 222
	CGdHiAmps         = 223
	CGdHiAmpsDelay    = 224
	CGdRecIntvl1      = 225
	CGdRecIntvl2      = 226
	CGdRecIntvl3      = 227
	CGdIntrTime       = 228
	CPnInService      = 301
	CPnTotalOps       = 302
	CPnFastOps        = 303
	CPnCurveInUse     = 304
	CPnTAddAppl       = 305
	CPnTMultAppl      = 306
	CPnRlyGrHnd       = 307
	CGnInService      = 308
	CGnTotalOps       = 309
	CGnFastOps        = 310
	CGnCurveInUse     = 311
	CGnTAddAppl       = 312
	CGnTMultAppl      = 313
	CGnRlyGrHnd       = 314
	FTdXPt            = 201
	FTdRPt            = 202
	FTdXNt            = 203
	FTdRNt            = 204
	FTdXZt            = 205
	FTdRZt            = 206
	FTdRt             = 207
	FTdXt             = 208
	FTdXR             = 209
	FTdMVA            = 210
	FTdXRANSI         = 211
	FTnNOfaults       = 301
	SWsID             = 101
	SWsName           = 102
	SWsOnDate         = 103
	SWsOffDate        = 104
	SWdRating         = 201
	SWnBus1Hnd        = 301
	SWnBus2Hnd        = 302
	SWnRlyGrHnd1      = 303
	SWnRlyGrHnd2      = 304
	SWnInService      = 305
	SWnStatus         = 306
	SWnDefault        = 307
	CCsOnDate         = 101
	CCsOffDate        = 102
	CCdMVArating      = 201
	CCdVmax           = 202
	CCdVmin           = 203
	CCnVloc           = 301
	CCnInService      = 302
	CCvdV             = 501
	CCvdI             = 502
	CCvdAng           = 503
	RDsID             = 101
	RDsAssetID        = 102
	RDsTLCCurvePh     = 103
	RDsTLCCurveI0     = 104
	RDsTLCCurveI2     = 105
	RVsID             = 106
	RVsAssetID        = 107
	RVsOVCurve        = 108
	RVsUVCurve        = 109
	RDdCTR1           = 201
	RDdPickupPh       = 202
	RDdPickup3I0      = 203
	RDdPickup3I2      = 204
	RDdTLCTDDelayPh   = 205
	RDdTLCTDDelayI0   = 206
	RDdTLCTDDelayI2   = 207
	RVdCTR            = 208
	RVdOVTPickup      = 209
	RVdOVTDelay       = 210
	RVdOVIPickup      = 211
	RVdUVTPickup      = 212
	RVdUVTDelay       = 213
	RVdUVIPickup      = 214
	RDnRlyGrpHnd      = 301
	RDnLocalCTHnd1    = 302
	RDnRmeDevHnd1     = 303
	RDnRmeDevHnd2     = 304
	RDnSignalOnly     = 305
	RDnInService      = 306
	RVnRlyGrpHnd      = 307
	RVnSignalOnly     = 308
	RVnVoltOperate    = 309
	RVnInService      = 310
	BKsID             = 101
	BKsEquipGrp1      = 102
	BKsEquipGrp2      = 103
	BKdRating1        = 201
	BKdRating2        = 202
	BKdCPT1           = 203
	BKdCPT2           = 204
	BKdCycles         = 205
	BKdOperatingKV    = 206
	BKdRatedKV        = 207
	BKdK              = 208
	BKdNACD           = 209
	BKnRatingType     = 301
	BKnTotalOps1      = 302
	BKnTotalOps2      = 303
	BKnDontDerate     = 304
	BKnInService      = 305
	BKnInterrupt1     = 306
	BKnInterrupt2     = 307
	BKnBusHnd         = 308
	BKvdRecloseInt1   = 501
	BKvdRecloseInt2   = 502
	BKvnG1DevHnd      = 603
	BKvnG1OutageHnd   = 604
	BKvnG2DevHnd      = 605
	BKvnG2OutageHnd   = 606
	LSsID             = 101
	LSsAssetID        = 102
	LSsScheme         = 103
	LSsEquation       = 104
	LSsVariables      = 105
	LSnSignalOnly     = 301
	LSnInService      = 302
	LSnRlyGrpHnd      = 303
)

Parameter tokens 100s: string 200s: double 300s: integers 400s: arrays of strings (tab delimited) 500s: arrays of doubles 600s: arrays of integers

View Source
const (
	OnelinerVersionSupported = 15.4
	OnelinerBuildSupported   = 17321
)

Supported Oneliner Version/Build

View Source
const (
	KiB = 1 << (10 * 1)
	MiB = 1 << (10 * 2)
)

Byte size constants

Variables

ArrayLengths map for GetData function

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.

func GetBus

func GetBus(c *Client, hnd int) (*Bus, error)

GetBus retrieves the bus with the given handle using the provided api client. Data is Scanned into a new bus object and returned if no errors.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a new goolx api client.

func NewClient

func NewClient() *Client

NewClient returns a new goolx Client instance.

func (*Client) BuildNumber

func (c *Client) BuildNumber() (int, error)

BuildNumber parses the build number from the olxapi.dll info function.

func (*Client) CloseDataFile added in v0.0.4

func (c *Client) CloseDataFile() error

CloseDataFile closes the currently loaded *.olr data file.

func (*Client) DeleteEquipment added in v0.0.4

func (c *Client) DeleteEquipment(hnd int) error

DeleteEquipment deletes the equipment with the provided handle.

func (*Client) DoFault added in v0.0.3

func (c *Client) DoFault(hnd int, config *FaultConfig) error

DoFault runs a fault for the given equipment handle with the providedfault configurations.

func (*Client) DoSteppedEvent added in v0.0.4

func (c *Client) DoSteppedEvent(hnd int, cfg *SteppedEventConfig) error

DoSteppedEvent runs a stepped event analysis for the given equipment with the provided config parameters.

func (*Client) EquipmentType

func (c *Client) EquipmentType(hnd int) (int, error)

EquipmentType returns the equipment type code for the equipment with the provided handle

func (*Client) FaultDescription added in v0.0.4

func (c *Client) FaultDescription(index int) string

FaultDescription returns the fault description string for the specified index.

func (*Client) FindBusByName added in v0.0.4

func (c *Client) FindBusByName(name string, kv float64) (int, error)

FindBusByName returns the bus handle for the given bus name and kv, if found

func (*Client) FindBusNo

func (c *Client) FindBusNo(n int) (int, error)

FindBusNo returns the bus with the provided bus number. Or returns 0 and an error if not found.

func (*Client) GetData

func (c *Client) GetData(hnd int, tokens ...int) Data

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) Info

func (c *Client) Info() string

Info calls the OlxAPIVersionInfo function, returning the string

func (*Client) LoadDataFile

func (c *Client) LoadDataFile(name string) error

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

func (c *Client) ReadChangeFile(name string) error

ReadChangeFile reads *.chf file from disk and applies to case

func (*Client) Release

func (c *Client) Release() error

Release releases the api dll. Must be called when done with use of dll.

func (*Client) SaveDataFile

func (c *Client) SaveDataFile(name string) error

SaveDataFile saves *.olr file to disk

func (*Client) Version

func (c *Client) Version() (string, error)

Version parses the version number from the olxapi.dll info function.

type Data

type Data struct {
	// contains filtered or unexported fields
}

Data represents data returned via the GetData method.

func (*Data) Scan

func (d *Data) Scan(dest ...interface{}) error

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, BUSsName, BUSdKVP)

// Scan loads the data into the pointers provided populating the Bus structure in this example.
bus := Bus{}
data.Scan(&bus.Name, &bus.KVNominal)
Output:

type FaultConfig added in v0.0.3

type FaultConfig struct {
	// contains filtered or unexported fields
}

FaultConfig represents configuration parameters required to run the Oneliner DoFault procedure. Options are configured by passing one or more of the FaultOption functions provided into the NewFaultConfig function.

func New1LGFaultConfig added in v0.0.3

func New1LGFaultConfig() *FaultConfig

New1LGFaultConfig is a helper function to return a new 1LG FaultConfig instance. See NewFaultConfig for more specifics.

func New3LGFaultConfig added in v0.0.3

func New3LGFaultConfig() *FaultConfig

New3LGFaultConfig is a helper function to return a new 3LG FaultConfig instance. See NewFaultConfig for more specifics.

func NewFaultConfig added in v0.0.3

func NewFaultConfig(options ...FaultOption) *FaultConfig

NewFaultConfig returns a pointer to a new instance of FaultConfig for use with the Oneliner DoFault procedure. Provide FaultOption functions to modify the underlying parameters.

type FaultOption added in v0.0.4

type FaultOption func(*FaultConfig)

FaultOption represents configuration modification functions to apply to the FaultConfig data.

func FaultClearPrev added in v0.0.3

func FaultClearPrev(e bool) FaultOption

FaultClearPrev sets the clear previous flag. True will clear the previous fault results.

func FaultCloseIn added in v0.0.3

func FaultCloseIn() FaultOption

FaultCloseIn applies a close-in fault.

func FaultCloseInEndOpen added in v0.0.4

func FaultCloseInEndOpen() FaultOption

FaultCloseInEndOpen applies a close-in fault with the end open as determined by the Oneliner algorithm for determining the end of the line.

func FaultCloseInEndOpenOutage added in v0.0.4

func FaultCloseInEndOpenOutage(outageList []int, otgOpt OutageOption) FaultOption

FaultCloseInEndOpenOutage applies a close-in fault with outages and the end open as determined by the Oneliner algorithm for determining the end of the line. An outage list and options are required.

func FaultCloseInOutage added in v0.0.4

func FaultCloseInOutage(outageList []int, otgOpt OutageOption) FaultOption

FaultCloseInOutage applies a close-in fault with outages on the system. An outage list and options are required.

func FaultConn added in v0.0.3

func FaultConn(conn ...FltConn) FaultOption

FaultConn applies the provided fault connections. Overrides the previous fault connections.

func FaultIntermediate added in v0.0.4

func FaultIntermediate(percent float64) FaultOption

FaultIntermediate applies an intermediate fault at the provided percentage.

func FaultIntermediateAuto added in v0.0.4

func FaultIntermediateAuto(step, from, to float64) FaultOption

FaultIntermediateAuto applies an auto sequencing intermediate fault between from and to at the specified step.

func FaultIntermediateEndOpen added in v0.0.4

func FaultIntermediateEndOpen(percent float64) FaultOption

FaultIntermediate applies an intermediate fault with at the provided percentage with the end open.

func FaultIntermediateEndOpenOutage added in v0.0.4

func FaultIntermediateEndOpenOutage(percent float64, outageList []int, otgOpt OutageOption) FaultOption

FaultIntermediateEndOpenOutage applies an intermediate fault with at the provided percentage with the end open and outages. An outage list and options are required.

func FaultIntermediateOutage added in v0.0.4

func FaultIntermediateOutage(percent float64, outageList []int, otgOpt OutageOption) FaultOption

FaultIntermediate applies an intermediate fault with outage at the provided percentage. An outage list and options are required.

func FaultLineEnd added in v0.0.4

func FaultLineEnd() FaultOption

FaultLineEnd applies a line end fault, as determined by Oneliners algorithm for determining line end.

func FaultLineEndOutage added in v0.0.4

func FaultLineEndOutage(outageList []int, otgOpt OutageOption) FaultOption

FaultLineEndOutage applies a line end fault with outages. Line end is determined by Oneliners algorithm for determining line end. An outage list and options are required.

func FaultOptions added in v0.0.5

func FaultOptions(options ...FaultOption) FaultOption

FaultOptions consolidates a list of FaultOptions to a single FaultOption.

func FaultRX added in v0.0.3

func FaultRX(r, x float64) FaultOption

FaultRX sets the fault impedance in Ohms.

func FaultRemoteBus added in v0.0.4

func FaultRemoteBus() FaultOption

FaultRemoteBus applies a remote bus fault.

func FaultRemoteBusOutage added in v0.0.4

func FaultRemoteBusOutage(outageList []int, otgOpt OutageOption) FaultOption

FaultRemoteBusOutage applies a remote bus fault with outages. An outage list and options are required.

type FltConn added in v0.0.5

type FltConn int

FltConn represents a fault connection for use with the DoFault procedure. The codes are applied to FaultConfig and SteppedEventConfig as specified in ASPEN Oneliner documentation.

const (
	// Three phase fault.
	ABC FltConn = iota
	// Phase-Phase-Ground faults.
	BCG
	CAG
	ABG

	// Phase-Ground faults.
	AG
	BG
	CG

	// Phase-Phase faults.
	BC
	CA
	AB
)

Fault connection codes.

type HandleIterator

type HandleIterator interface {
	Next() bool
	Hnd() int
}

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.

type OutageOption added in v0.0.3

type OutageOption int

OutageOption represents a the method outages are applied with use in the DoFault procedure.

const (
	OutageOptionOnePer OutageOption = iota // One at a time
	OutageOptionTwoPer                     // Two at a time
	OutageOptionAll                        // All at once
	OutageOptionBF                         // Breaker failure
)

type SteppedEventConfig added in v0.0.4

type SteppedEventConfig struct {
	// contains filtered or unexported fields
}

SteppedEventConfig represents the configuration options for running stepped event analysis, for use with DoSteppedEvent function.

func NewSteppedEvent added in v0.0.4

func NewSteppedEvent(options ...SteppedEventOption) *SteppedEventConfig

NewSteppedEvent returns a new SteppedEventConfig instance with the applied options. The default number of tiers is 3, this can be changed using the SteppedEventTiers option.

type SteppedEventOption added in v0.0.4

type SteppedEventOption func(cfg *SteppedEventConfig)

SteppedEventOption represents a function to modify the SteppedEventConfig options.

func SteppedEventAll added in v0.0.4

func SteppedEventAll() SteppedEventOption

SteppedEventAll option enabled checking all relay types during stepped event simulation.

func SteppedEventCloseIn added in v0.0.4

func SteppedEventCloseIn() SteppedEventOption

SteppedEventCloseIn applies a close-in fault by setting the intermediate to 0.

func SteppedEventConn added in v0.0.4

func SteppedEventConn(conn FltConn) SteppedEventOption

SteppedEventConn sets the fault connection code.

func SteppedEventDSGnd added in v0.0.4

func SteppedEventDSGnd() SteppedEventOption

SteppedEventDSGnd option enables ground distance relays during stepped event simulation.

func SteppedEventDSPh added in v0.0.4

func SteppedEventDSPh() SteppedEventOption

SteppedEventDSPh option enables phase distance relays during stepped event simulation.

func SteppedEventDiffRelay added in v0.0.4

func SteppedEventDiffRelay() SteppedEventOption

SteppedEventDiffRelay option enables differential relays during stepped event simulation.

func SteppedEventIntermediate added in v0.0.4

func SteppedEventIntermediate(percent float64) SteppedEventOption

SteppedEventIntermediate applies an intermediate fault at the given percentage.

func SteppedEventLogicScheme added in v0.0.4

func SteppedEventLogicScheme() SteppedEventOption

SteppedEventLogicScheme option enables protection schemes during stepped event simulation.

func SteppedEventLogicVoltRelay added in v0.0.4

func SteppedEventLogicVoltRelay() SteppedEventOption

SteppedEventLogicVoltRelay option enables voltage relays during stepped event simulation.

func SteppedEventOCGnd added in v0.0.4

func SteppedEventOCGnd() SteppedEventOption

SteppedEventOCGnd option enables ground overcurrent relays during stepped event simulation.

func SteppedEventOCPh added in v0.0.4

func SteppedEventOCPh() SteppedEventOption

SteppedEventOCPh option enables phase overcurrent relays during stepped event simulation.

func SteppedEventOptions added in v0.0.4

func SteppedEventOptions(options ...SteppedEventOption) SteppedEventOption

SteppedEventOptions consolidates a list of SteppedEventOption's into a single SteppedEventOption.

func SteppedEventRX added in v0.0.4

func SteppedEventRX(r, x float64) SteppedEventOption

SteppedEventRX sets the stepped event fault impedance.

func SteppedEventTiers added in v0.0.4

func SteppedEventTiers(n int) SteppedEventOption

SteppedEventTiers option sets the number of tiers from the initiating equipment to be evaluated.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL