goolx

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 9 Imported by: 3

README

Go Reference Go Report Card

Overview

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

For a more practical usage example, please refer to the demonstration project: OlxCLI

Example: Bus faults

The below example runs a 3LG and 1LG fault on every bus in the provided model, outputting the total fault current calculated.

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

	// Load a oneliner case into memory.
	if err := api.LoadDataFile(`local\SAMPLE09.OLR`); err != nil {
		log.Fatal(err)
	}

	// Define a 3LG and 1LG bus fault config for DoFault.
	fltCfg := goolx.NewFaultConfig(
		goolx.FaultCloseIn(),                 // Bus Handle + Close In = bus fault
		goolx.FaultConn(goolx.ABC, goolx.AG), // 3LG and 1LG (A-gnd)
		goolx.FaultClearPrev(true),           // Clear previous results
	)

	// Loop through all buses in case using NextEquipment iterator.
	for bi := api.NextEquipment(goolx.TCBus); bi.Next(); {
		hnd := bi.Hnd()

		// Run pre-defined fault config for bus.
		if err := api.DoFault(hnd, fltCfg); err != nil {
			log.Println(err)
			continue
		}

		// Define tabwriter for clean spacing of output (Optional).
		tw := tabwriter.NewWriter(os.Stdout, 0, 4, 2, ' ', 0)
		defer tw.Flush()

		// Loop through fault results, using iterator type wrapping Pickfault method.
		for fi := api.NextFault(1); fi.Next(); {
			fltIndex := fi.Index()
			fd := api.FaultDescription(fltIndex)

			// Get bus fault duty in phase quantities. HNDSC is the handle for total short circuit current.
			ia, ib, ic, err := api.GetSCCurrentPhase(goolx.HNDSC)
			if err != nil {
				log.Fatal(err)
			}

			// Print result to stdout using tabwriter.
			fmt.Fprintf(tw, "%q\tIa:%v\tIb:%v\tIc:%v\t\n", fd, ia, ib, ic)
		}
	}
}

Output:

go run .\example\readme.go
"1. Bus Fault on:           4 TENNESSEE        132. kV 3LG"         Ia:4342.50∠-78.8°  Ib:4342.50∠161.2°  Ic:4342.50∠41.2°  
"2. Bus Fault on:           4 TENNESSEE        132. kV 1LG Type=A"  Ia:3690.63∠-79.4°  Ib:0.00∠0.0°       Ic:0.00∠0.0°
"1. Bus Fault on:          11 ROANOKE          13.8 kV 3LG"         Ia:50997.07∠-120.3°  Ib:50997.07∠119.7°  Ic:50997.07∠-0.3°
"2. Bus Fault on:          11 ROANOKE          13.8 kV 1LG Type=A"  Ia:47521.65∠-120.4°  Ib:0.00∠-123.2°     Ic:0.00∠-117.5°
"1. Bus Fault on:           8 REUSENS          132. kV 3LG"         Ia:5122.25∠-86.0°  Ib:5122.25∠154.0°  Ic:5122.25∠34.0°
"2. Bus Fault on:           8 REUSENS          132. kV 1LG Type=A"  Ia:5106.25∠-86.2°  Ib:0.00∠0.0°       Ic:0.00∠0.0°
"1. Bus Fault on:           7 OHIO             132. kV 3LG"         Ia:4286.88∠-80.9°  Ib:4286.88∠159.1°  Ic:4286.88∠39.1°
"2. Bus Fault on:           7 OHIO             132. kV 1LG Type=A"  Ia:4297.44∠-80.9°  Ib:0.00∠-32.8°     Ic:0.00∠-153.2°
"1. Bus Fault on:          10 NEW HAMPSHR      33.  kV 3LG"         Ia:8599.81∠-90.6°  Ib:8599.81∠149.4°  Ic:8599.81∠29.4°
"2. Bus Fault on:          10 NEW HAMPSHR      33.  kV 1LG Type=A"  Ia:8864.15∠-90.6°  Ib:0.00∠-29.7°     Ic:0.00∠-153.9°
"1. Bus Fault on:           6 NEVADA           132. kV 3LG"         Ia:5791.65∠-85.7°  Ib:5791.65∠154.3°  Ic:5791.65∠34.3°
"2. Bus Fault on:           6 NEVADA           132. kV 1LG Type=A"  Ia:5797.66∠-85.9°  Ib:0.00∠-32.4°     Ic:0.00∠-152.7°
"1. Bus Fault on:           5 FIELDALE         132. kV 3LG"         Ia:6657.30∠-86.8°  Ib:6657.30∠153.2°  Ic:6657.30∠33.2°
"2. Bus Fault on:           5 FIELDALE         132. kV 1LG Type=A"  Ia:6670.71∠-86.7°  Ib:0.00∠144.9°     Ic:0.00∠34.2°
"1. Bus Fault on:           2 CLAYTOR          132. kV 3LG"         Ia:5395.45∠-85.0°  Ib:5395.45∠155.0°  Ic:5395.45∠35.0°
"2. Bus Fault on:           2 CLAYTOR          132. kV 1LG Type=A"  Ia:5333.50∠-85.1°  Ib:0.00∠0.0°       Ic:0.00∠0.0°
"1. Bus Fault on:          28 ARIZONA          132. kV 3LG"         Ia:3659.65∠-82.4°  Ib:3659.65∠157.6°  Ic:3659.65∠37.6°
"2. Bus Fault on:          28 ARIZONA          132. kV 1LG Type=A"  Ia:2890.36∠-81.2°  Ib:0.00∠-42.4°     Ic:0.00∠-143.8°

