Skip to content

Instantly share code, notes, and snippets.

@venglov
Last active March 15, 2021 10:10
Show Gist options
  • Save venglov/dbb5fd9d7d803eb7e7869601fe155f5d to your computer and use it in GitHub Desktop.
Save venglov/dbb5fd9d7d803eb7e7869601fe155f5d to your computer and use it in GitHub Desktop.
aadl
package syst
public
system SecuritySystem
end SecuritySystem;
system implementation SecuritySystem.with_devices
subcomponents
this_motion_sensor: device MotionSensor;
this_magnetic_alarm_sensor: device MagneticAlarmSensor;
this_camera: device Camera;
this_alarm_unit: device AlarmUnit;
this_controller: process Controller.with_threads;
this_bus: bus HWConnection.impl;
this_processor: processor MainProcessor.impl;
connections
motion_conn: port this_motion_sensor.motion_detected->this_controller.motion_in;
magnetic_conn: port this_magnetic_alarm_sensor.alarm_set_off->this_controller.magnetic_in;
camera_conn_out: port this_controller.camera_out->this_camera.camera_on_off;
alarm_conn: port this_controller.alarm_out->this_alarm_unit.alarm_on_off;
camera_conn_in: port this_camera.video_stream->this_controller.video_from_camera;
bus_motion: bus access this_bus -> this_motion_sensor.bus_access;
bus_magnetic: bus access this_bus -> this_magnetic_alarm_sensor.bus_access;
bus_camera: bus access this_bus -> this_camera.bus_access;
bus_alarm: bus access this_bus -> this_alarm_unit.bus_access;
bus_processor: bus access this_bus -> this_processor.bus_access;
end SecuritySystem.with_devices;
process Controller
features
motion_in: in event port;
magnetic_in: in event port;
camera_out: out event port;
alarm_out: out event port;
video_from_camera: in data port;
end Controller;
process implementation Controller.with_threads
subcomponents
the_thread_motion: thread ReadMotion.impl;
the_thread_magnetic: thread ReadMagnetic.impl;
the_thread_control: thread ControlRules.impl;
the_thread_video: thread ProcessVideo.impl;
connections
motion_thread_conn: port motion_in -> the_thread_motion.motion_in;
magnetic_thread_conn: port magnetic_in -> the_thread_magnetic.magnetic_in;
motion_control_conn: port the_thread_motion.motion_out -> the_thread_control.motion_in;
magnetic_control_conn: port the_thread_magnetic.magnetic_out -> the_thread_control.magnetic_in;
camera_control_conn: port the_thread_control.camera_out -> camera_out;
alarm_control_conn: port the_thread_control.alarm_out -> alarm_out;
video_conn: port video_from_camera -> the_thread_video.video_in;
end Controller.with_threads;
thread ReadMotion
features
motion_in: in event port;
motion_out: out event port;
end ReadMotion;
thread implementation ReadMotion.impl
end ReadMotion.impl;
thread ReadMagnetic
features
magnetic_in: in event port;
magnetic_out: out event port;
end ReadMagnetic;
thread implementation ReadMagnetic.impl
end ReadMagnetic.impl;
thread ControlRules
features
motion_in: in event port;
magnetic_in: in event port;
alarm_out: out event port;
camera_out: out event port;
end ControlRules;
thread implementation ControlRules.impl
end ControlRules.impl;
thread ProcessVideo
features
video_in: in data port;
end ProcessVideo;
thread implementation ProcessVideo.impl
end ProcessVideo.impl;
processor MainProcessor
features
bus_access: requires bus access HWConnection;
end MainProcessor;
processor implementation MainProcessor.impl
subcomponents
this_ram: memory Ram;
end MainProcessor.impl;
memory Ram
end Ram;
bus HWConnection
end HWConnection;
bus implementation HWConnection.impl
end HWConnection.impl;
device MotionSensor
features
motion_detected: out event port;
bus_access: requires bus access HWConnection;
end MotionSensor;
device implementation MotionSensor.impl
end MotionSensor.impl;
device MagneticAlarmSensor
features
bus_access: requires bus access HWConnection;
alarm_set_off: out event port;
end MagneticAlarmSensor;
device implementation MagneticAlarmSensor.impl
end MagneticAlarmSensor.impl;
device Camera
features
bus_access: requires bus access HWConnection;
camera_on_off: in event port;
video_stream: out data port;
end Camera;
device implementation Camera.impl
end Camera.impl;
device AlarmUnit
features
alarm_on_off: in event port;
bus_access: requires bus access HWConnection;
end AlarmUnit;
device implementation AlarmUnit.impl
end AlarmUnit.impl;
end syst;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment