# This file contains Application runtime attributes
# Phil Tobin

# Colors all stored in RGB i.e. 
# normally only for System use unless you wish to add colors

defaultLookAndFeelClass=com.formdev.flatlaf.intellijthemes.FlatCobalt2IJTheme

white= -1
black=-16777216
dark_blue=-16777038
blue=-16776961
yellow=-256
dark_green=-16731648
green=-16711936
red=-65536
dark_red=-5111808
dark_gray=-10921639
gray=-8355712
lightGray=-1381668
cyan=-16711681
magenta=-65281
pink=-20561
orange=-14336

# You can set to any of the colors defined above
graphForeColor0=white
graphForeColor1=red
graphForeColor2=green
graphForeColor3=yellow
graphForeColor4=white
graphForeColor5=red
graphForeColor6=green
graphForeColor7=yellow
graphForeColor8=white
graphForeColor9=red
graphForeColor10=green
graphForeColor11=yellow
graphForeColor12=white
graphForeColor13=red
graphForeColor14=green
graphForeColor15=yellow

backColor=lightGray
foreColor=black
graphBackColor=black
graphFontColor=cyan


# default Graphs
graph0.0=Field.RPM
graph0.1=Field.MAP
graph0.2=Field.TPS
graph0.3=Field.speedMPH
graph1.0=Field.AFR
graph1.1=Field.AFR2
graph1.2=Field.afrTarget
graph1.3=Field.iacPosition
graph2.0=Field.coolantTemp
graph2.1=Field.MAT
graph2.2=Field.ignitionAdv
graph2.3=Field.ignitionAdv2
graph3.0=Field.pulseWidth
graph3.1=Field.pulseWidth2
graph3.2=Field.ve
graph3.3=Field.ve2


FIELD_GROUP_NAME_Tuning=0
FIELD_SELECTED_GROUP_Tuning_graph0.0=Field.RPM
FIELD_SELECTED_GROUP_Tuning_graph0.1=Field.MAP
FIELD_SELECTED_GROUP_Tuning_graph0.2=Field.TP
FIELD_SELECTED_GROUP_Tuning_graph0.3=Field.pulseWidth
FIELD_SELECTED_GROUP_Tuning_graph1.0=Field.coolantTemp
FIELD_SELECTED_GROUP_Tuning_graph1.1=Field.MAT
FIELD_SELECTED_GROUP_Tuning_graph1.2=Field.speedMPH
FIELD_SELECTED_GROUP_Tuning_graph1.3=Field.AFR
FIELD_SELECTED_GROUP_Tuning_graph2.0=Field.DutyCycle1
FIELD_SELECTED_GROUP_Tuning_graph2.1=Field.Dwell
FIELD_SELECTED_GROUP_Tuning_graph2.2=Field.ignitionAdv
FIELD_SELECTED_GROUP_Tuning_graph2.3=Field.egoCorrection
FIELD_SELECTED_GROUP_Tuning_graph3.0=Field.ve
FIELD_SELECTED_GROUP_Tuning_graph3.1=Field.O2Volts
FIELD_SELECTED_GROUP_Tuning_graph3.2=Field.ve
FIELD_SELECTED_GROUP_Tuning_graph3.3=Field.batteryVoltage



#Number of selectors and max number of graphs
numberOfGraphs=4
numberOfOverlayGraphs=4
numberOfOverlays=4

# The file delimiter options
APP_OPTION_delimiter=File Delimiter
delimiter_OPTIONS=Auto Detect;Tab;Pipe |;Comma ,;CSV with double Quotes ",";CSV w/ double Quotes 2 ", "; Quote ';Semicolon <semi>;Space ' ';Other Delimiter;
delimiter_SOLUTIONS=Auto;\t;|;,;",";", ";';<semi>;\ ;Other;

# default Delimiter
DEFAULT_delimiter=Auto


# The FieldMappings options
APP_OPTION_fieldMapping=Field\ Naming\ (ECU)
fieldMapping_OPTIONS=Auto\ Detect;MegaSquirt;MegaSquirt\ MS3\ Sequential;MS3 1.2 / MS3 Pro;MS3 1.3+\ MS2 3.3+\ / MS3 Pro;Buell;TCFI;Twin\ Scan;eecAnalyzer BE;DTA S80;Fuel\ Monster;
fieldMapping_SOLUTIONS=Auto;FieldMaps/MegaSquirt.properties;FieldMaps/MS3Seq.properties;FieldMaps/MS3_1.2.properties;FieldMaps/MS3_1.3.properties;FieldMaps/Buell.properties;FieldMaps/TCFI.properties;FieldMaps/TwinScan.properties;FieldMaps/eecAnalyzerBE.properties;FieldMaps/DtaS80.properties;FieldMaps/PWMonster.properties;


