-
FlexPro
- Auf einen Blick
- Features & Optionen
- Einsatzgebiete
- Alle Vorteile
- Neu in FlexPro 2021
- FlexPro gratis testen
- FlexPro View OEM Freeware
- Kaufberatung
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
- Produkte
- News
- Support
- Unternehmen
- Jobs
- Kontakt
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
if condition
- Dieses Thema hat 8 Antworten sowie 2 Teilnehmer und wurde zuletzt vor vor 18 Jahren von Dirk Kampffmeyer aktualisiert.
-
AutorBeiträge
-
November 30, 2006 um 2:42 am Uhr #12506Dirk KampffmeyerTeilnehmer
I have serious problems to implement `if` conditions. For instance I have to calculate dewpoints which is not any obstacle, but afterwards I attempt to sum these dewpoints up to partial pressures and it doesn`t work. To illustrate my problem I give the program code:
dim tau,pv,i,s,ppm
For Each Row i In CH1 Do
tau=ch1.Y/2*130-110 // dewpoint
if tau<0 then
pv=611.15*exp(22.542*tau/(tau+273.48)); // partial pressure
else
pv=611.21*exp(17.502*tau/(240.97+(tau*65-110)));
end
ppm=pv/101325*10^6end
November 30, 2006 um 2:42 am Uhr #8169Dirk KampffmeyerTeilnehmerI have serious problems to implement `if` conditions. For instance I have to calculate dewpoints which is not any obstacle, but afterwards I attempt to sum these dewpoints up to partial pressures and it doesn`t work. To illustrate my problem I give the program code:
dim tau,pv,i,s,ppm
For Each Row i In CH1 Do
tau=ch1.Y/2*130-110 // dewpoint
if tau<0 then
pv=611.15*exp(22.542*tau/(tau+273.48)); // partial pressure
else
pv=611.21*exp(17.502*tau/(240.97+(tau*65-110)));
end
ppm=pv/101325*10^6end
November 30, 2006 um 3:55 am Uhr #8806Bernhard KantzTeilnehmerYou have forgotten to return the result:
For ... End ppm //or return ppm
But in this case the result is only the ppm of the last value. If you want to calculate the ppm of each value try this
Dim tau = ch1.Y/2*130-110 // dewpoint Dim idxAbove = ValuesAboveLevel(tau, 0, EVENT_INDEX) tau = 611.15*exp(22.542*tau/(tau+273.48)) // partial pressure tau[idxAbove] = 611.21*exp(17.502*tau[idxAbove]/(240.97+(tau[idxAbove]*65-110))) tau/101325*10^6
FPScript is a vectorial script language. Therefore you need no loop to manipulate the whole signal.
Dezember 2, 2006 um 1:30 am Uhr #8807Dirk KampffmeyerTeilnehmerThank you for your support. The formula is working rather well, but if the signal is rising up to 1.7 the results become too high.
Signal:
21 1,68925
22 1,71725
23 1,7133125
24 1,735625
25 1,732875
26 1,736
27 1,7446875
28 1,7549375
29 1,758875
30 1,7646875
31 1,7715625
32 1,7709375
33 1,769125
34 1,77425
35 1,770125
36 1,76425
37 1,7693125
38 1,77175
39 1,7569375
40 1,762
41 1,7371875
42 1,7355
43 1,7155625
44 1,692125
Results:
21 5933,50484
22 2696401011
23 2514035768
24 3697558728
25 3530971112
26 3720759050
27 4291879038
28 5053249400
29 5372463216
30 5872151797
31 6508674208
32 6448717840
33 6277230852
34 6771345639
35 6371406764
36 5833334034
37 6294807061
38 6526743852
39 5213478477
40 5636824868
41 3795002615
42 3689851293
43 2616946068
44 6025,680376I really do not know what the formula sums up.
Code:
Dim tau = ch1.Y/2*130-110 // dewpoint
Dim idxAbove = ValuesAboveLevel(tau, 0, EVENT_INDEX)
tau = 611.15*exp(22.542*tau/(tau+273.48)) // partial pressure
tau[idxAbove] = 611.21*exp(17.502*tau[idxAbove]/(240.97+(tau[idxAbove])))
tau/101325*10^6Dezember 2, 2006 um 1:48 am Uhr #8808Bernhard KantzTeilnehmerUse
tau[idxAbove] = 611.21*exp(17.502*tau[idxAbove]/(240.97+(tau[idxAbove]*65-110)))
instead of
tau[idxAbove] = 611.21*exp(17.502*tau[idxAbove]/(240.97+(tau[idxAbove])))
Dezember 4, 2006 um 8:35 pm Uhr #8809Dirk KampffmeyerTeilnehmerThe problem, however, is that I modified my formula. That is why I need the new one:
tau[idxAbove] = 611.21*exp(17.502*tau[idxAbove]/(240.97+(tau[idxAbove])))
I sumed it up by my calculator and there was not such high figure as result.Dezember 4, 2006 um 10:54 pm Uhr #8810Bernhard KantzTeilnehmerThe code “tau = …” changes all tau values. Therefore the next line uses the wrong values to calculate the values above 0.
Use the IndexNot function to calculate the indices of tau values below 0.
Dim tau = ch1.Y/2*130-110 Dim idxAbove = ValuesAboveLevel(tau, 0, EVENT_INDEX) Dim idxBelow = IndexNot(idxAbove, NumberOfRows(ch1)) tau[idxBelow] = 611.15*exp(22.542*tau[idxBelow]/(tau+273.48)) tau[idxAbove] = 611.21*exp(17.502*tau[idxAbove]/(240.97+(tau[idxAbove]))) tau/101325*10^6
Dezember 5, 2006 um 1:56 am Uhr #8811Dirk KampffmeyerTeilnehmerHello,
first of all I would like to thank you. Now I have a last request: I would like to search the maximum of the signal and let the program sum it up from this maximum.
dim tau = ch1.y/2*130-110
Dim idxAbove = ValuesAboveLevel(tau, 0, EVENT_INDEX)
Dim idxBelow = IndexNot(idxAbove, NumberOfRows(ch1))
tau[idxBelow] = 611.15*exp(22.542*tau[idxBelow]/(tau[idxBelow]+273.48))
tau[idxAbove] = 611.21*exp(17.502*tau[idxAbove]/(240.97+tau[idxAbove]))
tau/101325*10^6Dezember 5, 2006 um 2:43 am Uhr #8812Bernhard KantzTeilnehmerYou can use the Maximum-function to calculate the maximum of the signal. You find all FPScript functions in the function wizard.
See also the FlexPro Online Help.
-
AutorBeiträge
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.