K  n  o  w  L  a  n  g
Framework for Knowledge Representation and Reasoning for Self-Adaptive Systems


U s e r    G u i d e

Home
Running KnowLang
Knowledge Model
Concepts
Objects
States
Metrics
Self-Adaptive Behavior
Goals
Situations
Policies
Reasoner
Contact Info
Description

States in KnowLang are specified as intrinsic, yet explicit properties of concepts. States are specified as Boolean expressions and are evaluated at runtime by the KnowLang Reasoner. States are not specified as single concepts, but as part of the specification of a single concept. In general, a concept may occupy a new state when concept properties have been changed or some events or actions have occurred in the system or environment. The following example demonstrates the specification of a concept along with its intrinsic states.

//Science Clouds SCP
CONCEPT SCP {
  PARENTS {ScCl.ScCloud.CONCEPT_TREES.Cloud_Platform}
  CHILDREN {}
  STATES {
    STATE Running {
      ScCl.ScCloud.CONCEPT_TREES.SCP.PROPS.platform_API.STATES.Running AND
      ScCl.ScCloud.CONCEPT_TREES.SCP.PROPS.platform_Library.STATES.Running }
    STATE Executing { IS_PERFORMING{ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.runApp} }
    STATE Observing { IS_PERFORMING{ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.runApp} AND
      IS_PERFORMING{ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.observeApp} }
    STATE Down { NOT ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.Running }
    STATE Overloaded { ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.OverloadedCPU OR
      ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.OverloadedStorage OR
      ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.OverloadedMemory }
    STATE OverloadedCPU { ScCl.ScCloud.CONCEPT_TREES.CPU_Usage > 95 }
    STATE OverloadedMemory { ScCl.ScCloud.CONCEPT_TREES.Memory_Usage > 95 }
    STATE OverloadedStorage { ScCl.ScCloud.CONCEPT_TREES.Hard_Disk_Usage > 95 }
    STATE ApplicationTransferred { LAST_PERFORMED{ ScCl.ScCloud.CONCEPT_TREES.SCP,
      ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.transferApp} }
    STATE InCommunication { ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.hasActiveCommunication = 1 }
    STATE InCommunicationLatency { ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.InCommunication AND
      ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.getCommunicationLatency > 50 }
    STATE InLowTrafic { ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.getDataTrafic <= 50 }
    STATE Started { LAST_PERFORMED{ScCl.ScCloud.CONCEPT_TREES.SCP,
      ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.start} }
    STATE Stopped { LAST_PERFORMED{ScCl.ScCloud.CONCEPT_TREES.SCP,
      ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.stop} }
  }
  PROPS {
    PROP platform_API { TYPE {ScCl.ScCloud.CONCEPT_TREES.API} CARDINALITY {1} }
    PROP platform_Library { TYPE {ScCl.ScCloud.CONCEPT_TREES.Library} CARDINALITY {1} }
  }
  FUNCS {
    FUNC run { TYPE { ScCl.ScCloud.CONCEPT_TREES.RunSCP } }
    FUNC down { TYPE { ScCl.ScCloud.CONCEPT_TREES.StopSCP } }
    FUNC runApp { TYPE { ScCl.ScCloud.CONCEPT_TREES.RunApplication } }
    FUNC observeApp { TYPE { ScCl.ScCloud.CONCEPT_TREES.ObserveApplication } }
    FUNC transferApp { TYPE { ScCl.ScCloud.CONCEPT_TREES.TransferApplication } }
    FUNC hasActiveCommunication { TYPE { ScCl.ScCloud.CONCEPT_TREES.CheckForActiveCommunication } }
    FUNC getCommunicationLatency { TYPE { ScCl.ScCloud.CONCEPT_TREES.GetCommunicationLatency } }
    FUNC getDataTrafic { TYPE { ScCl.ScCloud.CONCEPT_TREES.GetDataTrafic } }
    FUNC start { TYPE { ScCl.ScCloud.CONCEPT_TREES.RunSCP } }
    FUNC stop { TYPE { ScCl.ScCloud.CONCEPT_TREES.StopSCP } }
    FUNC leaveSCPe { TYPE { ScCl.ScCloud.CONCEPT_TREES.LeaveSCPe } }
    FUNC joinSCPe { TYPE { ScCl.ScCloud.CONCEPT_TREES.JoinSCPe } }
  }
}

As shown in the example above, the state Executing is true while the SCP is performing the runApp function. The KnowLang operator IS_PERFORMING evaluates actions and returns true if an action is currently performing. Similarly, the operator LAST_PERFORMED evaluates actions and returns true if an action is the last successfully performed action by a concept or its realization (object). As shown in the examples, a complex state might be expressed as a Boolean function of other states. For example, the Running state is expressed as a Boolean function of two other states, particularly, states of concept's properties, e.g., the SCP is running if both its API and Library are running.

States are extremely important to the specification of GOALS, SITUATIONS, and POLICIES. For example, states help the KnowLang Reasoner determine at runtime whether the system is in a particular situation or a particular goal has been achieved. Note that to specify states, we may also use METRICS.

Example
STATES {
  STATE Orbiting {}
  STATE InTransfer {}
  STATE InOrbitPlacement {}
  STATE InJettison {}
  STATE InHighIrradiation { BepiColombo.MMO.CONCEPT_TREES.OutsideRadiation > 50 }
  STATE InHeatFlux { BepiColombo.MMO.CONCEPT_TREES.OutsideTemp > 150 }
  STATE AtPolarOrbit { LAST_PERFORMED { BepiColombo.MMO.CONCEPT_TREES.MMO_Spacecraft,
    BepiColombo.MMO.CONCEPT_TREES.MMO_Spacecraft.FUNCS.moveToPolarOrbit } }
  STATE ArrivedAtMercury { BepiColombo.MMO.CONCEPT_TREES.MercuryAltitude = 39 }
  STATE EarthCommunicationLost { BepiColombo.MMO.CONCEPT_TREES.EarthSignal = 0 }
}

STATES {
  STATE AtBeginning {eMobility.eCars.CONCEPT_TREES.Route.FUNCS.getCurrentLocation =
    eMobility.eCars.CONCEPT_TREES.Route.PROPS.locationA}
  STATE AtEnd {eMobility.eCars.CONCEPT_TREES.Route.FUNCS.getCurrentLocation =
    eMobility.eCars.CONCEPT_TREES.Route.PROPS.locationB}
  STATE OnRoute { NOT eMobility.eCars.CONCEPT_TREES.Route.STATES.AtBeginning AND
    NOT eMobility.eCars.CONCEPT_TREES.Route.STATES.AtEnd}
  STATE InHighTraffic {eMobility.eCars.CONCEPT_TREES.Route.PROPS.currentRoad.STATES.InHighTraffic}
  STATE InLowTraffic {eMobility.eCars.CONCEPT_TREES.Route.PROPS.currentRoad.STATES.InFluentTraffic}
}

top
User Guide Curator - Emil Vassev
Last modified on January 28, 2014