{"action":"created","comment":{"url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/comments/241774849","pull_request_review_id":185118079,"id":241774849,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTc3NDg0OQ==","diff_hunk":"@@ -6,7 +6,74 @@ \\subsection{Scheduling}\\label{Design:Scheduling}\n When choosing a scheduling method for the system, multiple methods were considered. \n Both fixed priority scheduling and cyclic executive were considered for the system as both of them would be good at handling the tasks of the system with their deadlines.\n \n-Cyclic executive was chosen due the the fast execution time of the tasks, and that preemption and context switching would exceed the time for simply completing the previous task. \n-It was reasoned that since all tasks should run regularly, and execute fast enough to run within the major cycle the cyclic execution method should be perfect. \n+Due to the fast execution time of the tasks, and that preemption and context switching would exceed the time for simply completing the previous task.\n+At first it was at deemed obvious to use the cyclic executive model as all tasks should run regularly, and that they execute fast enough to run within the major cycle the cyclic execution method should be perfect. \n+However, should the execution time of a single task exceed one millisecond, the usage of cyclic executive is no longer viable, as the task to keep the USB connection alive is required to be executed once every millisecond.\n+In this case, fixed-priority scheduling is a better alternative, as it allows the scheduler to pre-empt the task in order to run the USB related task.\n \n-The cyclic executive method is a common way to implement hard real-time systems due to its simplicity, deterministic behavior and relative ease of implementation\\cite{CyclicExecutionKimLarsen}.\n\\ No newline at end of file\n+Both the fixed priority and cyclic executive methods are a common ways to implement hard real-time systems due to their simplicity, deterministic behavior and relative ease of implementation\\cite{CyclicExecutionKimLarsen}.\n+\n+In order to ensure that the system is schedulable, an UPPAAL model of the scheduler and the tasks was created. \n+\n+\\subsubsection{UPPAAL}\n+UPPAAL is an integrated tool environment for modeling, validation and verification of real-time systems modeled as networks of timed automata\\cite{UPPAALWebsite}. \n+Using the UPPAAL tool, a model of the tasks of the system was constructed. \n+\n+\\paragraph{Templates}\n+When creating an UPPAAL project, a templates must be made, which is a model that describes a system or a part of a system.  \n+The templates are later used to make up the entire system, and they can communicate using channels specified in the declarations of the project.\n+\n+\\paragraph{Locations}\n+An UPPAAL model consists of at least one \\textit{location}, which is a state that the system can be in. \n+A location can optionally be specified as \\textit{initial}, \\textit{urgent}, \\textit{committed}. \n+If a location is marked as initial, it is defined as the starting state for the modelled system. \n+A location marked with urgent will be the preferred destination, if there are multiple possible transitions. \n+A location marked as committed is an location that is preferred over an location without any type and that is overruled by a location marked as urgent. \n+If a location is not marked with an specific type, the location might be taken but has the lowest priority if any other transitions are possible. \n+A location can be given an \\textit{invariant} that can be used to specify a condition that must be fulfilled before a location can be left. \n+\n+\\paragraph{Edges}\n+Between locations an edge can be created, they are used to model a shift in model state and is used to control the flow through the template. \n+On edges different methods can be used to enforce a wanted behavior and transfer information between templates. \n+\n+\\paragraph{Declarations}\n+Once the templates has been created, the declaration is used to make the entire system function. \n+The declaration is can contain variables, channels and methods used in the templates and between templates. \n+Declarations can be specified on a template level and on an global level. \n+\n+\\paragraph{System declarations}\n+The system model in the templates is initialized from the system declarations, where instances of the templates are initialized and added to the system as can be seen on \\autoref{snip:UPPAALSystemDeclaration}. \n+\n+\n+\\begin{lstlisting}[label={snip:UPPAALSystemDeclaration},caption={System declaration from UPPAAL},frame=tlrb,numbers=none]\n+BackgroundTask    = Task( 0 );\n+UpdateDisplayTask = Task( 1 );\n+MoveMotorsTask    = Task( 2 );\n+ReciveDataTask    = Task( 3 );\n+HandleLaserTask   = Task( 4 );\n+KeepUSBAliveTask  = Task( 5 );\n+\n+system BackgroundTask, UpdateDisplayTask, MoveMotorsTask, ReciveDataTask, HandleLaserTask, KeepUSBAliveTask, Scheduler;\n+\\end{lstlisting}\n+Each task in initialized and assigned to an new task which is then added to the system along with the scheduler. \n+\n+On \\autoref{fig:UppaalTask} the behavior of the a task in can be seen. \n+The model is a timed automaton which is used to ensure that the task will come true to its deadline and periods. \n+The model consists of all the states a task can be in.\n+Each state has a number of transitions that can change the state of the task. \n+\n+\\figur{0.5}{images/Task}{The figure shows the the task template from UPPAAAL}{fig:UppaalTask}\n+\n+On \\autoref{fig:UppaalScheduler} the model of how the scheduler works can be seen. \n+Since the scheduler is responsible for running all tasks on the system it simply needs an queue of tasks ready for running. \n+The tasks in the queue are sorted then entering the queue based on their priority. \n+It when simply needs to start the tasks as they arrive at a ready state and the scheduler ready to run them.\n+\n+\\figur{0.5}{images/Scheduler}{The figure shows the scheduler template from UPPAAL}{fig:UppaalScheduler}\n+\n+Based on the model of both the task and the scheduler, it is verifiable that the system is schedulable using the verifier tool in UPPAAL. \n+The verifier will run a query, as can be seen on \\autoref{snip:UPPAALQuery} asking that for any given state, none of the tasks are going into the error state. ","path":"report/4.Design/RTS.tex","position":74,"original_position":74,"commit_id":"b0c38a53d69e229e3b47e024994253d0c3457713","original_commit_id":"b0c38a53d69e229e3b47e024994253d0c3457713","user":{"login":"nillas12","id":6108612,"node_id":"MDQ6VXNlcjYxMDg2MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/6108612?v=4","gravatar_id":"","url":"https://api.github.com/users/nillas12","html_url":"https://github.com/nillas12","followers_url":"https://api.github.com/users/nillas12/followers","following_url":"https://api.github.com/users/nillas12/following{/other_user}","gists_url":"https://api.github.com/users/nillas12/gists{/gist_id}","starred_url":"https://api.github.com/users/nillas12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nillas12/subscriptions","organizations_url":"https://api.github.com/users/nillas12/orgs","repos_url":"https://api.github.com/users/nillas12/repos","events_url":"https://api.github.com/users/nillas12/events{/privacy}","received_events_url":"https://api.github.com/users/nillas12/received_events","type":"User","site_admin":false},"body":"```suggestion\r\nThe verifier will run a query, asking that for any given state, none of the tasks are going into the error state. \r\nThis is shown on \\autoref{snip:UPPAALQuery}.\r\n```","created_at":"2018-12-14T14:39:22Z","updated_at":"2018-12-14T14:40:08Z","html_url":"https://github.com/aau-hcl-p5/main/pull/139#discussion_r241774849","pull_request_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/139","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/comments/241774849"},"html":{"href":"https://github.com/aau-hcl-p5/main/pull/139#discussion_r241774849"},"pull_request":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/139"}}},"pull_request":{"url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/139","id":237963765,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3OTYzNzY1","html_url":"https://github.com/aau-hcl-p5/main/pull/139","diff_url":"https://github.com/aau-hcl-p5/main/pull/139.diff","patch_url":"https://github.com/aau-hcl-p5/main/pull/139.patch","issue_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/139","number":139,"state":"open","locked":false,"title":"P5-217: Added more about RTS","user":{"login":"Moesgaarda","id":21969475,"node_id":"MDQ6VXNlcjIxOTY5NDc1","avatar_url":"https://avatars3.githubusercontent.com/u/21969475?v=4","gravatar_id":"","url":"https://api.github.com/users/Moesgaarda","html_url":"https://github.com/Moesgaarda","followers_url":"https://api.github.com/users/Moesgaarda/followers","following_url":"https://api.github.com/users/Moesgaarda/following{/other_user}","gists_url":"https://api.github.com/users/Moesgaarda/gists{/gist_id}","starred_url":"https://api.github.com/users/Moesgaarda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moesgaarda/subscriptions","organizations_url":"https://api.github.com/users/Moesgaarda/orgs","repos_url":"https://api.github.com/users/Moesgaarda/repos","events_url":"https://api.github.com/users/Moesgaarda/events{/privacy}","received_events_url":"https://api.github.com/users/Moesgaarda/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-12T09:20:57Z","updated_at":"2018-12-14T14:40:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9291e64d6fbd6676f798b48636c12b2dc68a683c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/139/commits","review_comments_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/139/comments","review_comment_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/139/comments","statuses_url":"https://api.github.com/repos/aau-hcl-p5/main/statuses/b0c38a53d69e229e3b47e024994253d0c3457713","head":{"label":"aau-hcl-p5:P5-217-rts","ref":"P5-217-rts","sha":"b0c38a53d69e229e3b47e024994253d0c3457713","user":{"login":"aau-hcl-p5","id":43030341,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDMwMzQx","avatar_url":"https://avatars0.githubusercontent.com/u/43030341?v=4","gravatar_id":"","url":"https://api.github.com/users/aau-hcl-p5","html_url":"https://github.com/aau-hcl-p5","followers_url":"https://api.github.com/users/aau-hcl-p5/followers","following_url":"https://api.github.com/users/aau-hcl-p5/following{/other_user}","gists_url":"https://api.github.com/users/aau-hcl-p5/gists{/gist_id}","starred_url":"https://api.github.com/users/aau-hcl-p5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aau-hcl-p5/subscriptions","organizations_url":"https://api.github.com/users/aau-hcl-p5/orgs","repos_url":"https://api.github.com/users/aau-hcl-p5/repos","events_url":"https://api.github.com/users/aau-hcl-p5/events{/privacy}","received_events_url":"https://api.github.com/users/aau-hcl-p5/received_events","type":"Organization","site_admin":false},"repo":{"id":147644695,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc2NDQ2OTU=","name":"main","full_name":"aau-hcl-p5/main","private":false,"owner":{"login":"aau-hcl-p5","id":43030341,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDMwMzQx","avatar_url":"https://avatars0.githubusercontent.com/u/43030341?v=4","gravatar_id":"","url":"https://api.github.com/users/aau-hcl-p5","html_url":"https://github.com/aau-hcl-p5","followers_url":"https://api.github.com/users/aau-hcl-p5/followers","following_url":"https://api.github.com/users/aau-hcl-p5/following{/other_user}","gists_url":"https://api.github.com/users/aau-hcl-p5/gists{/gist_id}","starred_url":"https://api.github.com/users/aau-hcl-p5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aau-hcl-p5/subscriptions","organizations_url":"https://api.github.com/users/aau-hcl-p5/orgs","repos_url":"https://api.github.com/users/aau-hcl-p5/repos","events_url":"https://api.github.com/users/aau-hcl-p5/events{/privacy}","received_events_url":"https://api.github.com/users/aau-hcl-p5/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/aau-hcl-p5/main","description":null,"fork":false,"url":"https://api.github.com/repos/aau-hcl-p5/main","forks_url":"https://api.github.com/repos/aau-hcl-p5/main/forks","keys_url":"https://api.github.com/repos/aau-hcl-p5/main/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aau-hcl-p5/main/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aau-hcl-p5/main/teams","hooks_url":"https://api.github.com/repos/aau-hcl-p5/main/hooks","issue_events_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/events{/number}","events_url":"https://api.github.com/repos/aau-hcl-p5/main/events","assignees_url":"https://api.github.com/repos/aau-hcl-p5/main/assignees{/user}","branches_url":"https://api.github.com/repos/aau-hcl-p5/main/branches{/branch}","tags_url":"https://api.github.com/repos/aau-hcl-p5/main/tags","blobs_url":"https://api.github.com/repos/aau-hcl-p5/main/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aau-hcl-p5/main/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aau-hcl-p5/main/git/refs{/sha}","trees_url":"https://api.github.com/repos/aau-hcl-p5/main/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aau-hcl-p5/main/statuses/{sha}","languages_url":"https://api.github.com/repos/aau-hcl-p5/main/languages","stargazers_url":"https://api.github.com/repos/aau-hcl-p5/main/stargazers","contributors_url":"https://api.github.com/repos/aau-hcl-p5/main/contributors","subscribers_url":"https://api.github.com/repos/aau-hcl-p5/main/subscribers","subscription_url":"https://api.github.com/repos/aau-hcl-p5/main/subscription","commits_url":"https://api.github.com/repos/aau-hcl-p5/main/commits{/sha}","git_commits_url":"https://api.github.com/repos/aau-hcl-p5/main/git/commits{/sha}","comments_url":"https://api.github.com/repos/aau-hcl-p5/main/comments{/number}","issue_comment_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/comments{/number}","contents_url":"https://api.github.com/repos/aau-hcl-p5/main/contents/{+path}","compare_url":"https://api.github.com/repos/aau-hcl-p5/main/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aau-hcl-p5/main/merges","archive_url":"https://api.github.com/repos/aau-hcl-p5/main/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aau-hcl-p5/main/downloads","issues_url":"https://api.github.com/repos/aau-hcl-p5/main/issues{/number}","pulls_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls{/number}","milestones_url":"https://api.github.com/repos/aau-hcl-p5/main/milestones{/number}","notifications_url":"https://api.github.com/repos/aau-hcl-p5/main/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aau-hcl-p5/main/labels{/name}","releases_url":"https://api.github.com/repos/aau-hcl-p5/main/releases{/id}","deployments_url":"https://api.github.com/repos/aau-hcl-p5/main/deployments","created_at":"2018-09-06T08:48:06Z","updated_at":"2018-12-14T12:22:56Z","pushed_at":"2018-12-14T13:27:18Z","git_url":"git://github.com/aau-hcl-p5/main.git","ssh_url":"git@github.com:aau-hcl-p5/main.git","clone_url":"https://github.com/aau-hcl-p5/main.git","svn_url":"https://github.com/aau-hcl-p5/main","homepage":null,"size":47379,"stargazers_count":2,"watchers_count":2,"language":"TeX","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":2,"default_branch":"develop"}},"base":{"label":"aau-hcl-p5:develop","ref":"develop","sha":"2fce77acf08871e87ba1a76dae4e7b02bffa091e","user":{"login":"aau-hcl-p5","id":43030341,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDMwMzQx","avatar_url":"https://avatars0.githubusercontent.com/u/43030341?v=4","gravatar_id":"","url":"https://api.github.com/users/aau-hcl-p5","html_url":"https://github.com/aau-hcl-p5","followers_url":"https://api.github.com/users/aau-hcl-p5/followers","following_url":"https://api.github.com/users/aau-hcl-p5/following{/other_user}","gists_url":"https://api.github.com/users/aau-hcl-p5/gists{/gist_id}","starred_url":"https://api.github.com/users/aau-hcl-p5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aau-hcl-p5/subscriptions","organizations_url":"https://api.github.com/users/aau-hcl-p5/orgs","repos_url":"https://api.github.com/users/aau-hcl-p5/repos","events_url":"https://api.github.com/users/aau-hcl-p5/events{/privacy}","received_events_url":"https://api.github.com/users/aau-hcl-p5/received_events","type":"Organization","site_admin":false},"repo":{"id":147644695,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc2NDQ2OTU=","name":"main","full_name":"aau-hcl-p5/main","private":false,"owner":{"login":"aau-hcl-p5","id":43030341,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMDMwMzQx","avatar_url":"https://avatars0.githubusercontent.com/u/43030341?v=4","gravatar_id":"","url":"https://api.github.com/users/aau-hcl-p5","html_url":"https://github.com/aau-hcl-p5","followers_url":"https://api.github.com/users/aau-hcl-p5/followers","following_url":"https://api.github.com/users/aau-hcl-p5/following{/other_user}","gists_url":"https://api.github.com/users/aau-hcl-p5/gists{/gist_id}","starred_url":"https://api.github.com/users/aau-hcl-p5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aau-hcl-p5/subscriptions","organizations_url":"https://api.github.com/users/aau-hcl-p5/orgs","repos_url":"https://api.github.com/users/aau-hcl-p5/repos","events_url":"https://api.github.com/users/aau-hcl-p5/events{/privacy}","received_events_url":"https://api.github.com/users/aau-hcl-p5/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/aau-hcl-p5/main","description":null,"fork":false,"url":"https://api.github.com/repos/aau-hcl-p5/main","forks_url":"https://api.github.com/repos/aau-hcl-p5/main/forks","keys_url":"https://api.github.com/repos/aau-hcl-p5/main/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aau-hcl-p5/main/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aau-hcl-p5/main/teams","hooks_url":"https://api.github.com/repos/aau-hcl-p5/main/hooks","issue_events_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/events{/number}","events_url":"https://api.github.com/repos/aau-hcl-p5/main/events","assignees_url":"https://api.github.com/repos/aau-hcl-p5/main/assignees{/user}","branches_url":"https://api.github.com/repos/aau-hcl-p5/main/branches{/branch}","tags_url":"https://api.github.com/repos/aau-hcl-p5/main/tags","blobs_url":"https://api.github.com/repos/aau-hcl-p5/main/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aau-hcl-p5/main/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aau-hcl-p5/main/git/refs{/sha}","trees_url":"https://api.github.com/repos/aau-hcl-p5/main/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aau-hcl-p5/main/statuses/{sha}","languages_url":"https://api.github.com/repos/aau-hcl-p5/main/languages","stargazers_url":"https://api.github.com/repos/aau-hcl-p5/main/stargazers","contributors_url":"https://api.github.com/repos/aau-hcl-p5/main/contributors","subscribers_url":"https://api.github.com/repos/aau-hcl-p5/main/subscribers","subscription_url":"https://api.github.com/repos/aau-hcl-p5/main/subscription","commits_url":"https://api.github.com/repos/aau-hcl-p5/main/commits{/sha}","git_commits_url":"https://api.github.com/repos/aau-hcl-p5/main/git/commits{/sha}","comments_url":"https://api.github.com/repos/aau-hcl-p5/main/comments{/number}","issue_comment_url":"https://api.github.com/repos/aau-hcl-p5/main/issues/comments{/number}","contents_url":"https://api.github.com/repos/aau-hcl-p5/main/contents/{+path}","compare_url":"https://api.github.com/repos/aau-hcl-p5/main/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aau-hcl-p5/main/merges","archive_url":"https://api.github.com/repos/aau-hcl-p5/main/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aau-hcl-p5/main/downloads","issues_url":"https://api.github.com/repos/aau-hcl-p5/main/issues{/number}","pulls_url":"https://api.github.com/repos/aau-hcl-p5/main/pulls{/number}","milestones_url":"https://api.github.com/repos/aau-hcl-p5/main/milestones{/number}","notifications_url":"https://api.github.com/repos/aau-hcl-p5/main/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aau-hcl-p5/main/labels{/name}","releases_url":"https://api.github.com/repos/aau-hcl-p5/main/releases{/id}","deployments_url":"https://api.github.com/repos/aau-hcl-p5/main/deployments","created_at":"2018-09-06T08:48:06Z","updated_at":"2018-12-14T12:22:56Z","pushed_at":"2018-12-14T13:27:18Z","git_url":"git://github.com/aau-hcl-p5/main.git","ssh_url":"git@github.com:aau-hcl-p5/main.git","clone_url":"https://github.com/aau-hcl-p5/main.git","svn_url":"https://github.com/aau-hcl-p5/main","homepage":null,"size":47379,"stargazers_count":2,"watchers_count":2,"language":"TeX","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/139"},"html":{"href":"https://github.com/aau-hcl-p5/main/pull/139"},"issue":{"href":"https://api.github.com/repos/aau-hcl-p5/main/issues/139"},"comments":{"href":"https://api.github.com/repos/aau-hcl-p5/main/issues/139/comments"},"review_comments":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/139/comments"},"review_comment":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aau-hcl-p5/main/pulls/139/commits"},"statuses":{"href":"https://api.github.com/repos/aau-hcl-p5/main/statuses/b0c38a53d69e229e3b47e024994253d0c3457713"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nillas12"}}