Disclaimer

This project is not endorsed or affiliated with ASPEN Inc.

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

OlxAPI equipment type codes are used to accessing equipment data from Oneliner.

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

Used for data parameter access in olxapi. Returned data type depends on token provided.

Type categories:

  • 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 BoundaryConfig added in v0.1.0

type BoundaryConfig [3]float64

BoundaryConfig represents the configuration parameters for the BoundaryEquivalent method.

func NewBoundaryConfig added in v0.1.0

func NewBoundaryConfig(options ...BoundaryOption) BoundaryConfig

NewBoundaryConfig creates a new BoundaryConfig with the provided options functions applied.

type BoundaryOption added in v0.1.0

type BoundaryOption func(*BoundaryConfig)

BoundaryOption represents an option modifying function to be applied to a BoundaryConfig type.

func BoundaryEliminationThreshold added in v0.1.0

func BoundaryEliminationThreshold(pu float64) BoundaryOption

BoundaryEliminationThreshold sets the per unit elimination threshold. Refer to Oneliner documentation for more details.

func BoundaryKeepAnnotations added in v0.1.0

func BoundaryKeepAnnotations() BoundaryOption

BoundaryKeepAnnotations enables the keep annotations configuration option.

func BoundaryKeepEquipment added in v0.1.0

func BoundaryKeepEquipment() BoundaryOption

BoundaryKeepEquipment enables the keep bus equipment configuration option

type Bus

type Bus struct {
	Hnd       int
	Name      string
	Area      int
	Zone      int
	Tap       int
	KVNominal float64
	KV        float64
	Angle     float64
	Location  string
	Comment   string
}

Bus represents a bus data object.

func (*Bus) String added in v0.1.3

func (b *Bus) String() string

type Client

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

Client represents a new goolx api client. OlxAPI calls cannot be called in parallel, the underlying dll procedure calls share memory and do not support cuncurency.

func NewClient

func NewClient() *Client

NewClient returns a new goolx Client instance.

func (*Client) BoundaryEquivalent added in v0.1.0

func (c *Client) BoundaryEquivalent(file string, busList []int, cfg BoundaryConfig) error

BoundaryEquivalent created an equivalent case with the provided bus list and config.

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) ComputeRelayTime added in v0.1.0

func (c *Client) ComputeRelayTime(hnd int, p ComputeRelayTimeParams) (float64, string, error)

ComputeRelayTime computes operating time for a fuse, recloser, an overcurrent relay (phase or ground), or a distance relay (phase or ground) at given currents and voltages.

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. PickFault or NextFault must be called prior to accessing results data.

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) Find1LPF added in v0.1.0

func (c *Client) Find1LPF(id string) (int, error)

Find1LPF returns the handle for the object with the provided string id.

func (*Client) FindBranch added in v0.1.3

func (c *Client) FindBranch(fName string, fKV float64, tName string, tKV float64, ckt string) (int, error)

FindLine searches for a branch with the given branch data, returns the branch handle. Returns error if a branch cannot be found.

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) FindLine added in v0.1.3

func (c *Client) FindLine(fName string, fKV float64, tName string, tKV float64, ckt string) (*Line, error)

FindLine searches for a line with the given branch data. From and To can be swapped and should return the same Line object. Returns error if a line cannot be found, or if the branch specified points to a non-line object.

func (*Client) FullBranchName added in v0.1.0

func (c *Client) FullBranchName(hnd int) string

FullBranchName returns the full branch name for the provided handle, returns empty string on error.

func (*Client) FullBusName added in v0.1.0

