Skip to content

Commit 5f74ab1

Browse files
author
TitusStudiosMediaGroup
committed
dev
1 parent 13b2941 commit 5f74ab1

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

diesel-electric-processor.txt

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@persist TE V BHQ Braking_Train Braking_Loco BrakeMul MaxTrainBrakeForce Holding TE_Effective TE_EffectiveLoad AutoMux CarCount BEVLB TrainWeight
77
@persist DynamicTemp MotorTemp DynamicShort MotorShort GroundRelay DBArking TMArking FixNils RampedMotorVoltage EngineRPMCal DynoHPINCR FBWD FFWD
88
@persist Motors MaxGeneratorCurrent MaxTractionMotorCurrent MaxContinuousTractionMotorCurrent MaxDynamicCurrent MaxContinuousDynamicCurrent EngineIdleRPM EngineRedlineRPM NumNotches Axles
9-
@persist Horsepower Weight BaseSpeed TopSpeed ClaspBrakes [AlarmBellStart AlarmBellEnd]:string Adhesion WeightOnAxle TE_Starting Dynamics LowSpeedCurve SlippingFactor
9+
@persist Horsepower Weight BaseSpeed TopSpeed ClaspBrakes [AlarmBellStart AlarmBellEnd]:string Adhesion WeightOnAxle TE_Starting Dynamics LowSpeedCurve SlippingFactor FeedPressure
1010
@trigger none
1111
@model
1212

@@ -35,6 +35,7 @@ if(first()){
3535
AlarmBellStart = CONFIGURATION_DATA[32,string]
3636
AlarmBellEnd = CONFIGURATION_DATA[49,string]
3737
Adhesion = CONFIGURATION_DATA[53,number]
38+
FeedPressure = CONFIGURATION_DATA[53,number]
3839

3940
MainGeneratorVoltage = 0
4041
MaxGeneratorVoltage = 1500
@@ -497,34 +498,34 @@ elseif(changed(CONTROL_STAND_DATA[25,number])&CONTROL_STAND_DATA[25,number]){
497498
}
498499

499500

500-
if(LOCOMOTIVE_AIRBRAKE_DATA[4,number]<10){
501+
if(LOCOMOTIVE_AIRBRAKE_DATA[4,number]<5){
501502
BEVLB = 0
502503
BE = 0
503504
}
504-
elseif(LOCOMOTIVE_AIRBRAKE_DATA[4,number]>10){
505+
elseif(LOCOMOTIVE_AIRBRAKE_DATA[4,number]>5){
505506
BEVLB = 40000*(abs((LOCOMOTIVE_AIRBRAKE_DATA[4,number]))/65)
506507
BE = (LOCOMOTIVE_AIRBRAKE_DATA[4,number]*(Holding ? 0 : BEVLB*(ClaspBrakes ? 1.25 : 1)))
507508
}
508509

509510

510-
if((Holding & round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])<90)){
511+
if((Holding & round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])<(FeedPressure))){
511512
AutoMux = 1
512513
}
513-
elseif((!Holding & round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])>89)){
514+
elseif((!Holding & round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])>(FeedPressure-1))){
514515
AutoMux = 0
515516
}
516517

517518
if(CONTROL_STAND_DATA[7,number] == 1){
518519
if(CONTROL_STAND_DATA[26,number] == 0){
519-
if(round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])<89){
520+
if(round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])<(FeedPressure-1)){
520521
if(MaxTrainBrakeForce == 0){
521-
BEAuto = ((round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])-90)*(AutoMux ? 0 : 150000))/(CONTROL_STAND_DATA[6,number] ? 2.5 : 1.45)
522+
BEAuto = ((round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])-(FeedPressure))*(AutoMux ? 0 : 150000))/(CONTROL_STAND_DATA[6,number] ? 2.5 : 1.45)
522523
}
523524
elseif(MaxTrainBrakeForce>0){
524-
BEAuto = (MaxTrainBrakeForce*(round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])-90)*(AutoMux ? 0 : 40))/(CONTROL_STAND_DATA[6,number] ? 2.5 : 1.45)
525+
BEAuto = ((1+MaxTrainBrakeForce)*(round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])-(FeedPressure))*(AutoMux ? 0 : 40))/(CONTROL_STAND_DATA[6,number] ? 2.5 : 1.45)
525526
}
526527
}
527-
elseif(round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])>89){
528+
else{
528529
BEAuto = 0
529530
}
530531
}
@@ -536,13 +537,13 @@ elseif(CONTROL_STAND_DATA[7,number] == 0){
536537
BEAuto = 0
537538
}
538539

