system

package
v0.0.0-...-5935107 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OFF_FREQ  = 0.0
	ACC_BASIS = 50.0
)
View Source
const (
	BURNER_TRANSITION        = 7
	H_PUMP_FREQ_TRANSITION   = 5
	W_PUMP_TOGGLE_TRANSITION = 3
	H_PUMP_TOGGLE_TRANSITION = 16
	TRIANGLE_TRANSITION      = 32
	SYSTEM_STATE_TABLE       = "system_states"
)
View Source
const (
	ACTION_TABLE = "actions"
)
View Source
const (
	PERCEPT_TABLE = "percepts"
)

Variables

View Source
var (
	//window []*Percept			// sliding window to store the percept history
	Percept_request_chan chan chan *Percept // channel through which Percept pointer channels can be passed
	Query_request_chan   chan *dataRequest  // channel through which dataRequest could be passed
	Percept_update_chan  chan Percept
	//Configuration_update_chan chan Target @TODO
	Configuration_request_chan chan *configRequest
)

Functions

func Configuration_Oracle

func Configuration_Oracle(path string, processChan chan bool, default_target int)

func MakeConfigRequest

func MakeConfigRequest(endpoint chan int, percept *Percept)

func MakeDataRequest

func MakeDataRequest(ep chan []DataResponse, req []DataQuery, info []struct {
	Sec    int
	Weight float64
}) *dataRequest

Interface function to generate a dataRequest object. @param ep channel for the response to be send through @param req array of DataQuery objects that need to be calculated @param info array of Calculation_info objects where calculation parameters are specified

func Oracle_loop

func Oracle_loop(generator PerceptGenerator, windowLength int)

The oracle maintains a sliding window and in order to perform data queries on the system's history. The main oracle loop sets up the interface channels for interactions with this go routine and starts an infinity loop where it (1.) generates a Percept and updates the sliding window. After the window is updated the interface channels are checked in order to perform calculations and response to requests (from e.g. agents). @param generator a PerceptGenerator function that generates a Percept object @param windowLength the length of the sliding window

func Percept_Oracle

func Percept_Oracle(generator func(chan *Percept), windowLength int, processChan chan bool)

A service routine that establishes a percept sliding window and processes incoming requests from clients (either percept request by main routine or query requests from learners). The service listens at two distinct channels for either type of request. In order to establish the sliding window the service starts a generator and updates the sliding window each time the generator hands over a new Percept.

Types

type Action

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

func NewAction

func NewAction(wFreq, hFreq float64, h, w, b, t bool) (a *Action)

func (*Action) CreateRelation

func (a *Action) CreateRelation()

func (*Action) Delete

func (a *Action) Delete()

func (*Action) GetBurnerState

func (a *Action) GetBurnerState() bool

func (*Action) GetHPumpState

func (a *Action) GetHPumpState() bool

func (*Action) GetHPumpThrottle

func (a *Action) GetHPumpThrottle() float64

func (*Action) GetRelationName

func (a *Action) GetRelationName() string

Implementation of relation interface

func (*Action) GetTriangleState

func (a *Action) GetTriangleState() bool

func (*Action) GetWPumpState

func (a *Action) GetWPumpState() bool

func (*Action) GetWPumpThrottle

func (a *Action) GetWPumpThrottle() float64

func (*Action) Insert

func (a *Action) Insert(val ...interface{})

func (*Action) SetBurnerState

func (a *Action) SetBurnerState(v bool)

func (*Action) SetHPumpState

func (a *Action) SetHPumpState(v bool)

func (*Action) SetHPumpThrottle

func (a *Action) SetHPumpThrottle(v float64)

func (*Action) SetTriangleState

func (a *Action) SetTriangleState(v bool)

func (*Action) SetWPumpState

func (a *Action) SetWPumpState(v bool)

func (*Action) SetWPumpThrottle

func (a *Action) SetWPumpThrottle(v float64)

func (*Action) String

func (self *Action) String() string

func (*Action) Update

func (a *Action) Update(val ...interface{})

type ActorState

type ActorState struct {
	time.Time
	// contains filtered or unexported fields
}

implements SystemState interface, logger.Logable interface

func (*ActorState) CompareTo

func (s *ActorState) CompareTo(sPrime State) (means int)

func (*ActorState) CreateRelation

func (s *ActorState) CreateRelation()

func (*ActorState) Delete

func (s *ActorState) Delete(val ...interface{})

func (*ActorState) Equals

func (s *ActorState) Equals(sPrime State) bool

func (*ActorState) GetBurnerState

func (s *ActorState) GetBurnerState() bool

implementation of SystemState interface

func (*ActorState) GetHFrequency

func (s *ActorState) GetHFrequency() int