func (c *Client) FullBusName(hnd int) string

FullBusName returns the full bus name for the provided handle, returns empty string on error.

func (*Client) FullRelayName added in v0.1.0

func (c *Client) FullRelayName(hnd int) string

FullRelayName returns the full relay name for the provided handle, returns empty string on error.

func (*Client) GetAreaName added in v0.0.10

func (c *Client) GetAreaName(area int) (string, error)

GetAreaName returns the area name for the provided area id.

func (*Client) GetBus added in v0.1.3

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

GetBus loads the bus data at the provided handle into a new bus object. Returns error if the handle provided does not point to an equipment type TCBus.

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) GetGUID added in v0.0.10

func (c *Client) GetGUID(hnd int) (string, error)

GetGUID returns the GUID for the provided object.

func (*Client) GetJournal added in v0.1.0

func (c *Client) GetJournal(hnd int) Journal

GetJournal returns the object journal record for the provided handle.

func (*Client) GetLine added in v0.1.3

func (c *Client) GetLine(hnd int) (*Line, error)

GetLine loads the line data at the provided handle into a new line object. Returns error if the handle provided does not point to an equipment type TCLine.

func (*Client) GetOlrFilename added in v0.0.10

func (c *Client) GetOlrFilename() string

Returns the currently loaded olr filename.

func (*Client) GetPSCVoltageKV added in v0.1.0

func (c *Client) GetPSCVoltageKV(hnd int) ([]Phasor, error)

GetPSCVoltageKV returns the pre-fault voltage for the provided bus or equipment in kV. See Oneliner documentation for returned array structure details.

func (*Client) GetPSCVoltagePU added in v0.1.0

func (c *Client) GetPSCVoltagePU(hnd int) ([]Phasor, error)

GetPSCVoltagePU returns the pre-fault voltage for the provided bus or equipment in PU. See Oneliner documentation for returned array structure details.

func (*Client) GetRelayTime added in v0.0.11

func (c *Client) GetRelayTime(rlyHnd int, mult float64, tripOnly bool) (float64, string, error)

GetRelayTime returns the relay operation time and operation text for the specified relay. TripOnly will only consider tripping relays if true. The mult factor multiplies the relay current by the factor provided, this should normally be set to 1.0, an error will be returned if mult == 0 which will just result in NOP results.

func (*Client) GetSCCurrentPhase added in v0.0.9

func (c *Client) GetSCCurrentPhase(hnd int) (Ia, Ib, Ic Phasor, err error)

GetSCCurrentPhase gets the short circuit phase current for the equipment with the provided handle. Returns Ia, Ib, Ic Phasor types. PickFault must be called first.

func (*Client) GetSCCurrentSeq added in v0.0.9

func (c *Client) GetSCCurrentSeq(hnd int) (I0, I1, I2 Phasor, err error)

GetSCCurrentSeq gets the short circuit sequence current for the equipment with the provided handle. Returns I0, I1, I2 Phasor types. PickFault must be called first.

func (*Client) GetSCVoltagePhase added in v0.0.8

func (c *Client) GetSCVoltagePhase(hnd int) (Va, Vb, Vc Phasor, err error)

GetSCVoltagePhase gets the short circuit phase voltage for the equipment with the provided handle. Returns Va, Vb, Vc Phasor types. PickFault must be called first.

func (*Client) GetSCVoltageSeq added in v0.0.8

func (c *Client) GetSCVoltageSeq(hnd int) (V0, V1, V2 Phasor, err error)

GetSCVoltageSeq gets the short circuit sequence voltagse for the equipment with the provided handle. Returns V0, V1, V2 Phasor types.

func (*Client) GetSteppedEvent added in v0.0.9

func (c *Client) GetSteppedEvent(step int) (SteppedEvent, error)

GetSteppedEvent gets the stepped event data for the provided step. Returns an error if step index is out of range.

func (*Client) GetUDF added in v0.1.0

func (c *Client) GetUDF(hnd int, field string) (string, error)

GetUDF returns the user defined field at the provided equipment with the specified field name.

func (*Client) GetUDFByIndex added in v0.1.0

func (c *Client) GetUDFByIndex(hnd, i int) (field, value string, err error)

GetUDFByIndex returns the user defined field at the provided equipment with the specified field index.

func (*Client) GetZoneName added in v0.0.10

func (c *Client) GetZoneName(zone int) (string, error)

GetZoneName returns the zone name for the provided zone id.

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. Opens read/write.

func (*Client) LoadDataFileReadOnly added in v0.1.3

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

LoadDataFile loads *.olr file from disk. Opens read only.

