FlexPro
HistoryBase
Engineering
Training
Downloads
FlexPro Support
Knowledge
Community
About us
References
Jobs
General Contact
List Of Retailers
FlexPro Support
EN
DE
FR
Placeholder
Products and Solutions
Support and Downloads
Company
Magazine
Contact Us
Language
MyWeisang

Account settings

Topic

Equal To Operator

Home page Community FPScript Equal To Operator

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33250
    Hendrik 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[i]=1 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 1′
    Elseif GANG[i]=2 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 2′
    Elseif GANG[i]=3 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 3′
    Elseif GANG[i]=4 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 4′
    Elseif GANG[i]=5 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 5′
    Elseif GANG[i]=6 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 6′

    Return turbinendrehzahl[i]
    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

    #33253
    Hendrik 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[i]=1 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 1′
    Elseif GANG[i]=2 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 2′
    Elseif GANG[i]=3 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 3′
    Elseif GANG[i]=4 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 4′
    Elseif GANG[i]=5 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 5′
    Elseif GANG[i]=6 Then
    Turbinendrehzahl[i]=Radwellendrehzahl/’Gang 6′

    Return turbinendrehzahl[i]
    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

    #33251
    Bernhard Kantz
    Participant

    – Use the [b]Equal To Operator (==)[/b] instead of the [b]Assignment Operator (=)[/b] to compare values in FPScript.
    – The [b]Component operator[/b] 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

    #33252
    Bernhard 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.