06-29-2010 01:14 AM
Hello,
I need to compare a signal with itself after (for example) 5 seconds. Is it possible?
I will give an example:
I get a variable in the second 0, then we are now in the second 5, and i want to compare the actual variable (from sec 5) with the variable that i got 5 seconds ago(from sec 0); is it possible?
I used the module delay (Zeitverzögerung) but this module compare the actual signal with itself in the second 5, 10, etc... it not compare the signal that i got 5 seconds ago.
I need this, becuase the signal that i get change so slow and i need to compare it with itself for to control it.
I thank in advance your help.
06-29-2010 08:34 AM
Artur,
Delay should work just fine - it doesn't do the comparison, but it gives you a second signal that you can compare to the original. You can use a variety of modules to look at two signals -- Arithmetic two channel to compute the difference, the Comparator module to compute greater than, less than or equal, or the formula module for more sophisticated math.
Alternately, you could use a Separate Module to reduce your signal to one sample every five seconds, and then use the Arithmetic one channel to compute a running difference, or the Differentiation module to compute the slope.
06-29-2010 09:05 AM
Hallo Arter,
benötigen Sie folgende Algorithmik?
Zeitpunkt [s] neues Signal altes Signal Bemerkungen
0 S1 --- Vergleich nicht möglich da altes Signal nicht vorhanden
5 S2 S1 Vergleiche S2 mit S1
10 S3 S2 Vergleiche S3 mit S2
15 S4 S3 Vergleiche S4 mit S3
20 S5 S4 Vergleiche S5 mit S4
...
Mit freundlichen Grüßen
MHa
06-30-2010 02:17 AM
Hello CJ /Hallo MHa,
Ich werde auf englisch schreiben weil, ich jetzt in Deutschland arbeite aber ich kann besser und mehr flüssig englisch sprechen, (mein Muttersprache ist spanisch) obwohl arbeite ich mit DasyLab auf deutsch...
I attach here a photo of the program that I am doing for to explain it better.
I want that one process works automatically; in this program I get a signal from a sensor (now with a hand controller because I am simulating), and then, I need to compare it with itself, but 5 seconds later (my logic is to get the old signal, from 5 seconds ago, and to wire it up in the entrance (channel 2) of every module “compare”.
When I can get that, I’ll need to do the following:
I need that the output voltage decrease or increase periodically (every second for example), and for this, I use the module “slope restriction” (Steigungsbeschränkung).
Then, in the module “formula interpreter 00” I only make de increment negative (- N(0)). With the “formula interpreter 01 and 02, I add the first voltage (it will be predetermined by the user before the process starts, now 3,2V) with the increase or decrease voltage.
This is the program that I did yesterday, (I am starting with this project).
In resume, with this program the output voltage increase periodically if the sensor voltage increases and the opposite, (I will control a pump with the output voltage).
I will continue with this program, and I will explain a little what I plan to do: my logic is to choose the voltage with more variation and take it like output (I think with math or I don’t know) and if there was not variation in all voltages, to leave the same voltage.
Maybe my logic is so complicated, for to program it in DasyLab, but that’s why I wrote it here because maybe someone have others ideas using easier modules.
Thanks for your help.
06-30-2010 03:26 AM
Hello Arter,
so I also use my "bad" english to help. You can solve this application very compact and stable with Addon Module "VBScript", sale via PREMEGA GmbH -> link under http://www.premega.de/de-02/software_dasylab_vbscript_de.php
Some screen shots for mainpoints from application
Impulsgeber - Sends TTL-High impulse for 2 sample, wait then 5 seconds for next impulse
VB Script
- 2 Input channel (Trigger from Impulsgeber, Your test value source), 2 Output channel (Old value, new value)
- Initial value -1000.0 for old value, first call, old value not available
Best regards,
MHa
06-30-2010 03:38 AM
Hello Arter,
then you can also use a very stable solution to compare the values, based on Addon Module "Bereichsteilung", sale via PREMEGA GmbH.
Some screen shots for mainpoints from additional modules
Variable - Write old and new value into 2 Global Variables.
Bereichsteilung - Set Min and Max with Global Variable value from new value. The module have 4 outputs - value is higher as, same, under, 4. output is not interesting for you
Best regards,
MHa
06-30-2010 04:30 AM
Hello MHa,
Thanks for your help, I will check the links that your attach here, and I continue with my program and if i have an other problem i will write it here, jeje
Thanks again.
Best Regards,
Arter
06-30-2010 07:14 AM
Hallo People,
I changed the logic of my program a little; and now for to finish it, i have only one problem at final,... but for to explain this problem i will open other subject becuase maybe other people can have the same problem as me in the future...
Best Regards and thanks for your help.
Arter
06-30-2010 09:23 AM
Hello Arter,
your post "06-30-2010 02:17 AM" - so many modules for your application. I have extend the VB Script solution for this (Hysteresis is not yet included into the VBScript).
Best regards,
MHa
07-01-2010 12:33 AM
Hello Mha,
Firstly really thanks for your help, its really apreciated.
I downloaded the VBscript yesterday from that page, but i dont know why it did not work...(maybe becuase I did not pay for it, I dont know jeje)... but becuase of that, I changed a little the logic of my program and I found a solution.
Now, I have other problem that i will explain in other theme, becuase maybe other persons will have it as me.
Thanks again for your help.
Best Regards,
Arter