func (*Client) MakeOutageList added in v0.0.11

func (c *Client) MakeOutageList(hnd, tiers int, otgType OtgTypeMask) ([]int, error)

MakeOutageList creates an outage list for use in the DoFault fault simulation analysis. Select the outaged branch types by bitwise or of OtgTypeMask's.

func (*Client) MemoAppend added in v0.0.9

func (c *Client) MemoAppend(hnd int, s string) error

MemoAppend appends a new line followed by s to the object memo field.

func (*Client) MemoContains added in v0.0.9

func (c *Client) MemoContains(hnd int, substr string) bool

MemoContains reports whether substr is within the objects memo field.

func (*Client) MemoGet added in v0.0.9

func (c *Client) MemoGet(hnd int) (string, error)

MemoGet returns the object memo field string.

func (*Client) MemoReplaceAll added in v0.0.9

func (c *Client) MemoReplaceAll(hnd int, old, new string) error

MemoReplaceAll replaces all non-overlapping instances of old replaced by new in the object memo field.

func (*Client) MemoSet added in v0.0.9

func (c *Client) MemoSet(hnd int, memo string) error

MemoSet sets the object memo field, overwrites existing data.

func (*Client) NextBusEquipment added in v0.0.7

func (c *Client) NextBusEquipment(busHnd, eqType int) HandleIterator

NextBusEquipment returns an EquipmentIterator type. The EquipmentIterator will loop through all equipment handles at the provided bus in the case until it reaches the end. This is done using the Next() and Hnd() methods. See NextEquipment for more details.

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) NextFault added in v0.0.9

func (c *Client) NextFault(tiers int) FaultIterator

NextFault returns a fault index iterator for looping through fault results. Will perform a PickFault function call for each fault simulation result.

func (*Client) NextLogicScheme added in v0.1.0

func (c *Client) NextLogicScheme(rlyGroupHnd int) HandleIterator

NextLogicScheme returns the next Logic Scheme handle available in the provided relay group. Utilize the Next() method to loop through the available handles. The Hnd() method returns the selected handle.

func (*Client) NextRelay added in v0.0.7

func (c *Client) NextRelay(rlyGroupHnd int) HandleIterator

NextRelay returns an HandleIterator type. The HandleIterator will loop through all relay handles in the provided relay group 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) NextSteppedEvent added in v0.0.9

func (c *Client) NextSteppedEvent() SteppedEventIterator

func (*Client) PickFault added in v0.0.8

func (c *Client) PickFault(indx, tiers int) error

PickFault must be called before accessing short circuit simulation data. The given index and number of tiers to be calculated are provided. See NextFault for an iterator which automatically switches from SFFirst to SFNext after the first fault until the last.

The index codes are:
	SFLast     = -1
	SFNext     = -2
	SFFirst    = 1
	SFPrevious = -4

func (*Client) PostData added in v0.0.11

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

PostData will post data for the provided equipment handle that was previously set using the SetData method.

func (*Client) Print1LPF added in v0.1.0

func (c *Client) Print1LPF(hnd int) (string, error)

Print1LPF returns the object string id.

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) Run1LPFCommand added in v0.1.0

func (c *Client) Run1LPFCommand(s string) error

Run1LPFCommand runs a Oneliner command using xml input string.

func (*Client) SaveDataFile

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

SaveDataFile saves *.olr file to disk

func (*Client) SetData added in v0.0.11

func (c *Client) SetData(hnd, token int, data interface{}) error

SetData sets the provided data to the specified equipment parameter as determined by the token value. Only string, float64, and int data is currently supported. PostData must be called after SetData. TODO: Figure out how to set array data fields.

func (*Client) SetUDF added in v0.1.0

func (c *Client) SetUDF(hnd int, field, value string) error

SetUDF sets the user defined field at the provided equipment with the specified field name and value. SetUDF does not create a new user defined field if it does not exist. User defined fields must be created in Oneliner GUI.

func (*Client) TagReplace added in v0.0.9

func (c *Client) TagReplace(hnd int, oldTag, newTag string) error

TagReplace replaces all occurences of the old tag with the new tag provided.

func (*Client) TagsAppend added in v0.0.9

func (c *Client) TagsAppend(hnd int, newTags ...string) error

TagsAppend appends the provided tags to the object tag string. Does not check for duplicate tags

func (*Client) TagsGet added in v0.0.9

func (c *Client) TagsGet(hnd int) (tags []string, err error)

TagsGet returns a slice of tag strings for the equipment with the provided handle.

func (*Client) TagsSet added in v0.0.9

func (c *Client) TagsSet(hnd int, tags ...string) error