func (*ActorState) GetHState

func (s *ActorState) GetHState() bool

func (*ActorState) GetRelationName

func (s *ActorState) GetRelationName() string

implementation of Logable interface

func (*ActorState) GetTriangleState

func (s *ActorState) GetTriangleState() bool

func (*ActorState) GetWFrequency

func (s *ActorState) GetWFrequency() int

func (*ActorState) GetWState

func (s *ActorState) GetWState() bool

func (*ActorState) Insert

func (s *ActorState) Insert(val ...interface{})

func (*ActorState) IsTerminal

func (s *ActorState) IsTerminal() bool

func (*ActorState) Reward

func (s *ActorState) Reward(a *Action, sPrime State) (reward Reward)

func (*ActorState) SetTimeStamp

func (s *ActorState) SetTimeStamp(t time.Time)

func (*ActorState) String

func (s *ActorState) String() string

ActorState implements the Stringer interface.

func (*ActorState) Successor

func (s *ActorState) Successor(a *Action) (sPrime State)

func (*ActorState) Update

func (s *ActorState) Update(val ...interface{})

type Calculation_info

type Calculation_info struct {
	Sec    int
	Weight float64
}

type ConfigRequester

type ConfigRequester func(chan int, *Percept)

type DataQuery

type DataQuery int
const (
	BOILER_DELTA DataQuery = iota
	REVERSE_DELTA
	WATER_BUFFER_DELTA
)

type DataResponse

type DataResponse struct {
	Id              DataQuery
	Result          float64
	Considered_data int
	TimeStamp       int64
}

type Percept

type Percept struct {
	//logger.Relation
	CurrentTime                                                                                                                      time.Time
	OutsideTemp, BoilerMidTemp, BoilerTopTemp, KettleTemp, HForeRunTemp, HReverseRunTemp, WForeRunTemp, WReverseRunTemp, WIntakeTemp *w1.Temperature
	Valid                                                                                                                            bool
}

func (*Percept) CreateRelation

func (p *Percept) CreateRelation()

func (*Percept) Delete

func (p *Percept) Delete(val ...interface{})

func (*Percept) GetBoilerDelta

func (p *Percept) GetBoilerDelta(successor *Percept) (tempDelta int, recordingDuration time.Duration)

func (*Percept) GetKettleDelta

func (p *Percept) GetKettleDelta(successor *Percept) (tempDelta int, recordingDuration time.Duration)

func (*Percept) GetRelationName

func (p *Percept) GetRelationName() string

func (*Percept) Insert

func (p *Percept) Insert(val ...interface{})

func (*Percept) IsValid

func (p *Percept) IsValid() bool

func (*Percept) SetTime

func (p *Percept) SetTime(t time.Time)

func (*Percept) String

func (p *Percept) String() string

func (*Percept) Update

func (p *Percept) Update(val ...interface{})

func (*Percept) Validate

func (p *Percept) Validate() bool

type PerceptGenerator

type PerceptGenerator func(timestamp *time.Time) (percept *Percept)

A PerceptGenerator is a function that generates a Percept for a given time

type Pump

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

func NewPump

func NewPump(max, min, acc, delta float64, power, inc, dec *gpio.Pin) (p *Pump)

func (*Pump) Activate

func (p *Pump) Activate()

func (*Pump) Deactivate

func (p *Pump) Deactivate()

func (*Pump) DestructPump

func (p *Pump) DestructPump()

func (*Pump) GetCurrentFreq

func (p *Pump) GetCurrentFreq() float64

func (*Pump) GetMaxFreq

func (p *Pump) GetMaxFreq() float64

func (*Pump) GetMinFreq

func (p *Pump) GetMinFreq() float64

func (*Pump) GetState

func (p *Pump) GetState() (bool, float64)

func (*Pump) IsActive

func (p *Pump) IsActive() bool

func (*Pump) String

func (p *Pump) String() string

func (*Pump) UpdateFrequencyTo

func (p *Pump) UpdateFrequencyTo(target float64)

type Reward

type Reward int

type RollOut

type RollOut func(*Action)

A RollOut is a function responsible for controlling the actors according to an action

type State

type State interface {
	Successor(*Action) State
	CompareTo(State) int
	Equals(State) bool
	Reward(*Action, State) Reward
	IsTerminal() bool
}

type SystemState

type SystemState interface {
	State
	GetBurnerState() bool
	GetTriangleState() bool
	GetWFrequency() int
	GetHFrequency() int
	GetWState() bool
	GetHState() bool
}

Directories

Path Synopsis
The gpio package can be used to setup and access the raspberrie's gpio pins.
The gpio package can be used to setup and access the raspberrie's gpio pins.

Jump to

Keyboard shortcuts

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