hmi消息增加牵引/制动力比例
This commit is contained in:
parent
6dee8dfa31
commit
6cadfcf607
@ -160,6 +160,9 @@ public class TrainHmiDisplay {
|
||||
*/
|
||||
private int tow;
|
||||
|
||||
/** 牵引、制动力百分比 */
|
||||
private int forcePercent;
|
||||
|
||||
public TrainHmiDisplay(VirtualRealityTrain train) {
|
||||
this.code = train.getCode();
|
||||
this.groupNumber = train.getGroupNumber();
|
||||
@ -213,6 +216,17 @@ public class TrainHmiDisplay {
|
||||
this.parking = train.isParkingAt();
|
||||
this.inTheStandArea = train.isInTheStandArea();
|
||||
this.tow = getTow(train);
|
||||
this.forcePercent = getForcePercent(train);
|
||||
}
|
||||
|
||||
private int getForcePercent(VirtualRealityTrain train) {
|
||||
if (train.getFk() > 0) {
|
||||
return (int) (train.getFk() / train.getCurrentFkMax() * 100);
|
||||
} else if (train.getFb() > 0) {
|
||||
return (int) (train.getFb() / train.getCurrentFbMax() * 100);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private int getTow(VirtualRealityTrain train) {
|
||||
@ -373,6 +387,11 @@ public class TrainHmiDisplay {
|
||||
this.tow = tow;
|
||||
map.put("tow", tow);
|
||||
}
|
||||
int forcePercent = getForcePercent(train);
|
||||
if (!Objects.equals(this.forcePercent, forcePercent)) {
|
||||
this.forcePercent = forcePercent;
|
||||
map.put("forcePercent", forcePercent);
|
||||
}
|
||||
if (map.size() > 0) {
|
||||
map.put("code", this.code);
|
||||
return map;
|
||||
|
@ -681,8 +681,8 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
if (linkTrain != null && linkTrain.isEB()) {
|
||||
return;
|
||||
}
|
||||
this.fk = fk;
|
||||
this.fb = fb;
|
||||
this.fk = Math.min(fk, getCurrentFkMax());
|
||||
this.fb = Math.min(fb, getCurrentFbMax());
|
||||
if (fk > 0) {
|
||||
this.tbControl = TrainTBControl.TRACTION;
|
||||
} else if (fb > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user