FlexPro Forum – Discuss Your Topic!

Equal To Operator

Home > Community > FPScript > Equal To Operator

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12497
    Hendrik MeyerHendrik Meyer
    Participant

    Hallo, ich hab das alte Probelm lösen können. Wer ahnt auch schon, dass elseif zusammen geschrieben werden muss.

    Allerdings bekomme ich nun die Fehlermeldung “Falscher Datentyp”. Leider kann ich in der Hilfe keine Informationen finden.

    Bitte um Support.

    Dim Turbinendrehzahl, i, Gang, y
    Turbinendrehzahl=0 # 10000
    Gang=Gangpos

    For Each Value i In Vges Do
    If GANG=1 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 1′
    Elseif GANG=2 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 2′
    Elseif GANG=3 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 3′
    Elseif GANG=4 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 4′
    Elseif GANG=5 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 5′
    Elseif GANG=6 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 6′

    Return turbinendrehzahl
    end
    end

    P.S.: Und wie würde es aussehen müssen, wenn Radwellendrehzahl (x ist Zeit, y sind die relevanten Werte) eine Signal anstatt einer Datenreihe wäre?

    Vielen Dank

    #8160
    Hendrik MeyerHendrik Meyer
    Participant

    Hallo, ich hab das alte Probelm lösen können. Wer ahnt auch schon, dass elseif zusammen geschrieben werden muss.

    Allerdings bekomme ich nun die Fehlermeldung “Falscher Datentyp”. Leider kann ich in der Hilfe keine Informationen finden.

    Bitte um Support.

    Dim Turbinendrehzahl, i, Gang, y
    Turbinendrehzahl=0 # 10000
    Gang=Gangpos

    For Each Value i In Vges Do
    If GANG=1 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 1′
    Elseif GANG=2 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 2′
    Elseif GANG=3 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 3′
    Elseif GANG=4 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 4′
    Elseif GANG=5 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 5′
    Elseif GANG=6 Then
    Turbinendrehzahl=Radwellendrehzahl/’Gang 6′

    Return turbinendrehzahl
    end
    end

    P.S.: Und wie würde es aussehen müssen, wenn Radwellendrehzahl (x ist Zeit, y sind die relevanten Werte) eine Signal anstatt einer Datenreihe wäre?

    Vielen Dank

    #8791
    Bernhard KantzBernhard Kantz
    Participant

    – Use the Equal To Operator (==) instead of the Assignment Operator (=) to compare values in FPScript.
    – The Component operator extracts the X, Y- or Z-component from a data set with an aggregate data structure.

    See also the FlexPro Online Help
    Analyzing Data|Reference|FPScript Operators
    Analyzing Data|Reference|Data Access|Component

    support@weisang.com

    #8792
    Bernhard KantzBernhard Kantz
    Participant

    You can do this computation much more efficiently if you use the index operator and event isolation functionality to avoid loops on individual values:

    Dim idx

    // setup data series of proer length
    Dim Turbinendrehzahl = 0. # NumberOfRows(Vges)

    // Find all positions where 1st gear was used
    idx = ValuesInInterval(Gangpos, 1, 1, EVENT_INDEX)
    // set all these postions to a fixed value
    Turbinendrehzahl[idx] = Radwellendrehzahl / 'Gang 1'

    // do the same for the 2nd gear.
    idx = ValuesInInterval(Gangpos, 2, 2, EVENT_INDEX)
    Turbinendrehzahl[idx] = Radwellendrehzahl / 'Gang 2'

    // continue for further gears
    // would "Radwellendrehzahl" and "Gang x" be data series, you could have a loop running across the gears.
    ...

    // return the result
    return Turbinendrehzahl

    support@weisang.com

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.