6
6
@persist TE V BHQ Braking_Train Braking_Loco BrakeMul MaxTrainBrakeForce Holding TE_Effective TE_EffectiveLoad AutoMux CarCount BEVLB TrainWeight
7
7
@persist DynamicTemp MotorTemp DynamicShort MotorShort GroundRelay DBArking TMArking FixNils RampedMotorVoltage EngineRPMCal DynoHPINCR FBWD FFWD
8
8
@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
10
10
@trigger none
11
11
@model
12
12
@@ -35,6 +35,7 @@ if(first()){
35
35
AlarmBellStart = CONFIGURATION_DATA[32,string]
36
36
AlarmBellEnd = CONFIGURATION_DATA[49,string]
37
37
Adhesion = CONFIGURATION_DATA[53,number]
38
+ FeedPressure = CONFIGURATION_DATA[53,number]
38
39
39
40
MainGeneratorVoltage = 0
40
41
MaxGeneratorVoltage = 1500
@@ -497,34 +498,34 @@ elseif(changed(CONTROL_STAND_DATA[25,number])&CONTROL_STAND_DATA[25,number]){
497
498
}
498
499
499
500
500
- if(LOCOMOTIVE_AIRBRAKE_DATA[4,number]<10 ){
501
+ if(LOCOMOTIVE_AIRBRAKE_DATA[4,number]<5 ){
501
502
BEVLB = 0
502
503
BE = 0
503
504
}
504
- elseif(LOCOMOTIVE_AIRBRAKE_DATA[4,number]>10 ){
505
+ elseif(LOCOMOTIVE_AIRBRAKE_DATA[4,number]>5 ){
505
506
BEVLB = 40000*(abs((LOCOMOTIVE_AIRBRAKE_DATA[4,number]))/65)
506
507
BE = (LOCOMOTIVE_AIRBRAKE_DATA[4,number]*(Holding ? 0 : BEVLB*(ClaspBrakes ? 1.25 : 1)))
507
508
}
508
509
509
510
510
- if((Holding & round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])<90 )){
511
+ if((Holding & round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])<(FeedPressure) )){
511
512
AutoMux = 1
512
513
}
513
- elseif((!Holding & round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])>89 )){
514
+ elseif((!Holding & round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])>(FeedPressure-1) )){
514
515
AutoMux = 0
515
516
}
516
517
517
518
if(CONTROL_STAND_DATA[7,number] == 1){
518
519
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) ){
520
521
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)
522
523
}
523
524
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)
525
526
}
526
527
}
527
- elseif(round(LOCOMOTIVE_AIRBRAKE_DATA[3,number])>89) {
528
+ else {
528
529
BEAuto = 0
529
530
}
530
531
}
@@ -536,13 +537,13 @@ elseif(CONTROL_STAND_DATA[7,number] == 0){
536
537
BEAuto = 0
537
538
}
538
539
539
- if((LOCOMOTIVE_AIRBRAKE_DATA[2,number]<85 & !BHQ & MPH<1.5 )){
540
+ if((LOCOMOTIVE_AIRBRAKE_DATA[2,number]<(FeedPressure-1) & !BHQ & MPH<1)){
540
541
Holding = 1
541
542
BHQ = 1
542
543
abRest(Trucks)
543
544
}
544
545
545
- if((LOCOMOTIVE_AIRBRAKE_DATA[4,number]>10 ) & !BHQ & MPH<1.5 ){
546
+ if((LOCOMOTIVE_AIRBRAKE_DATA[4,number]>5 ) & !BHQ & MPH<1){
546
547
Holding = 1
547
548
BHQ = 1
548
549
abRest(Trucks)
@@ -556,7 +557,7 @@ if(HandBrake){
556
557
557
558
local Overcome = (abs(TE) - BE)>0
558
559
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))){
560
561
Holding = 0
561
562
BHQ = 0
562
563
abRelease()
@@ -588,14 +589,14 @@ if(FixNils){
588
589
}
589
590
590
591
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) ))
592
593
TE_Effective = TE_EffectiveLoad
593
594
}
594
595
595
596
local FrictionCoefficient = getWeatherCondition()
596
597
local InperfectionFactor = 1.5
597
598
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) ))
599
600
SlippingFactor = ((SlipCoefficient/(FrictionFactor^2))/(1+((MPH/BaseSpeed)/10)))*(random()*InperfectionFactor)
600
601
601
602
if(!MotorShort){
@@ -635,8 +636,8 @@ if(BHQ){
635
636
TE = 0
636
637
}
637
638
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)
640
641
641
642
if(Dynamics == 0){
642
643
TELocal = TE*sign(CONTROL_STAND_DATA[16,number])
@@ -647,12 +648,12 @@ elseif(Dynamics == 1){
647
648
648
649
BEForce = BEF + BEAutoF
649
650
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
+ # }
656
657
657
658
W:applyForce(-E:up()*(Force/5))
658
659
0 commit comments