TagsSet replaces the object tag with the provided tags. Will override existing tags, use GetObjTags to retrieve existing tags and append to if the wanting to keep existing tags.

func (*Client) Version

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

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

type ComputeRelayTimeParams added in v0.1.0

type ComputeRelayTimeParams struct {
	// Relay phase current.
	Ia, Ib, Ic Phasor
	// Relay neutral winding currents, if applicable, winding P and S.
	In1, In2 Phasor
	// Relay phase voltages.
	Va, Vb, Vc Phasor
	// Relau pre-fault voltage.
	VPre Phasor
}

ComputeRelayTimeParams represents input parameters for use with the ComputeRelayTime method.

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
// Create API client.
api := NewClient()

// Load data file, and find bus handle.
api.LoadDataFile(testCase)
busHnd, err := api.FindBusByName("TENNESSEE", 132)
if err != nil {
	return
}

// Get bus name and kv data.
data := api.GetData(busHnd, BUSsName, BUSdKVnominal)

// Scan loads the data into the pointers provided. Types must match the tokens provided.
var name string
var kV float64
data.Scan(&name, &kV)

fmt.Printf("Name: %s\n", name)
fmt.Printf("kV: %0.2f\n", kV)
Output:

Name: TENNESSEE
kV: 132.00

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 FaultIterator added in v0.0.9

type FaultIterator interface {
	Next() bool
	Index() int
}

FaultIterator is a fault result iterator for iterating through the available fault results, utilizing the PickFault function.

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 Journal added in v0.1.0

type Journal struct {
	CreatedAt  string
	CreatedBy  string
	ModifiedAt string
	ModifiedBy string
}

Journal represents a Oneliner object journal record. Obtained from GetJournal method.

type Line added in v0.1.3

type Line struct {
	Hnd          int
	Bus1         *Bus
	Bus2         *Bus
	CktID        string
	Name         string
	InService    int
	RelayGrp1Hnd int
	RelayGrp2Hnd int
	MuPairHnd    int
	Length       float64
	LengthUnit   string

	// Line parameters.
	R, X     float64
	R0, X0   float64
	B1, G1   float64
	B10, G10 float64
	B2, G2   float64
	B20, G20 float64
}

Line represents a line data object.

func (*Line) String added in v0.1.3

func (l *Line) String() string

type OtgTypeMask added in v0.0.11

type OtgTypeMask uint8

OtgTypeMask represents a bit mask for use with the MakeOutageList to provide the desired outage type code, bitwise or the desired codes.

const (
	OtgLine OtgTypeMask = 1 << iota
	OtgXfmr
	OtgPhaseShift
	OtgXfmr3
	OtgSwitch
)

Outage type bit masks.

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 Phasor added in v0.0.8

type Phasor complex128

Phasor represents a phasor value for common power system calculations.

func NewPhasor added in v0.0.8

func NewPhasor(mag, ang float64) Phasor

NewPhasor returns a new phasor instance.

func PhaseToSeq added in v0.0.8

func PhaseToSeq(a, b, c Phasor) (seq0, seq1, seq2 Phasor)

PhaseToSeq converts from phase values to sequential components. Three phase only.

func SeqToPhase added in v0.0.8

func SeqToPhase(seq0, seq1, seq2 Phasor) (a, b, c Phasor)

SeqToPhase converts from sequential compoents to phase values. Three phase only.

func (Phasor) Ang added in v0.0.8

func (p Phasor) Ang() float64

Ang returns the Phasor angle in degrees.

func (Phasor) Mag added in v0.0.8

func (p Phasor) Mag() float64

Mag returns the Phasor absolute magnitude.

func (Phasor) Rect added in v0.0.8

func (p Phasor) Rect() complex128

Rect returns the complex128 representation.

func (Phasor) String added in v0.0.8

func (p Phasor) String() string

String implements the stringer interface for the Phasor type.

type SteppedEvent added in v0.0.9

type SteppedEvent struct {
	Step             int
	UserEvent        bool
	Time             float64
	Current          float64
	EventDescription string
	FaultDescription string
}

SteppedEvent represents the stepped event result data returned by GetSteppedEvent function.

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 SteppedEventIterator added in v0.1.0

type SteppedEventIterator interface {
	Next() bool
	Data() SteppedEvent
}

SteppedEventIterator is a stepped event result iterator for iterating through the available fault results, utilizing the GetSteppedEvent function.

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
Package model provides data structures and helper functions for loading common Oneliner equipment models.
Package model provides data structures and helper functions for loading common Oneliner equipment models.

Jump to

Keyboard shortcuts

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