From 217819954fa3ee999e837dafd26817f69b5746b9 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 19 Apr 2025 10:30:57 +0200 Subject: rename directory P5 -> p5.js; update report content --- P5/light.js | 28 ------------------- p5.js/light.js | 28 +++++++++++++++++++ ref.bib | 17 ++++++++++++ report.qmd | 87 +++++++++++++++++++++++++++++----------------------------- 4 files changed, 89 insertions(+), 71 deletions(-) delete mode 100644 P5/light.js create mode 100644 p5.js/light.js diff --git a/P5/light.js b/P5/light.js deleted file mode 100644 index 20eb1c0..0000000 --- a/P5/light.js +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Noor Ahmad -// SPDX-License-Identifier: GPL-3.0-or-later - -let button; -let bgColor; // a variable that keeps track of the background color -let isBlack = true; // Starts with black - -function setup() { - createCanvas(800, 500); - bgColor = color(15, 15, 60); - button = createButton("Color"); - button.mouseClicked(changeBackground); - button.size(50, 50); - button.position(350, 210); -} - -function draw() { - background(bgColor); -} - -function changeBackground() { - if (isBlack) { - bgColor = color(255, 223, 0); // Yellow - } else { - bgColor = color(15, 15, 60); // Black - } - isBlack = !isBlack; // Changing between true and false -} \ No newline at end of file diff --git a/p5.js/light.js b/p5.js/light.js new file mode 100644 index 0000000..20eb1c0 --- /dev/null +++ b/p5.js/light.js @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2025 Noor Ahmad +// SPDX-License-Identifier: GPL-3.0-or-later + +let button; +let bgColor; // a variable that keeps track of the background color +let isBlack = true; // Starts with black + +function setup() { + createCanvas(800, 500); + bgColor = color(15, 15, 60); + button = createButton("Color"); + button.mouseClicked(changeBackground); + button.size(50, 50); + button.position(350, 210); +} + +function draw() { + background(bgColor); +} + +function changeBackground() { + if (isBlack) { + bgColor = color(255, 223, 0); // Yellow + } else { + bgColor = color(15, 15, 60); // Black + } + isBlack = !isBlack; // Changing between true and false +} \ No newline at end of file diff --git a/ref.bib b/ref.bib index ba6c3e1..ae942eb 100644 --- a/ref.bib +++ b/ref.bib @@ -139,6 +139,23 @@ file = {:GarciaHuertes2016 - The Use of Unio Tumidus for Detection of Water Pollution.pdf:PDF}, } +@Online{GeeksforGeeks2024, + date = {2024-08-23}, + editor = {GeeksforGeeks}, + title = {Coupling in Java}, + url = {https://www.geeksforgeeks.org/coupling-in-java/}, + urldate = {2025-04-19}, +} + +@Online{AccentSystems2021, + author = {{Accent Systems}}, + date = {2021-07-06}, + editor = {{Accent Systems}}, + title = {What is Eddystoneâ„¢?}, + url = {https://accent-systems.com/support/faq/what-is-eddystone/}, + urldate = {2025-04-19}, +} + @Comment{jabref-meta: databaseType:biblatex;} @Comment{jabref-meta: fileDirectory-jonas-bastian:/home/jonas/Projects/RUC/LIB/mussel;} diff --git a/report.qmd b/report.qmd index 966490d..847b26f 100644 --- a/report.qmd +++ b/report.qmd @@ -39,7 +39,6 @@ is illustration and demostration purposes. *TODO: come back and write about each step, OUR THREE REQUIRED COMPONENTS,and a conclusion* - # Introduction - amal In Poland, several waterworks use biomonitoring systems @@ -52,7 +51,6 @@ and have additionally made a p5.js program to simulate night and day, which influences the pseudomussels' behaviour (reaction). We have defined a research question to work around: - **How do we simulate and visualise an existing biomonitoring technology for its core purpose** @@ -140,12 +138,13 @@ but it is explicitly stated as "Not a part of the curicculum". Hence we have searched for external sources on API knowledge. We decided to implement a loosely coupled network design -as in @GeeksForGeeks2024, +as described e.g. in @GeeksforGeeks2024, to connect the different components and allow each of them to operate independently, whilst still being able to exchange data. We chose to use the BLE Beacon API -- -specifically the Eddystone protocol @accentSystems -- +specifically the Eddystone protocol +as described e.g. in @AccentSystems2021 -- and focused on TLM (telementry) frame type. The original purpose of of TLM is to transmit temperature and battery level, @@ -156,10 +155,6 @@ of one of our android phones, indicating that any system supporting this API could interact with our sensors. -*FIXME: add web link for @accentSystems above -(that can be transformed into a biblatex reference) -https://accent-systems.com/support/faq/what-is-eddystone/* - ## Detecting stressful mussel behavior We wish to expound some of the ways @@ -313,6 +308,13 @@ The sensor system is our beacon and it works like a lighthouse. It sends signals out to say "im here, i exist". Then Boom! a bluetooth connection is made. +*TODO: "... connection is made" can mislead the reader +into expecting a two-way connection +which is not the case in our deliberately loose coupling. +Probably better to phrase it like +"...nearby Bluetooth receivers can capture the beacon message" -- +smooth and quiet, no "Boom!"* + ```{.plantuml} !include Arduino/vote/vote.puml ``` @@ -332,36 +334,37 @@ whether used the guide from role 3 archetype (see course curriculum), and if it was helpful/right/wrong* -We have chosen not to use AI in our project. -This is mainly for imitation of the current technology -and for scope purposes. -Although, we have reflected upon how AI could be useful -in an expansion of our prototype -or hypothetically in an existing system. -For an instance, in the future -- -when scientists have analysed and interpreted enough data -to feed to a MLM -- -ai could be used for detecting subtle behavioral changes, -that humans would otherwise miss, -or spot patterns that further indicates pollution -or predicts contamination or enviromental stress. - -*FIXME: the abbreviations AI and MLM must be introduced before used, -and then used consistently (e.g. all caps or no caps)* - -It could also be put into perspective of surrounding cases, -and through datacentric AI, -it could be visualized like a weatherforecast on a dashboard. -It could be based on patterns -like "When x conditions rise, contamination tends to follow." - -*TODO: in above paragraph, "cases" intents to refer to ANT* - -This hypothesis would come at the cost of a lot of x, -which would be a research question in itself. - -*FIXME: in above paragraph, "x" should say something -about consuming a lot of space and resources* +We have chosen not to involve generative artificial intelligence (AI) +in this project, +due to its scope of data collecting and processing +from a source of simple imitations of living organisms. +Related but different projects might sensibly involve AI, +e.g. training an AI with sensor data from real living mussels, +either unsupervised to aid in discovering behavioural patterns +like CHIGA, +Or in a future +where a (non-AI) domain model for mussel behaviours is established, +an AI could be trained supervised, +i.e. generate an AI model supervised with the use of such domain model, +e.g. to help calibrate sensors. + +This project succesfully demonstrates +that a loosely coupled set of systems can mimic the systems in Poland +where the behaviour of 8 mussels "vote" about the quality of water. +The concrete output, however, +do not reasonably reflect the logic of the Polish systems, +because the mussel simulation is too simplistic in that +a) mussel gape rhythm is simulated as simple linear movements +rather than the steep S-shaped movements of real mussels, +and consequently that b) voting is based on "is gape closed" +rather than the -- with more realistic rhythm -- more telling +"what is the CHIGA pattern", +leading to our setup concluding "bad water quality" fairly randomly. +That said, the code is structured so that it should only require +minimal changes to change the evaluation logic +given more realistic sensor data, +mainly by rewriting the function `alignVotes()` +(see @sec-vote in Appendix). # Conclusion - menna @@ -377,19 +380,17 @@ about consuming a lot of space and resources* \appendix -# Code - -## P5.js sketch `light.js` {.appendix} +# P5.js sketch `light.js` {.appendix} ```{.js include="p5.js/light.js" code-line-numbers="true"} ``` -## Arduino sketch `sensor.js` {.appendix} +# Arduino sketch `sensor.js` {.appendix} ```{.cpp include="Arduino/sensor/sensor.ino" code-line-numbers="true"} ``` -## Arduino sketch `vote.js` {.appendix} +# Arduino sketch `vote.js` {#sec-vote .appendix} ```{.cpp include="Arduino/vote/vote.ino" code-line-numbers="true"} ``` -- cgit v1.2.3