# default Delimiter
DEFAULT_fieldMapping=Auto

# file extensions
fileExtensions=msl;mlg;xls;log;dif;csv;dat;msq;

TABLE_GEN_VIEW_Current\ View=16^|^16^|^0^|^1^|^2^|^Field.RPM^|^Field.MAP^|^Field.AFR^|^Field.targetAFR^|^501,800.0,1100,1400.0,2000.0,2600.0,3100.0,3700.0,4300.0,4900.0,5400.0,6000.0,6500.0,7000.0,7200.0,7500^|^100,95,90,85,80,75,70,65,60,55,50,45,40,35,25,15


#Mappings use these to apply formulas to alter data
#remove for raw data
RPM_FORMULA=logVal*100


#######################  VE Table generation parameters #############
# this is the name used in the formula to reference the current table value
DEFINE_CURRENT_CELL_VALUE=cellValue
# this is the name used in the formula to reference the target AFR table value
DEFINE_CURRENT_AFR_VALUE=afrValue
DEFINE_INTERPOLATED_CELL_VALUE=cellInterpolated
DEFINE_AFR_RECORD_OFFSET_VALUE=WBafrOffSet

#default afr offset
WBafrOffSet=1

# Minimum total weight before a calculated value will be used.
# valid values are 0.0 - as high as you want to go.
veAnalysisWeightThreshold=0.0

#minimum weight for an individual hit before it would be used toward a calculated value.
# Valid values 0.0-1.0, at 1.0 or greater, nothing will be counted.
veAnalysisWindowThreshold=0.0



# Min RPM's to include in VE Analysis, below this will be filtered
veAnalysisMinRPM=500
# Max RPM included in VE Analysis, Log entries with RPM above this will not be used in VE Analysis
# To filter rev limiter hits.
veAnalysisMaxRPM=18500

# list of tables to be loaded into table editor
tableLoadList=veTable,veBins1,veBins2,veBins3,advTable1,advTable2,afrTable,afrBins1,afrBins2,advanceTable,advanceTable1,advanceTable2,advanceTable3,veTable1,veTable2,veTable3,veTable4,afrTable1,afrTable2,afrTable3,alphaMAPtable,xTauTable,veTable1dozen,veTable3dozen,veTable2dozen,lambdaTable,sparkTable,pwBTable1,pwBTable2,pwATable1,pwATable2,afrBTable1,afrBTable2,afrATable1,afrATable2




#######################  Formula Groups will append one of many #############

# FORMULA_GROUP_ used as prefix to define any formula set where
# only one should be selected at a time.
# list all 3, group, options and solutions
# The remaining piece after the FORMULA_GROUP_ prefix will display on the application menu
# _Options will display as single select sub menu items separate by ;
# _SOLUTIONS contains the formula mapping file to apply, separated by ;
# for file mapping give inc file and field separated by |
# you can apply further calculation if needed

FORMULA_GROUP_AFR=Wideband\ O2-AFR
AFR_OPTIONS=Off;Innovate\ 0-5V\ (10:1-20:1);Innovate\ 1-2V;Innovate\ LC-1\ Default;TechEdge-DIY;TechEdge\ Linear;AEM\ Linear\ (Most\ Current);AEM\ Linear Older;AEM\ Non\ Linear;Zeitronix;Dynojet\ Linear;NGK\ Powerdex;Custom Linear;
AFR_SOLUTIONS=\ ;[Field.O2Volts]*2+10;[Field.O2Volts]*10;[Field.O2Volts]*2.94+7.35;[Field.O2Volts|TechEdge_DIYwbo2.inc];[Field.O2Volts]*2+9;[Field.O2Volts]*2.375+7.3125;[Field.O2Volts]*1.97195+9.72;[Field.O2Volts|aemWBo2.inc];[Field.O2Volts|zeitronix.inc];[Field.O2Volts]*1.6+10;[Field.O2Volts]*1.4+9;{AFR at Low Voltage} < {AFR at High Voltage} ? {AFR at Low Voltage}+(([Field.O2Volts]-{Low Voltage})*({AFR at High Voltage}-{AFR at Low Voltage})/({High Voltage}-{Low Voltage})) : {AFR at Low Voltage}-(([Field.O2Volts]-{Low Voltage})*({AFR at Low Voltage}-{AFR at High Voltage})/({High Voltage}-{Low Voltage}));
# default value
DEFAULT_APPEND_FIELD_AFR=\ 