539-
if((LOCOMOTIVE_AIRBRAKE_DATA[2,number]<85 & !BHQ & MPH<1.5)){
540+
if((LOCOMOTIVE_AIRBRAKE_DATA[2,number]<(FeedPressure-1) & !BHQ & MPH<1)){
540541
Holding = 1
541542
BHQ = 1
542543
abRest(Trucks)
543544
}
544545

545-
if((LOCOMOTIVE_AIRBRAKE_DATA[4,number]>10) & !BHQ & MPH<1.5){
546+
if((LOCOMOTIVE_AIRBRAKE_DATA[4,number]>5) & !BHQ & MPH<1){
546547
Holding = 1
547548
BHQ = 1
548549
abRest(Trucks)
@@ -556,7 +557,7 @@ if(HandBrake){
556557

557558
local Overcome = (abs(TE) - BE)>0
558559

559-
if(((LOCOMOTIVE_AIRBRAKE_DATA[2,number]>85 & LOCOMOTIVE_AIRBRAKE_DATA[4,number]<10 & !HandBrake & BHQ))){
560+
if(((LOCOMOTIVE_AIRBRAKE_DATA[2,number]>(FeedPressure-1) & LOCOMOTIVE_AIRBRAKE_DATA[4,number]<5 & !HandBrake & BHQ))){
560561
Holding = 0
561562
BHQ = 0
562563
abRelease()
@@ -588,14 +589,14 @@ if(FixNils){
588589
}
589590

590591
Load = clamp(Current,Load-(15),Load+(LowSpeedCurve/(Dynamics ? 1 : 10)))
591-
TE_EffectiveLoad = Load/(1+(round(-(LOCOMOTIVE_AIRBRAKE_DATA[3,number]-90))/90))
592+
TE_EffectiveLoad = Load/(1+(round(-(LOCOMOTIVE_AIRBRAKE_DATA[3,number]-(FeedPressure)))/(FeedPressure)))
592593
TE_Effective = TE_EffectiveLoad
593594
}
594595

595596
local FrictionCoefficient = getWeatherCondition()
596597
local InperfectionFactor = 1.5
597598
local SlipCoefficient = TE_Effective/WeightOnAxle*(TrainWeight/WeightOnAxle)
598-
local FrictionFactor = (1+(round(-(LOCOMOTIVE_AIRBRAKE_DATA[3,number]-90))/90))
599+
local FrictionFactor = (1+(round(-(LOCOMOTIVE_AIRBRAKE_DATA[3,number]-(FeedPressure)))/(FeedPressure)))
599600
SlippingFactor = ((SlipCoefficient/(FrictionFactor^2))/(1+((MPH/BaseSpeed)/10)))*(random()*InperfectionFactor)
600601

601602
if(!MotorShort){
@@ -635,8 +636,8 @@ if(BHQ){
635636
TE = 0
636637
}
637638

638-
BEF = sign(V)*(MPH>0.5)*abs(BE)
639-
BEAutoF = sign(V)*(MPH>0.5)*abs(BEAuto)
639+
BEF = abs(BE)#(MPH>0.5)*abs(BE)
640+
BEAutoF = abs(BEAuto)#(MPH>0.5)*abs(BEAuto)
640641

641642
if(Dynamics == 0){
642643
TELocal = TE*sign(CONTROL_STAND_DATA[16,number])
@@ -647,12 +648,12 @@ elseif(Dynamics == 1){
647648

648649
BEForce = BEF + BEAutoF
649650

650-
if((TE!=0) | (BEForce!=0)){
651-
Force = TELocal - BEForce
652-
}
653-
else{
654-
Force = 0
655-
}
651+
#if((TE!=0) | (BEForce!=0)){
652+
Force = TELocal - (BEForce*sign(V))
653+
#}
654+
#else{
655+
# Force = 0
656+
#}
656657

657658
W:applyForce(-E:up()*(Force/5))
658659

0 commit comments

Comments
 (0)