Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Persistent Compute Objects, or picos, are tools for modeling the Internet of Things. A pico represents an entity–something that has a unique identity and a long-lived existence. Picos can represent people, places, things, organizations, and even ideas. 

Table of Contents

Pico Building Blocks

The following sections will discuss the various concepts in the pico ecosystem. The following diagram shows the relationship and interactions between between those concepts. 

Image Added

Picos

Picos are:

  • persistent: They exist from when they are created until they are explicitly deleted. Picos retain state based on past operations. 
  • unique: They have an identity that is immutable. While attributes of the pico, its state, may change, its identity does not. 
  • online: They are available on the Internet and respond to events and queries. 
  • concurrent: They operate independently of one another and process events and queries asynchronously. 
  • event-driven: They respond to events by changing state and sending new events. 
  • rule-based: Their behavior is expressed as rules that pattern-match against incoming events. Put another way, rules listen for events on the pico's internal event bus. 

Pico Programming

...

Picos are used to create models of interacting entities in the Internet of Things. 

Picos communicate by sending events to or making requests of

...

each other in an Actor-like manner. 

...

Picos exist in a system, called the "pico system."  The following diagram shows the relationship and interactions between a pico and all the other members of the pico system. 

 

Image Removed

Picos are at the heart of the pico system. Other pieces of the system either support or interact with picos to produce an active model. 

Events

Picos are event driven. 

Event bus internally

Actor model externally

 

 

Other

KRL Rulesets execute inside a persistent compute object, or pico

While rulesets are the primary organizing feature of KRL, you cannot program KRL without understanding picos. 

 

 

 

Pico Hosting Model

Image Removed

 

The Evert Query API

The Evert Query API

 

State

 

Event Loops

Each pico presents an event loop that handles events sent to the pico according to the rulesets that are installed in it. The following diagram shows the five phases of event evaluation. Note that evaluation is a cycle like any interpreter. The event represents the input to the interpreter that causes the cycle to happen. Once that event has been evaluated, the pico waits for another event.

 

 

 

We'll discuss the five stages in order.

...

If the rule makes a synchronous call to an external API, rule execution waits for the external resource to respond. If a rule sends an event to another pico, that sets off another independent event evaluation cycle, it doesn't modify the schedule for the cycle execution the event:send(). Inter-pico events are sent asynchronously by default.

...

Once the response has been returned, the pico waits for another event.

KRL

 KRL Rulesets execute inside a persistent compute object, or pico

While rulesets are the primary organizing feature of KRL, you cannot program KRL without understanding picos. 

Rulesets

 

KRE

Pico Hosting Model

Image Added