FORMULA_GROUP_Lambda=Wideband\ O2-Lambda
Lambda_OPTIONS=Off;Innovate\ 0-5V\ (10:1-20:1);Innovate\ 1-2V;Innovate\ LC-1\ Default;TechEdge-DIY;TechEdge\ Linear;AEM\ Linear\ (Most\ Current);AEM\ Linear Older;AEM\ Non\ Linear;Zeitronix;Dynojet\ Linear;
Lambda_SOLUTIONS=\ ;([Field.O2Volts]*2+10)/14.7;([Field.O2Volts]10)/14.7;([Field.O2Volts]*0.2+0.5);[Field.O2Volts|TechEdge_DIYwbo2.inc]/14.7;([Field.O2Volts]*2+9)/14.7;([Field.O2Volts]*2.375+7.3125)/14.7;([Field.O2Volts]*1.97195+9.72)/14.7;([Field.O2Volts|aemWBo2.inc])/14.7;[Field.O2Volts|zeitronix.inc]/14.7;([Field.O2Volts]*1.6+10)/14.7;
# default value
DEFAULT_APPEND_FIELD_Lambda=\

# MAF Group .... Need more mapping files if you have them.
FORMULA_GROUP_Air\ Flow=Mass Air Flow
Air\ Flow_OPTIONS=Off;Ford MAF;
Air\ Flow_SOLUTIONS=\ ;[MAF Volts|MAF_Volts_AirFlow.inc];
# default Value
DEFAULT_APPEND_FIELD_Air\ Flow=\


############# Replace Field ################################################
##########  This is now done with Group Field.which append
# Innovate 0-5 WB formula
# Example for field replacement
# This would replace the O2 field with a calculated field AFR
#O2_NAME=AFR
#AFR_FORMULA=logVal*2+10


# Uses external map file to transform MAF Volt to Air Flow
# "MAF Volts" will be remapped to the value it maps to for
# Air Flow in MAF_Volts_AirFlow.inc
#MAF\ Volts_NAME=Air Flow
#Air\ Flow_MAP_FILE=MAF_Volts_AirFlow.inc

#TP replace with raw
#TP_FORMULA=({Maximum TPS ADC}-{Minimum TPS ADC})*logVal/100+{Minimum TPS ADC Again}
#TP_FORMULA=(201-41)*logVal/100+41


################ Sample Filters ####################################
# These filters will be loaded if there are no other filters. 
DATA_FILTER_Idle\ Range=[Field.TP] == 0 && [Field.RPM] <1000 ;Filter to identify and remove data while at idle
DATA_FILTER_Cold=[Field.coolantTemp] < 160 ;Filter to identify and remove data when coolant temperature is below 160 degrees
DATA_FILTER_RPM\ Change= abs([Field.RPM] - [RPM-4]) > ([Field.RPM] * 0.05);Filter any data where the engine is experiencing a change in RPM greater than 5%, likely a transient point
DATA_FILTER_Transients= (abs([Field.RPM] - [RPM-4]) > ([Field.RPM] * 0.10) ) || (abs([Field.TP] - [Field.TP-4]) > 5 )  || (abs([Field.MAP] - [Field.MAP-4]) > ([Field.MAP] * 0.15) )  ;Any data where the engine is going through transient conditions


#################  Sample Append field functions    ##################
# if uncommented here, these will show on the Calculate Field.--> Optional Fields
# menu. You then enable there.

# Append field functionality
# Append a field with true PW, subtracking open time
APPEND_FIELD_PW-1=[Field.pulseWidth]-1

# Append field functionality
# Calculate change in RPM
#APPEND_FIELD_deltaRPM=[Field.RPM]-[Field.RPM-1]

# Append field functionality
# Calculate Time between log records
APPEND_FIELD_deltaTime=[Field.Time]-[Field.Time-1]

