Skip a test loop if first read is false otherwise loop
Moderator: Benj
-
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
- Contact:
Skip a test loop if first read is false otherwise loop
Hi all,
As part of an ongoing thermal control project, I have a flowcode that tests for various valid temperature points and decisions are made depending on value read.
I have set up a macro that reads the ADC 64 times and creates an average Integer value at each pass.
The problem is that the temperature decays are so slow that the program is very indecisive at the thresholds.
I have a variety of decision icons at each temperature thresholds that go and run the temperature read macro.
Problem is, the main loop gets progressively longer at each decision Icon. I want to be able to skip a loop if the first test is false.
Is it possible to trigger a loop count of say 10 loops on the first 'true' reading but skip the loop to the next decision stage if false.
In other words, I have a falling (or rising) voltage at thermistor. I have a 'goto test temperature' macro call........return with value, if value true - test a further 10 times for validity and return a false if validity is not 10x true. If first value tested is false, skip decision icon to next level.
Hope I made this clear
Cheers
Dave
As part of an ongoing thermal control project, I have a flowcode that tests for various valid temperature points and decisions are made depending on value read.
I have set up a macro that reads the ADC 64 times and creates an average Integer value at each pass.
The problem is that the temperature decays are so slow that the program is very indecisive at the thresholds.
I have a variety of decision icons at each temperature thresholds that go and run the temperature read macro.
Problem is, the main loop gets progressively longer at each decision Icon. I want to be able to skip a loop if the first test is false.
Is it possible to trigger a loop count of say 10 loops on the first 'true' reading but skip the loop to the next decision stage if false.
In other words, I have a falling (or rising) voltage at thermistor. I have a 'goto test temperature' macro call........return with value, if value true - test a further 10 times for validity and return a false if validity is not 10x true. If first value tested is false, skip decision icon to next level.
Hope I made this clear
Cheers
Dave
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
HI,
What you said should not be impossible, can you please post the latest program and give the hint which portion you need to speed up.
What you said should not be impossible, can you please post the latest program and give the hint which portion you need to speed up.
-
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
Hi Enamul,
It's more important that I create this 'hysteresis' method that does not carry out unnecessary tests....I'm sure you can see what I mean.
The ability to skip a test if the value is nowhere near but test multiple times if first value is true......is a great way to keep speed consistency within a control loop.....at least in my mind it is......lol
The program works great on my test setup but the final product will have much more slowly moving adc value and I don't want the program to be jittery at the different transition temperatures.
The overall loop needs to be quite fast so that I can incorporate all my different led patterns without slowing them down or without them slowing the program down too much.
I would like to add this verification or skip process at each decision icon in the main loop.
Dave
It's more important that I create this 'hysteresis' method that does not carry out unnecessary tests....I'm sure you can see what I mean.
The ability to skip a test if the value is nowhere near but test multiple times if first value is true......is a great way to keep speed consistency within a control loop.....at least in my mind it is......lol
The program works great on my test setup but the final product will have much more slowly moving adc value and I don't want the program to be jittery at the different transition temperatures.
The overall loop needs to be quite fast so that I can incorporate all my different led patterns without slowing them down or without them slowing the program down too much.
I would like to add this verification or skip process at each decision icon in the main loop.
Dave
- Attachments
-
- HeaterControl_eval20.fcf
- (17.29 KiB) Downloaded 348 times
-
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
For example....the first icon.
- IF ((DegC>954)||(DegC<250))
False = skip to next decision icon.
True = test another 10 times.............if true for the 10 times = then true........if true for <10 times......then false at first fail - skip to next decision.
Decision is YES only if condition satisfied for the 10 times loop - take YES branch
Decision is NO if first test is false......OR if further tests in the loop read false.....then skip to next test icon........
clear I hope
Dave
- IF ((DegC>954)||(DegC<250))
False = skip to next decision icon.
True = test another 10 times.............if true for the 10 times = then true........if true for <10 times......then false at first fail - skip to next decision.
Decision is YES only if condition satisfied for the 10 times loop - take YES branch
Decision is NO if first test is false......OR if further tests in the loop read false.....then skip to next test icon........
clear I hope
Dave
-
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
Put another way.
If first test is true - start to test another 10 times in a loop.
If on 5th (or 6th, 7th etc.) loop - fail is detected - exit loop and skip to next test.
This might be easier to understand..
Dave
If first test is true - start to test another 10 times in a loop.
If on 5th (or 6th, 7th etc.) loop - fail is detected - exit loop and skip to next test.
This might be easier to understand..
Dave
-
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
Hi all,
I think I solved it.........what do you think of this method..
And, doing it this way, I get to re-use the count variable for the next stage....
Basically, I don't want the program to waste time testing until the first 'true' value is present at first test.......but if first value is true, then test to make sure it's true 10 more times before returning a YES to the overall decision...... am I right?
Dave
I think I solved it.........what do you think of this method..
And, doing it this way, I get to re-use the count variable for the next stage....
Basically, I don't want the program to waste time testing until the first 'true' value is present at first test.......but if first value is true, then test to make sure it's true 10 more times before returning a YES to the overall decision...... am I right?
Dave
- Attachments
-
- verify or skip.PNG
- (26.68 KiB) Downloaded 4423 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
Yes, I guess you get this. If you have initialized count already before loop and tested for it to be 10 but skip if found logic false..
You are learning fast
You are learning fast
-
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
Actually, just decided this doesn't work.
I need a decision of 'satisfied condition' OR ' NOT satisfied condition when loop exits..........not during each pass of the loop.
hmmmm......close but not quite there..
Dave
I need a decision of 'satisfied condition' OR ' NOT satisfied condition when loop exits..........not during each pass of the loop.
hmmmm......close but not quite there..
Dave
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
What did you mean by that?I need a decision of 'satisfied condition' OR ' NOT satisfied condition when loop exits..........not during each pass of the loop.
-
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
Hi,
I finally got it............seems complex but works in simulation well.
If anyone can spot anything wrong, please let me know.
Dave
I finally got it............seems complex but works in simulation well.
If anyone can spot anything wrong, please let me know.
Dave
- Attachments
-
- verify or skip.PNG
- (32.87 KiB) Downloaded 1721 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
So you mean you don't want to have LED pattern if condition becomes false in 1 to 10 count..only after count =10 you will give that certificate..if that's the idea..it's doing that perfectly.
-
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
- Contact:
Re: Skip a test loop if first read is false otherwise loop
Hi Enamul......totally correct........this idea is to make certain that the threshold is definite and not just a transient.
Dave
Dave