helper

package
v0.0.0-...-d72ca28 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugMode bool
	DownTypes = []toolkit.M{
		{"down": "aebok", "label": "AEBok"},
		{"down": "externalstop", "label": "External Stop"},
		{"down": "griddown", "label": "Grid Down"},
		{"down": "internalgrid", "label": "Internal Grid"},
		{"down": "machinedown", "label": "Machine Down"},
		{"down": "unknown", "label": "Unknown"},
		{"down": "weatherstop", "label": "Weather Stop"},
	}
	WC *knot.WebContext
)

Functions

func CalcAvailabilityAndPLF

func CalcAvailabilityAndPLF(in toolkit.M) (res toolkit.M)

============================= Revision Of GetAvailAndPLF @asp:20170725 =============================

	Input : noofturbine, oktime, energy, counttimestamp, totalhour, totalcapacity,
			machinedowntime, griddowntime, otherdowntime

	counttimestamp -> count total data that available (*every data in 10 mins conv)
	oktime, totalhour -> in hour
	machinedowntime, griddowntime, otherdowntime -> in hour
	totalcapacity -> in MWatt
 energy -> in MWh

	Output : totalavailability, plf, machineavailability, gridavailability, dataavailability

=============================

func CheckEnergyComparison

func CheckEnergyComparison(newdata toolkit.Ms, key1 string, key2 string) toolkit.Ms

func CreateResult

func CreateResult(success bool, data interface{}, message string) map[string]interface{}

func CreateResultWithoutSession

func CreateResultWithoutSession(success bool, data interface{}, message string) map[string]interface{}

func CreateResultX

func CreateResultX(success bool, data interface{}, message string, r *knot.WebContext) map[string]interface{}

func EnergyMeasurement

func EnergyMeasurement(data interface{}, key1 string, key2 string) toolkit.Ms

func GetAlarmTagsList

func GetAlarmTagsList() (result toolkit.M, e error)

func GetAvailAndPLF

func GetAvailAndPLF(totalTurbine float64, okTime float64, energy float64, machineDownTime float64, gridDownTime float64, countTimeStamp float64, hourValue float64, totalMinutes float64, plfDivider float64) (machineAvail float64, gridAvail float64, dataAvail float64, totalAvail float64, plf float64)

totalTurbine in float64 okTime sum ok time energy should be div by 1000 machineDownTime, gridDownTime already in hour value minutes should be div by 60

func GetDataDateAvailable

func GetDataDateAvailable(collectionName string, timestampColumn string, where *dbox.Filter) (min time.Time, max time.Time, err error)

func GetDayInYear

func GetDayInYear(year int) toolkit.M

func GetDurationInMonth

func GetDurationInMonth(tStart time.Time, tEnd time.Time) (int, []interface{}, toolkit.M)

func GetHFDFolder

func GetHFDFolder() string

func GetHourValue

func GetHourValue(tStart time.Time, tEnd time.Time, minDate time.Time, maxDate time.Time) (hourValue float64)

func GetProjectList

func GetProjectList() (result []md.ProjectOut, e error)

func GetProjectTurbineList

func GetProjectTurbineList(projects []interface{}) (result map[string]toolkit.M, sortedKey []string, e error)

func GetStartEndDate

func GetStartEndDate(r *knot.WebContext, period string, tStart, tEnd time.Time) (startDate, endDate time.Time, err error)

add by RS, 2016-10-26 to assign start date & end date based on period type

func GetStateList

func GetStateList(projlist []md.ProjectOut) (result []string, e error)

func GetTemperatureList

func GetTemperatureList() (result toolkit.M, e error)

func GetTurbineList

func GetTurbineList(projects []interface{}) (result []md.TurbineOut, e error)

func GetTurbineNameList

func GetTurbineNameList(project string) (turbineName map[string]string, err error)

func HandleError

func HandleError(err error, optionalArgs ...interface{}) bool

func HelperSetDb

func HelperSetDb(conn dbox.IConnection)

func ImageUploadHandler

func ImageUploadHandler(r *knot.WebContext, filename, dstpath string) (error, string)

func UploadFileHandler

func UploadFileHandler(r *knot.WebContext, tempfile, dstpath, filename string) (error, string, string, string)

func UploadHandler

func UploadHandler(r *knot.WebContext, filename, dstpath string) (error, string)

Types

type Filter

type Filter struct {
	Field   string      `json:"field"`
	Op      string      `json:"operator"`
	Value   interface{} `json:"value"`
	Filters []Filter    `json:"filters"`
}

type FilterJS

type FilterJS struct {
	Filters []*Filter `json:"filters"`
	Logic   string
}

type Payloads

type Payloads struct {
	Project string
	Skip    int
	Take    int
	Sort    []Sorting
	Filter  *FilterJS `json:"filter"`
	Misc    toolkit.M `json:"misc"`
	Custom  toolkit.M `json:"custom"`
}

func (*Payloads) ParseFilter

func (s *Payloads) ParseFilter() (filters []*dbox.Filter, err error)

type PayloadsDB

type PayloadsDB struct {
	Project   string
	Turbine   []interface{}
	DateStart time.Time
	DateEnd   time.Time
	Skip      int
	Take      int
	Sort      []Sorting
	Filter    *FilterJS `json:"filter"`
	Misc      toolkit.M `json:"misc"`
	Custom    toolkit.M `json:"custom"`
}

type Sorting

type Sorting struct {
	Field string
	Dir   string
}

Jump to

Keyboard shortcuts

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