# Append field functionality
# Calculate RPM per Sec, engine acceleration rate
# Compound formula
APPEND_FIELD_RPM/Sec=([Field.RPM]-[Field.RPM-1])/([Field.Time]-[Field.Time-1])

APPEND_FIELD_TP\ ADC=([Field.TP]/100)*({Maximum TPS ADC}-{Minimum TPS ADC})+{Minimum TPS ADC}

SUB_FORMULA_TP_VOLT=(([Field.TP]/100)*({Maximum TPS ADC}-{Minimum TPS ADC})+{Minimum TPS ADC})*5/{Max ADC count, 255 for MS1, 1023 for MS2 & MS3}
SUB_FORMULA_TP_VOLT2=(([Field.TP-1]/100)*({Maximum TPS ADC}-{Minimum TPS ADC})+{Minimum TPS ADC})*5/{Max ADC count, 255 for MS1, 1023 for MS2 & MS3}
APPEND_FIELD_TPdot=(SUB_FORMULA(TP_VOLT)-SUB_FORMULA(TP_VOLT2))/([Field.Time]-[Field.Time-1])

# For tuning map based accel enrich
APPEND_FIELD_MAPdot=([Field.MAP]-[Field.MAP-1])/([Field.Time]-[Field.Time-1])


# adds Vacuum in inHg
#Enter your typical starting kpa for the constant "97" which represents
# engine off kpa MAP reading.
# a more typical kpa is ~97 kpa depending on your elavation and weather.
# Change the 97 to your engine off MAP reading
# and uncomment the following 2 lines
APPEND_FIELD_VAC(inHg)=0-({Engine off MAP pressure in KPA}-[Field.MAP])*0.29536

# adds new Boost(psi) field.
# Vacuum will show as negative boost
# Change the 97 to your engine off MAP reading
# and uncomment the following 2 lines
APPEND_FIELD_Boost(psi)=([Field.MAP]-{Engine off MAP pressure in KPA})*0.145113524

APPEND_FIELD_Boost-Vac=[Field.MAP]>{Engine off MAP pressure in KPA} ? ([Field.MAP]-{Engine off MAP pressure in KPA})*0.145113524  : 0-({Engine off MAP pressure in KPA} -[Field.MAP])*0.29536


APPEND_FIELD_TP\ ADC=({Maximum TPS ADC}-{Minimum TPS ADC})*[Field.TP]/100+{Minimum TPS ADC}

#The original Andy Whittle fomula
#APPEND_FIELD_Fuel\ Flow=([Field.pulseWidth]-{Injector Opening Time})*[Field.RPM]*{Alternating(enter 0.5) or Simultaneous (enter 1)}*{Number of Squirts}/1200

#MAF calculation for Air Flow
APPEND_FIELD_Mass\ Air\ Flow=[Field.AFR]* 0.126*(([Field.pulseWidth]-{Injector Opening Time in ms})*[Field.RPM]*{Squirts Per 720 crank degrees, each injector}/1200)*{Injector Size in lb/hr}*{Number of Injectors or Cyl}/100

# Duty cycles
#DC = RPM * NPC * PW / 60000
APPEND_FIELD_Duty\ Cycle1=[Field.pulseWidth]*[Field.RPM]*{Number of Squirts per engine revolution (Usually 0.5 or 1.0)}/600
APPEND_FIELD_Duty\ Cycle2=[Field.pulseWidth2]*[Field.RPM]*{Number of Squirts per engine revolution (Usually 0.5 or 1.0)}/600

#This one gives total fuel consumption in lbs/hr or cc/min
APPEND_FIELD_Fuel\ Flow = SUB_FORMULA(FuelFlow)
SUB_FORMULA_FuelFlow=(([Field.pulseWidth]-{Injector Opening Time in ms, usually about 1.0})*[Field.RPM]*{Squirts Per 720 crank degrees, each injector}/1200)*{Injector Size}*{Number of Cylinders/Injectors}/100
APPEND_FIELD_Fuel\ Flow/1000\ RPM=(([Field.pulseWidth]-{Injector Opening Time in ms, usually about 1.0})*[Field.RPM]*{Squirts Per 720 crank degrees, each injector}/1200)*{Injector Size}*{Number of Injectors or Cyl}*10/[Field.RPM]


