Skip to content
Benedict Wilkins edited this page Jul 26, 2024 · 6 revisions

Matbii is a multi-task application built on top of icua.

By default it contains three tasks:

  • tracking
  • system monitoring
  • resource management

Each of these tasks is highly configurable, all it takes is to specify some configuration files.

Configuration files

There are two types of configuration files:

  • State files (.json)
  • Schedule files (.sch)

Typically these will all be placed in a single directory:

experiment/
|-resource_management.json  
|-resource_management.sch  
|-system_monitoring.json  
|-system_monitoring.sch  
|-tracking.json  
|-tracking.sch

The directory experiment/ will be used as the experiment.path option in the main configuration file.

State files

State files contain values that determine the starting state of the task and influence how the task is displayed in the UI.

See the following for a full list of options for each task: tracking, system monitoring, resource management.

Schedule files

Schedule files determine how each task evolves, the files are written in a DSL (domain specific language) details of which can be found here.

Briefly, schedule files contain a list of actions with times to execute them as look as follows:

ACTION(...) @ [T1, T2, ...] : R

Where T1, T2, ... are times to wait before executing the action ACTION (see next section for a discussion of actions), and R is the number of times to repeat the given sequence of wait times, the special character * means repeat forever.

Each task has a number of actions that have been defined which will update the state, these are defined in the corresponding task actuators where more details documentation can be found: tracking, system monitoring, resource management.

Example Schedules

####  Tracking Task Schedule ####

# this moves the target around randomly by 5 units every 0.1 seconds
perturb_target(5) @ [0.1]:*
####  System Monitoring Task Schedule ####

# this makes the lights turn to their unacceptable state "off" every 10-20 seconds
off_light(1) @ [uniform(10,20)]:*    # this means failure for light 1
on_light(2) @ [uniform(10,20)]:*     # this means failure for light 2
# toggle_light(1) is also an option
# toggle_light(2) is also an option

# this randomly moves the sliders (up/down by 1) every 5-6 seconds.
perturb_slider(1) @ [uniform(5,6)]:*
perturb_slider(2) @ [uniform(5,6)]:*
perturb_slider(3) @ [uniform(5,6)]:*
perturb_slider(4) @ [uniform(5,6)]:*
####  Resource Management Task Schedule ####

# these determine pump failures, fail for 2 seconds after between 3 and 10 seconds (and repeat)
toggle_pump_failure("fd") @ [uniform(3,10), 2]:*
toggle_pump_failure("fb") @ [uniform(3,10), 2]:*
toggle_pump_failure("db") @ [uniform(3,10), 2]:*
toggle_pump_failure("ec") @ [uniform(3,10), 2]:*
toggle_pump_failure("ea") @ [uniform(3,10), 2]:*
toggle_pump_failure("ca") @ [uniform(3,10), 2]:*
toggle_pump_failure("ba") @ [uniform(3,10), 2]:*
toggle_pump_failure("ab") @ [uniform(3,10), 2]:*

# these determine the burning of fuel in the two main tanks
burn_fuel("a", 10) @ [0.1]:*
burn_fuel("b", 10) @ [0.1]:*

# these determine the flow of the pumps (when they are "on")
pump_fuel("fd", 20) @ [0.1]:*
pump_fuel("fb", 20) @ [0.1]:*
pump_fuel("db", 20) @ [0.1]:*
pump_fuel("ec", 20) @ [0.1]:*
pump_fuel("ea", 20) @ [0.1]:*
pump_fuel("ca", 20) @ [0.1]:*
pump_fuel("ba", 20) @ [0.1]:*
pump_fuel("ab", 20) @ [0.1]:*

That is all for task configuration! The next sections are for people who want to implement their own entry points into matbii, implement new tasks or otherwise extend the package.

Multi-task Environments

Once task configurations have been set up, a task can be added to an environment. If you run matbii with python -m matbii this will happen automatically.

Enabling and disabling tasks

Tasks can be at enabled/disabled at runtime by agents using the actions: EnableTask or DisableTask or this can be done manually by calling ambient.enable_task() or ambient.disable_task().

Implementing a new task from scratch

For details on implementing a new task, consult the icua wiki. Take inspiration from the way that the currently tasks have been implemented!