Dear PEAK-Team,
I was wondering how the "if equal" and similar functions work (if less, if greater, etc.): If I understood correctly I can specify the number of functions/line which will be executed if the expression is true. And I am not defining the line number of (one) function block which will be executed:
If I would add 7 to "LinesPerformedIfTrue" the first to the seventh line would be executed and not only the 7th line, correct?
Would you mind to provide a small example how to set a signal value according to a comparison of another signal?
For example if I would have for each of the gear shift signals P,R,N,D, a single bit signal (on/off) and would like to translate it to a 2 bit signal (P = 0, R = 1, N = 2, D = 3). How could I do the comparison & value setting using the "if equal const". Or do you have a more simple solution for this example in mind?
Thank you!
Dominik M.
How to use if equal or similar functions to set signal values?
-
- Posts: 14
- Joined: Mon 27. Jan 2020, 09:58
Re: How to use if equal or similar functions to set signal values?
Hello.
I've made a very simple config using the IF EQUAL function,
You may also try the CHARACTERISTIC CURVE function.
See the function blocks reference manual for this (DVD or homepage)...
I've made a very simple config using the IF EQUAL function,
You may also try the CHARACTERISTIC CURVE function.
See the function blocks reference manual for this (DVD or homepage)...
- Attachments
-
- gearbox.JPG (53.58 KiB) Viewed 4844 times
-
- GearBox.ppproj
- (21 KiB) Downloaded 1708 times
-
- Posts: 14
- Joined: Mon 27. Jan 2020, 09:58
Re: How to use if equal or similar functions to set signal values?
Great,
your example helped me a lot. My mistake was the interpretation of the "PerformedLines" parameter. I thought that from the first (top) function block onwards the specified number of function blocks will be executed and not the following lines of my if function. Another mistake I made was also the function setting (mixed up input with output variable).
Thank you a lot!
your example helped me a lot. My mistake was the interpretation of the "PerformedLines" parameter. I thought that from the first (top) function block onwards the specified number of function blocks will be executed and not the following lines of my if function. Another mistake I made was also the function setting (mixed up input with output variable).
Thank you a lot!