APPEND_FIELD_Instant\ MPG=[Field.pulseWidth] == 0 ? 99 : SUB_FORMULA(MPH)/SUB_FORMULA(GPH)
SUB_FORMULA_MPH=({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission gear ratio})
SUB_FORMULA_GPH=(([Field.pulseWidth]-{Injector Opening Time in ms, usually about 1.0})*[Field.RPM]*{Squirts Per 720 crank degrees, each injector}/1200)*{Injector Size (lb/hr)}*{Number of Injectors or Cyl}/600


APPEND_FIELD_MPH\ 1st\ Gear=({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 1st gear ratio})
APPEND_FIELD_MPH\ 2nd\ Gear=({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 2nd gear ratio})
APPEND_FIELD_MPH\ 3rd\ Gear=({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 3rd gear ratio})
APPEND_FIELD_MPH\ 4th\ Gear=({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 4th gear ratio})
APPEND_FIELD_MPH\ 5th\ Gear=({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 5th gear ratio})
APPEND_FIELD_MPH\ 6th\ Gear=({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 6th gear ratio})

APPEND_FIELD_KPH\ 1st\ Gear=({Tire Diameter(cm)}*[Field.RPM])/(531.1788*{Final Drive Ratio}*{Transmission 1st gear ratio})
APPEND_FIELD_KPH\ 2nd\ Gear=({Tire Diameter(cm)}*[Field.RPM])/(531.1788*{Final Drive Ratio}*{Transmission 2nd gear ratio})
APPEND_FIELD_KPH\ 3rd\ Gear=({Tire Diameter(cm)}*[Field.RPM])/(531.1788*{Final Drive Ratio}*{Transmission 3rd gear ratio})
APPEND_FIELD_KPH\ 4th\ Gear=({Tire Diameter(cm)}*[Field.RPM])/(531.1788*{Final Drive Ratio}*{Transmission 4th gear ratio})
APPEND_FIELD_KPH\ 5th\ Gear=({Tire Diameter(cm)}*[Field.RPM])/(531.1788*{Final Drive Ratio}*{Transmission 5th gear ratio})
APPEND_FIELD_KPH\ 6th\ Gear=({Tire Diameter(cm)}*[Field.RPM])/(531.1788*{Final Drive Ratio}*{Transmission 6th gear ratio})

#APPEND_FIELD_mph\ 1=[Field.speedKPH]/1.6093
#APPEND_FIELD_kph\ 1=[Field.speedMPH]*1.6093

APPEND_FIELD_MAP\ X\ RPM = [Field.MAP] * [Field.RPM]
APPEND_FIELD_PowerPercent = 10 * sqrt([Field.TP])

# HP & TQ for VSS
SUB_FORMULA_acclHpKph= smoothFiltered(accelHp(smoothFiltered([Field.KPH]*0.621), (smoothFiltered(0.621*[Field.KPH])-smoothFiltered(0.621*[Field.KPH-1])), [Field.Time]-[Field.Time-1], {Weight of Vehicle (kg)}*2.2))
SUB_FORMULA_aeroDragKph= aerodynamicDragHp(smoothFiltered(0.621*[Field.KPH])* 0.44704, 1.2041, { Aerodynamic Drag Coefficient}, {Vehicle Frontal Area (m^2)} )
SUB_FORMULA_roadDragKph= rollingDragHp(smoothFiltered(0.621*[Field.KPH]), {Tire Pressure(kPa)}/6.8948, {Weight of Vehicle (kg)}*2.2)

APPEND_FIELD_HP\ KPH=SUB_FORMULA(acclHpKph) + SUB_FORMULA(aeroDragKph) + SUB_FORMULA(roadDragKph)
APPEND_FIELD_TQ\ KPH=(5252*(SUB_FORMULA(acclHpKph) + SUB_FORMULA(aeroDragKph) + SUB_FORMULA(roadDragKph)))/[Field.RPM]
#APPEND_FIELD_HP\ KPH=[Field.TP]<{Min TP to calculate for} ? 0 : ({Weight of Vehicle}/32)*(SUB_FORMULA(VSSV2_kph)-SUB_FORMULA(VSSV1_kph))/SUB_FORMULA(TIME_DELTA)*(SUB_FORMULA(VSSV2_kph))/550
#APPEND_FIELD_TQ\ KPH=[Field.TP]<{Min TP to calculate for} ? 0 : ({Weight of Vehicle}/32)*(SUB_FORMULA(VSSV2_kph)-SUB_FORMULA(VSSV1_kph))/SUB_FORMULA(TIME_DELTA)*(SUB_FORMULA(VSSV2_kph))/550*5250/([Field.RPM]+[Field.RPM-1]/2)
#Where
SUB_FORMULA_VSSV2_kph=((([Field.KPH]+[Field.KPH-2])/2)*1.46667)/1.6093
SUB_FORMULA_VSSV1_kph=((([Field.KPH-4]+[Field.KPH-5])/2)*1.46667)/1.6093

