[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlaplus] PlusCal algorithm for pH for Smart Agriculture



Hello to all,
I am student of PhD in Pakistan.  I have proposed the following algorithm to check pH at every scale but now i want to add some complexity kindly guidance required or provide me some examples according to my problem that I have. 
code is here:
--fair algorithm pHcalculation {
variables
    ph \in 0..14;  \* pH variable ranging from 0 to 14
    classification; \* Variable to store the classification
{
    process:
     \* Check for different pH ranges and assign classification accordingly
    if (ph < 0) {
        classification := "Invalid pH value";
    } else if (ph < 1) {
        classification := "Extremely acidic";
    } else if (ph < 2) {
        classification := "Strongly acidic";
    } else if (ph < 3) {
        classification := "Acidic";
    } else if (ph < 4) {
        classification := "Moderately acidic";
    } else if (ph < 5) {
        classification := "Weakly acidic";
    } else if (ph < 6) {
        classification := "Slightly acidic";
    } else if (ph = 6) {
        classification := "Neutral (water)";
    } else if (ph < 7) {
        classification := "Slightly alkaline";
    } else if (ph < 8) {
        classification := "Weakly alkaline";
    } else if (ph < 9) {
        classification := "Alkaline";
    } else if (ph < 10) {
        classification := "Moderately alkaline";
    } else if (ph < 11) {
        classification := "Strongly alkaline";
    } else if (ph < 12) {
        classification := "Very strongly alkaline";
    } else if (ph < 13) {
        classification := "Extremely alkaline";
    } else if (ph <= 14) {
        classification := "Super alkaline";
    } else {
        classification := "Invalid pH value";
    }
}
}
 ***************************************************************************)
Thanks
Shahbaz Ahmad

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/c7ce1faf-4a9c-4d37-b998-5740dc197284n%40googlegroups.com.