SUB_FORMULA_acclHp= smoothFiltered(accelHp(smoothFiltered([Field.speedMPH]), (smoothFiltered([Field.speedMPH])-smoothFiltered([Field.speedMPH-1])), smoothFiltered([Field.Time]-[Field.Time-1]), {Weight of Vehicle (lbs)}))
SUB_FORMULA_aeroDrag= aerodynamicDragHp(smoothFiltered([Field.speedMPH])* 0.44704, 1.2041, { Aerodynamic Drag Coefficient}, {Vehicle Frontal Area (ft^2)} / 10.7639104)
SUB_FORMULA_roadDrag= rollingDragHp(smoothFiltered([Field.speedMPH]), {Tire Pressure(psi)}, {Weight of Vehicle (lbs)})

APPEND_FIELD_Accel\ HP= SUB_FORMULA(acclHp)
APPEND_FIELD_AerodynamicDrag= SUB_FORMULA(aeroDrag)
APPEND_FIELD_Road\ Drag= SUB_FORMULA(roadDrag)

#
APPEND_FIELD_HP= SUB_FORMULA(acclHp) + SUB_FORMULA(aeroDrag) + SUB_FORMULA(roadDrag)
#APPEND_FIELD_VSS\ HP=[Field.TP]<{Min TP to calculate for} ? 0 : smoothBasic(({Weight of Vehicle}/32)*(SUB_FORMULA(VSSV2)-SUB_FORMULA(VSSV1))/SUB_FORMULA(TIME_DELTA)*(SUB_FORMULA(VSSV2))/550, 5)
APPEND_FIELD_TQ= (5252*(SUB_FORMULA(acclHp) + SUB_FORMULA(aeroDrag) + SUB_FORMULA(roadDrag)))/[Field.RPM]
#APPEND_FIELD_VSS\ TQ=[Field.TP]<{Min TP to calculate for} ? 0 : smoothBasic(({Weight of Vehicle}/32)*(SUB_FORMULA(VSSV2)-SUB_FORMULA(VSSV1))/SUB_FORMULA(TIME_DELTA)*(SUB_FORMULA(VSSV2))/550*5250/([Field.RPM]+[Field.RPM-1]/2), 5)
#Where
SUB_FORMULA_VSSV2=(([Field.speedMPH]+[Field.speedMPH-2])/2)*1.46667
SUB_FORMULA_VSSV1=(([Field.speedMPH-4]+[Field.speedMPH-5])/2)*1.46667

#APPEND_FIELD_TestDSpeed = isNan(SUB_FORMULA(V1)) ? 0 : (SUB_FORMULA(V2) - SUB_FORMULA(V1)) * 0.681818
SUB_FORMULA_acclHpRpm= smoothFiltered(accelHp(smoothFiltered(SUB_FORMULA(V2) * 0.681818),  0.681818 * (smoothFiltered(SUB_FORMULA(V2))-smoothFiltered(SUB_FORMULA(V1))), ([Field.Time]-[Field.Time-1]), {Weight of Vehicle (lbs)}))
SUB_FORMULA_aeroDragRpm= aerodynamicDragHp(smoothFiltered(SUB_FORMULA(V2))* 0.3048, 1.2041, { Aerodynamic Drag Coefficient}, {Vehicle Frontal Area (ft^2)} / 10.7639104)
SUB_FORMULA_roadDragRpm= rollingDragHp(smoothFiltered(SUB_FORMULA(V2)* 0.681818), {Tire Pressure}, {Weight of Vehicle (lbs)})

APPEND_FIELD_TQ\ RPM= [Field.TP]<{Min TP to calculate for} || isNan(SUB_FORMULA(V1)) ? 0 : (5252*(SUB_FORMULA(acclHpRpm) + SUB_FORMULA(aeroDragRpm) + SUB_FORMULA(roadDragRpm)))/[Field.RPM]
APPEND_FIELD_HP\ RPM= [Field.TP]<{Min TP to calculate for} || isNan(SUB_FORMULA(V1)) ? 0 : SUB_FORMULA(acclHpRpm) + SUB_FORMULA(aeroDragRpm) + SUB_FORMULA(roadDragRpm)
#Where
SUB_FORMULA_V2=({Tire Diameter(in.)}*SUB_FORMULA(RPM_V2_Corrected))/(228.8693*{Final Drive Ratio}*{Transmission gear ratio})
SUB_FORMULA_V1=({Tire Diameter(in.)}*SUB_FORMULA(RPM_V1_Corrected))/(228.8693*{Final Drive Ratio}*{Transmission gear ratio})
SUB_FORMULA_RPM_V2= smoothFiltered([Field.RPM])
SUB_FORMULA_RPM_V1=smoothFiltered([Field.RPM-1])
SUB_FORMULA_TIME_DELTA= [Field.Time]-[Field.Time-1]
SUB_FORMULA_RPM_V2_Corrected=(SUB_FORMULA(RPM_V2)*pow((log(SUB_FORMULA(RPM_V2)-{Converter stall speed (0 for manual trans)})/(log(SUB_FORMULA(RPM_V2)-({Converter stall speed (0 for manual trans)}*0.95)))),23)+({Converter stall speed (0 for manual trans)})*0.15)
SUB_FORMULA_RPM_V1_Corrected=(SUB_FORMULA(RPM_V1)*pow((log(SUB_FORMULA(RPM_V1)-{Converter stall speed (0 for manual trans)})/(log(SUB_FORMULA(RPM_V1)-({Converter stall speed (0 for manual trans)}*0.95)))),23)+({Converter stall speed (0 for manual trans)})*0.15)
SUB_FORMULA_V2_unc=({Tire Diameter(in.)}*SUB_FORMULA(RPM_V2))/(228.8693*{Final Drive Ratio}*{Transmission gear ratio})



APPEND_FIELD_FT/SEC^2=[Field.TP]<{Min TP to calculate for} ? 0 : (SUB_FORMULA(V2)-SUB_FORMULA(V1))/SUB_FORMULA(TIME_DELTA)

APPEND_FIELD_TripMiles = [TripMiles-1] >= 0 ? [TripMiles-1]+(([MPH]/3600)*([Time]-[Time-1]))  : 0

APPEND_FIELD_TripFeet = [TripFeet-1] >= 0 ? [TripFeet-1]+(5280*([MPH]/3600)*([Time]-[Time-1]))  : 0

APPEND_FIELD_GallonsUsed = [GallonsUsed-1] >= 0 ? [GallonsUsed-1]+(SUB_FORMULA(FuelFlow)*(([Time]-[Time-1])/3600))/6.073  : 0
APPEND_FIELD_AvgMPG = [TripMiles]/[GallonsUsed]
#APPEND_FIELD_CorV2=SUB_FORMULA(V2)*3600/5280
#APPEND_FIELD_CorV1=SUB_FORMULA(V2)*3600/5280

# speed in each gear calculated with 2% head room.
SUB_FORMULA_EstimatedGear = [Field.speedMPH] < ({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 1st gear ratio}) * 1.02 ? 1 : [Field.speedMPH] < ({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 2nd gear ratio}) * 1.02 ? 2 : [Field.speedMPH] < ({Tire Diameter(in.)}*[Field.RPM])/(335.675*{Final Drive Ratio}*{Transmission 3rd gear ratio}) * 1.02 ? 3 : 4 
APPEND_FIELD_Predicted\ Gear=SUB_FORMULA(EstimatedGear)
SUB_FORMULA_TransRatio= selectExpression(SUB_FORMULA(EstimatedGear)-1, {Transmission 1st gear ratio}, {Transmission 2nd gear ratio}, {Transmission 3rd gear ratio}, {Transmission 4th gear ratio})
SUB_FORMULA_RpmSpeedMph= ({Tire Diameter(in.)}*[Field.RPM])/(335.675 * {Final Drive Ratio} * SUB_FORMULA(TransRatio))
APPEND_FIELD_Converter\ Slip= [Field.RPM] > 0 ? (1-([Field.speedMPH] / SUB_FORMULA(RpmSpeedMph))) * 100 : 0
APPEND_FIELD_Speed\ MPH\ From\ RPM=SUB_FORMULA(RpmSpeedMph)

