Merge pull request #1032 from JoePfeiffer/full-motor-designations

Full motor designations
This commit is contained in:
Neil Weinstock 2021-10-15 08:14:42 -04:00 committed by GitHub
commit ff53498cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 205 additions and 113 deletions

View File

@ -1225,6 +1225,7 @@ TCMotorSelPan.lbl.Selectthrustcurve = Select thrust curve:
TCMotorSelPan.lbl.Ejectionchargedelay = Ejection charge delay:
TCMotorSelPan.equalsIgnoreCase.None = None
TCMotorSelPan.lbl.NumberofsecondsorNone = (Number of seconds or \"None\")
TCMotorSelPan.lbl.Designation = Designation:
TCMotorSelPan.lbl.Totalimpulse = Total impulse:
TCMotorSelPan.lbl.Avgthrust = Avg. thrust:
TCMotorSelPan.lbl.Maxthrust = Max. thrust:
@ -1601,7 +1602,7 @@ FlightEvent.Type.EXCEPTION = Exception
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Manufacturer
TCurveMotorCol.DESIGNATION = Designation
TCurveMotorCol.COMMON_NAME = Name
TCurveMotorCol.CASEINFO = Case
TCurveMotorCol.DIAMETER = Diameter
TCurveMotorCol.LENGTH = Length

View File

@ -945,6 +945,7 @@ TCMotorSelPan.lbl.Selectthrustcurve = Vyber v
TCMotorSelPan.lbl.Ejectionchargedelay = Oddelovací zpo\u017Edení:
TCMotorSelPan.equalsIgnoreCase.None = Nic
TCMotorSelPan.lbl.NumberofsecondsorNone = (Pocet sekund nebo \"Nic\")
TCMotorSelPan.lbl.Designation = Pojmenování:
TCMotorSelPan.lbl.Totalimpulse = Celkový impulse:
TCMotorSelPan.lbl.Avgthrust = Prumerný tah:
TCMotorSelPan.lbl.Maxthrust = Maximální tah:
@ -1214,7 +1215,8 @@ FlightEvent.Type.ALTITUDE = Zmena v
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Výrobce
TCurveMotorCol.DESIGNATION = Pojmenování
TCurveMotorCol.COMMON_NAME = Jméno
! TCurveMotorCol.DESIGNATION = Pojmenování
TCurveMotorCol.TYPE = Druh
TCurveMotorCol.DIAMETER = Prumer
TCurveMotorCol.LENGTH = Délka

View File

@ -1002,6 +1002,7 @@ TCMotorSelPan.lbl.Selectthrustcurve = Schubkurve ausw
TCMotorSelPan.lbl.Ejectionchargedelay = Verzögerung der Ausstoßladung:
TCMotorSelPan.equalsIgnoreCase.None = keine
TCMotorSelPan.lbl.NumberofsecondsorNone = (Anzahl der Sekunden oder \«keine\«)
TCMotorSelPan.lbl.Designation = Bezeichnung:
TCMotorSelPan.lbl.Totalimpulse = Gesamtimpuls:
TCMotorSelPan.lbl.Avgthrust = Durchschn. Schub:
TCMotorSelPan.lbl.Maxthrust = max. Schub
@ -1273,7 +1274,8 @@ FlightEvent.Type.ALTITUDE = H
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Hersteller
TCurveMotorCol.DESIGNATION = Bezeichnung
TCurveMotorCol.COMMON_NAME = Name
! TCurveMotorCol.DESIGNATION = Bezeichnung
TCurveMotorCol.TYPE = Typ
TCurveMotorCol.DIAMETER = Durchmesser
TCurveMotorCol.LENGTH = Länge

View File

@ -1110,6 +1110,7 @@ StreamerCfg.tab.Radialpos = Posici\u00f3n radial
StreamerCfg.tab.ttip.General = Propiedades generales
StreamerCfg.tab.ttip.Radialpos = Configuraci\u00f3n de posici\u00f3n radial
! ThrustCurveMotorSelectionPanel
TCMotorSelPan.Diameter = Di\u00e1metro
TCMotorSelPan.Length = Longitud
TCMotorSelPan.MotorMountDimensions = Dimensiones del porta motor:
@ -1140,8 +1141,8 @@ TCMotorSelPan.lbl.Motormountdia = Di\u00e1metro del porta motor:
TCMotorSelPan.lbl.NumberofsecondsorNone = (segundos)
TCMotorSelPan.lbl.Search = Buscar:
TCMotorSelPan.lbl.Selectthrustcurve = Seleccione curva de empuje:
! ThrustCurveMotorSelectionPanel
TCMotorSelPan.lbl.Selrocketmotor = Seleccione el motor del cohete:
TCMotorSelPan.lbl.Designation = Designaci\u00f3n
TCMotorSelPan.lbl.Totalimpulse = Impulso total:
TCMotorSelPan.noDescription = No hay una descripci\u00f3n disponible
TCMotorSelPan.title.Thrust = Empuje
@ -1156,10 +1157,11 @@ TCurveMotor.ttip.length = Longitud:
TCurveMotor.ttip.maxThrust = Empuje m\u00e1ximo:
TCurveMotor.ttip.totalImpulse = Impulso total:
TCurveMotorCol.DESIGNATION = Designaci\u00f3n
! ThrustCurveMotorColumns
TCurveMotorCol.COMMON_NAME = Nombre
! TCurveMotorCol.DESIGNATION = Designaci\u00f3n
TCurveMotorCol.DIAMETER = Di\u00e1metro
TCurveMotorCol.LENGTH = Longitud
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Fabricante
TCurveMotorCol.TOTAL_IMPULSE = Impulso total
TCurveMotorCol.TYPE = Tipo

View File

@ -1104,6 +1104,7 @@ StreamerCfg.tab.Radialpos = Position sur le p\u00E9rim\u00E8tre
StreamerCfg.tab.ttip.General = Propri\u00E9t\u00E9s g\u00E9n\u00E9rales
StreamerCfg.tab.ttip.Radialpos = Configuration de la position sur le p\u00E9rim\u00E8tre
! ThrustCurveMotorSelectionPanel
TCMotorSelPan.Diameter = Diametre
TCMotorSelPan.Length = Longueur
TCMotorSelPan.MotorMountDimensions = Dimentions du porte moteur:
@ -1134,8 +1135,8 @@ TCMotorSelPan.lbl.Motormountdia = Diam\u00E8tre du tube porte moteur:
TCMotorSelPan.lbl.NumberofsecondsorNone = (Nombre de secondes ou "Aucun")
TCMotorSelPan.lbl.Search = Rechercher:
TCMotorSelPan.lbl.Selectthrustcurve = Choisir la courbe de pouss\u00E9e:
! ThrustCurveMotorSelectionPanel
TCMotorSelPan.lbl.Selrocketmotor = Choisir le moteur fus\u00E9e:
TCMotorSelPan.lbl.Designation = D\u00E9signation
TCMotorSelPan.lbl.Totalimpulse = Impulsion totale:
TCMotorSelPan.noDescription = Aucune description disponible
TCMotorSelPan.title.Thrust = Pouss\u00E9e
@ -1150,10 +1151,11 @@ TCurveMotor.ttip.length = Longueur:
TCurveMotor.ttip.maxThrust = Pouss\u00E9e Maximum:
TCurveMotor.ttip.totalImpulse = Impulsion Totale:
TCurveMotorCol.DESIGNATION = D\u00E9signation
! ThrustCurveMotorColumns
TCurveMotorCol.COMMON_NAME = Nom
! TCurveMotorCol.DESIGNATION = D\u00E9signation
TCurveMotorCol.DIAMETER = Diam\u00E8tre
TCurveMotorCol.LENGTH = Longueur
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Fabricant
TCurveMotorCol.TOTAL_IMPULSE = Impultion total
TCurveMotorCol.TYPE = Type

View File

@ -1004,6 +1004,7 @@ TCMotorSelPan.lbl.Selectthrustcurve = Seleziona la curva di spinta:
TCMotorSelPan.lbl.Ejectionchargedelay = Ritardo della carica di espulsione:
TCMotorSelPan.equalsIgnoreCase.None = Nessun
TCMotorSelPan.lbl.NumberofsecondsorNone = (Numero di secondi o \"Nessuno\")
TCMotorSelPan.lbl.Designation = Classe:
TCMotorSelPan.lbl.Totalimpulse = Impulso totale:
TCMotorSelPan.lbl.Avgthrust = Spinta media:
TCMotorSelPan.lbl.Maxthrust = Spinta max.:
@ -1277,7 +1278,8 @@ FlightEvent.Type.ALTITUDE = Cambio altitudine
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Produttore
TCurveMotorCol.DESIGNATION = Classe
TCurveMotorCol.COMMON_NAME = Nome
! TCurveMotorCol.DESIGNATION = Classe
TCurveMotorCol.TYPE = Tipo
TCurveMotorCol.DIAMETER = Diametro
TCurveMotorCol.LENGTH = Lunghezza

View File

@ -1035,6 +1035,7 @@ TCMotorSelPan.lbl.Selectthrustcurve = \u63A8\u529B\u5C65\u6B74\uFF1A
TCMotorSelPan.lbl.Ejectionchargedelay = Ejection charge delay:
TCMotorSelPan.equalsIgnoreCase.None = None
TCMotorSelPan.lbl.NumberofsecondsorNone = (Number of seconds or \"None\")
TCMotorSelPan.lbl.Designation = \u8A18\u53F7
TCMotorSelPan.lbl.Totalimpulse = \u30C8\u30FC\u30BF\u30EB\u30A4\u30F3\u30D1\u30EB\u30B9\uFF1A
TCMotorSelPan.lbl.Avgthrust = \u5E73\u5747\u63A8\u529B\uFF1A
TCMotorSelPan.lbl.Maxthrust = \u6700\u5927\u63A8\u529B\uFF1A
@ -1326,7 +1327,8 @@ FlightEvent.Type.ALTITUDE = \u59FF\u52E2\u5909\u66F4
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = \u30E1\u30FC\u30AB\u30FC
TCurveMotorCol.DESIGNATION = \u8A18\u53F7
! TCurveMotorCol.DESIGNATION = \u8A18\u53F7
TCurveMotorCol.COMMON_NAME = \u8A18\u53F7
TCurveMotorCol.TYPE = \u30BF\u30A4\u30D7
TCurveMotorCol.DIAMETER = \u76F4\u5F84
TCurveMotorCol.LENGTH = \u9577\u3055

View File

@ -1201,6 +1201,7 @@ TCMotorSelPan.lbl.Selectthrustcurve = Selecteer stuwkrachtcurve:
TCMotorSelPan.lbl.Ejectionchargedelay = Vertraging schietlading:
TCMotorSelPan.equalsIgnoreCase.None = Geen
TCMotorSelPan.lbl.NumberofsecondsorNone = (Aantal seconden of \"Geen\")
TCMotorSelPan.lbl.Designation = Benaming
TCMotorSelPan.lbl.Totalimpulse = Totale impuls:
TCMotorSelPan.lbl.Avgthrust = Gemiddelde stuwkracht:
TCMotorSelPan.lbl.Maxthrust = Max. stuwkracht:
@ -1576,7 +1577,8 @@ FlightEvent.Type.EXCEPTION = Uitzondering
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Fabrikant
TCurveMotorCol.DESIGNATION = Benaming
TCurveMotorCol.COMMON_NAME = Naam
! TCurveMotorCol.DESIGNATION = Benaming
TCurveMotorCol.CASEINFO = Behuizing
TCurveMotorCol.DIAMETER = Diameter
TCurveMotorCol.LENGTH = Lengte

View File

@ -947,6 +947,7 @@
TCMotorSelPan.lbl.Ejectionchargedelay = Opó\u017Anienie odpalenia \u0142adunku odrzucaj\u0105cego:
TCMotorSelPan.equalsIgnoreCase.None = \u017Badne
TCMotorSelPan.lbl.NumberofsecondsorNone = (liczba sekund lub \"Brak\")
TCMotorSelPan.lbl.Designation = Oznaczenie:
TCMotorSelPan.lbl.Totalimpulse = Ca\u0142kowity impuls:
TCMotorSelPan.lbl.Avgthrust = \u015Arednia si\u0142a ci\u0105gu:
TCMotorSelPan.lbl.Maxthrust = Maks. si\u0142a ci\u0105gu:
@ -1218,7 +1219,8 @@
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Producent
TCurveMotorCol.DESIGNATION = Oznaczenie
TCurveMotorCol.COMMON_NAME = Nazwa
! TCurveMotorCol.DESIGNATION = Oznaczenie
TCurveMotorCol.TYPE = Typ
TCurveMotorCol.DIAMETER = \u015Arednica
TCurveMotorCol.LENGTH = D\u0142ugo\u015B\u0107

View File

@ -1081,6 +1081,7 @@ StreamerCfg.tab.Radialpos = Posi\u00e7\u00e3o radial
StreamerCfg.tab.ttip.General = Propriedades gerais
StreamerCfg.tab.ttip.Radialpos = Configura\u00e7\u00e3o posi\u00e7\u00e3o radial
# ThrustCurveMotorSelectionPanel
TCMotorSelPan.SHOW_DESCRIPTIONS.desc1 = Mostrar todos os motores
TCMotorSelPan.SHOW_DESCRIPTIONS.desc2 = Mostrar motores com um di\u00e2metro menor do que a montagem do motor
TCMotorSelPan.SHOW_DESCRIPTIONS.desc3 = Mostrar motores com um di\u00e2metro igual ao da montagem do motor
@ -1099,8 +1100,8 @@ TCMotorSelPan.lbl.Motormountdia = Di\u00e2metro da montagem do motor:
TCMotorSelPan.lbl.NumberofsecondsorNone = (N\u00famero de segundos ou "Nenhum")
TCMotorSelPan.lbl.Search = Pesquisar:
TCMotorSelPan.lbl.Selectthrustcurve = Selecione curva de empuxo:
# ThrustCurveMotorSelectionPanel
TCMotorSelPan.lbl.Selrocketmotor = Selecione motor do foguete:
TCMotorSelPan.lbl.Designation = Designa\u00e7\u00e3o
TCMotorSelPan.lbl.Totalimpulse = Impulso total:
TCMotorSelPan.noDescription = Nenhuma descri\u00e7\u00e3o dispon\u00edvel.
TCMotorSelPan.title.Thrust = Impulso
@ -1115,10 +1116,11 @@ TCurveMotor.ttip.length = Comprimento:
TCurveMotor.ttip.maxThrust = M\u00e1ximo de impulso:
TCurveMotor.ttip.totalImpulse = Impulso total:
TCurveMotorCol.DESIGNATION = Designa\u00e7\u00e3o
# ThrustCurveMotorColumns
TCurveMotorCol.COMMON_NAME = Nome
! TCurveMotorCol.DESIGNATION = Designa\u00e7\u00e3o
TCurveMotorCol.DIAMETER = Di\u00e2metro
TCurveMotorCol.LENGTH = Comprimento
# ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Fabricante
TCurveMotorCol.TYPE = Tipo

View File

@ -1103,6 +1103,7 @@ TCMotorSelPan.lbl.Selectthrustcurve = \u0412\u044b\u0431\u043e\u0440 \u043f\u044
TCMotorSelPan.lbl.Ejectionchargedelay = \u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u044b\u0431\u0440\u043e\u0441\u0430 \u0437\u0430\u0440\u044f\u0434\u0430:
TCMotorSelPan.equalsIgnoreCase.None = \u041d\u0435\u0442
TCMotorSelPan.lbl.NumberofsecondsorNone = (\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u0438\u043b\u0438 "\u041d\u0435\u0442")
TCMotorSelPan.lbl.Designation = \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:
TCMotorSelPan.lbl.Totalimpulse = \u041e\u0431\u0449\u0438\u0439 \u0438\u043c\u043f\u0443\u043b\u044c\u0441:
TCMotorSelPan.lbl.Avgthrust = \u0421\u0440\u0435\u0434\u043d\u044f\u044f \u0442\u044f\u0433\u0430:
TCMotorSelPan.lbl.Maxthrust = \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u044f\u0433\u0430:
@ -1417,7 +1418,8 @@ FlightEvent.Type.EXCEPTION = \u041e\u0448\u0438\u0431\u043a\u0430
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c
TCurveMotorCol.DESIGNATION = \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435
TCurveMotorCol.COMMON_NAME = \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435
! TCurveMotorCol.DESIGNATION = \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435
TCurveMotorCol.TYPE = \u0422\u0438\u043f
TCurveMotorCol.DIAMETER = \u0414\u0438\u0430\u043c\u0435\u0442\u0440
TCurveMotorCol.LENGTH = \u0414\u043b\u0438\u043d\u0430

View File

@ -1108,6 +1108,7 @@ TCMotorSelPan.lbl.Selectthrustcurve = Select thrust curve:
TCMotorSelPan.lbl.Ejectionchargedelay = Ejection charge delay:
TCMotorSelPan.equalsIgnoreCase.None = None
TCMotorSelPan.lbl.NumberofsecondsorNone = (Number of seconds or \"None\")
TCMotorSelPan.lbl.Designation = Designation:
TCMotorSelPan.lbl.Totalimpulse = Total impulse:
TCMotorSelPan.lbl.Avgthrust = Avg. thrust:
TCMotorSelPan.lbl.Maxthrust = Max. thrust:
@ -1423,7 +1424,8 @@ FlightEvent.Type.EXCEPTION = Exception
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = Manufacturer
TCurveMotorCol.DESIGNATION = Designation
TCurveMotorCol.COMMON_NAME = Name
! TCurveMotorCol.DESIGNATION = Designation
TCurveMotorCol.TYPE = Type
TCurveMotorCol.DIAMETER = Diameter
TCurveMotorCol.LENGTH = Length

View File

@ -1177,6 +1177,7 @@ StreamerCfg.tab.Radialpos = \u5F84\u5411\u4F4D\u7F6E
StreamerCfg.tab.ttip.General = \u5E38\u89C4\u5C5E\u6027
StreamerCfg.tab.ttip.Radialpos = \u5F84\u5411\u4F4D\u7F6E\u8BBE\u7F6E
! ThrustCurveMotorSelectionPanel
TCMotorSelPan.Diameter = \u76F4\u5F84
TCMotorSelPan.Length = \u957F\u5EA6
TCMotorSelPan.MotorMountDimensions = \u53D1\u52A8\u673A\u5EA7\u5C3A\u5BF8:
@ -1203,8 +1204,8 @@ TCMotorSelPan.lbl.Maxthrust = \u6700\u5927\u63A8\u529B:
TCMotorSelPan.lbl.NumberofsecondsorNone = (\u79D2\u6570\u6216"\u65E0")
TCMotorSelPan.lbl.Search = \u641C\u7D22:
TCMotorSelPan.lbl.Selectthrustcurve = \u9009\u62E9\u63A8\u529B\u66F2\u7EBF:
! ThrustCurveMotorSelectionPanel
TCMotorSelPan.lbl.Selrocketmotor = \u9009\u62E9\u706B\u7BAD\u53D1\u52A8\u673A:
TCMotorSelPan.lbl.Designation = \u540D\u79F0:
TCMotorSelPan.lbl.Totalimpulse = \u603B\u51B2\u91CF:
TCMotorSelPan.noDescription = \u63CF\u8FF0\u4E0D\u53EF\u7528.
TCMotorSelPan.title.Thrust = \u63A8\u529B
@ -1219,10 +1220,11 @@ TCurveMotor.ttip.length = \u957F\u5EA6:
TCurveMotor.ttip.maxThrust = \u6700\u5927\u63A8\u529B:
TCurveMotor.ttip.totalImpulse = \u603B\u51B2\u529B:
TCurveMotorCol.DESIGNATION = \u540D\u79F0
! ThrustCurveMotorColumns
TCurveMotorCol.COMMON_NAME = \u540D\u79F0
! TCurveMotorCol.DESIGNATION = \u540D\u79F0
TCurveMotorCol.DIAMETER = \u76F4\u5F84
TCurveMotorCol.LENGTH = \u957F\u5EA6
! ThrustCurveMotorColumns
TCurveMotorCol.MANUFACTURER = \u5236\u9020\u5546
TCurveMotorCol.TOTAL_IMPULSE = \u603B\u51B2
TCurveMotorCol.TYPE = \u7C7B\u578B

View File

@ -38,8 +38,8 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
private final List<Double> delays = new ArrayList<Double>();
private Manufacturer manufacturer = null;
private String commonName = null;
private String designation = null;
private String simplifiedDesignation = null;
private double diameter = -1;
private double length = -1;
private long totalImpulse = 0;
@ -57,7 +57,6 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
checkFirstInsertion(motor);
verifyMotor(motor);
updateType(motor);
checkChangeSimplifiedDesignation(motor);
addStandardDelays(motor);
if(!checkMotorOverwrite(motor)){
motors.add(motor);
@ -144,23 +143,6 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
Collections.sort(delays);
}
/**
* checks if simplified designation should be changed with the given motor
* @param motor the motor to be checked with
*/
private void checkChangeSimplifiedDesignation(ThrustCurveMotor motor) {
// Change the simplified designation if necessary
if (!designation.equalsIgnoreCase(motor.getDesignation().trim())) {
designation = simplifiedDesignation;
}
if (caseInfo == null) {
caseInfo = motor.getCaseInfo();
}
}
/**
* checks if the cached type should be changed with the given motor
* if it's hybrid, delays will be added
@ -206,7 +188,7 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
if (motors.isEmpty()) {
manufacturer = motor.getManufacturer();
designation = motor.getDesignation();
simplifiedDesignation = simplifyDesignation(designation);
commonName = motor.getCommonName();
diameter = motor.getDiameter();
length = motor.getLength();
totalImpulse = Math.round((motor.getTotalImpulseEstimate()));
@ -239,14 +221,14 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
return false;
}
if (!simplifiedDesignation.equalsIgnoreCase(simplifyDesignation(m.getDesignation())))
if (!commonName.equalsIgnoreCase(m.getCommonName()))
return false;
if (caseInfo != null && !caseInfo.equalsIgnoreCase(m.getCaseInfo()))
return false;
return true;
}
}
/**
* returns a new list with the stored motors
@ -283,11 +265,17 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
public Manufacturer getManufacturer() {
return manufacturer;
}
/**
* Return the designation of this motor type. This is either the exact or simplified
* designation, depending on what motors have been added.
* Return the common name of this motor type.
* @return the common name
*/
public String getCommonName() {
return commonName;
}
/**
* Return the designation of this motor type.
* @return the designation
*/
public String getDesignation() {
@ -352,25 +340,6 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
return "ThrustCurveMotorSet[" + manufacturer + " " + designation +
", type=" + type + ", count=" + motors.size() + "]";
}
private static final Pattern SIMPLIFY_PATTERN = Pattern.compile("^[0-9]*[ -]*([A-Z][0-9]+).*");
/**
* Simplify a motor designation, if possible. This attempts to reduce the designation
* into a simple letter + number notation for the impulse class and average thrust.
*
* @param str the designation to simplify
* @return the simplified designation, or the string itself if the format was not detected
*/
public static String simplifyDesignation(String str) {
str = str.trim();
Matcher m = SIMPLIFY_PATTERN.matcher(str);
if (m.matches()) {
return m.group(1);
} else {
return str.replaceAll("\\s", "");
}
}
/**
* Comparator for deciding in which order to display matching motors.
@ -379,11 +348,12 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
@Override
public int compare(ThrustCurveMotor o1, ThrustCurveMotor o2) {
// 1. Designation
if (!o1.getDesignation().equals(o2.getDesignation())) {
return o1.getDesignation().compareTo(o2.getDesignation());
}
// 2. Number of data points (more is better)
if (o1.getSampleSize() != o2.getSampleSize()) {
return o2.getSampleSize() - o1.getSampleSize();

View File

@ -44,7 +44,9 @@ public class ThrustCurveMotorSetDatabase implements MotorDatabase {
matchDescription = false;
else if (manufacturer != null && !m.getManufacturer().matches(manufacturer))
matchDescription = false;
else if (designation != null && !designation.equalsIgnoreCase(m.getDesignation()))
else if (designation != null &&
!designation.equalsIgnoreCase(m.getDesignation()) &&
!designation.equalsIgnoreCase(m.getCommonName()))
matchDescription = false;
else if (!Double.isNaN(diameter) && (Math.abs(diameter - m.getDiameter()) > 0.005))
matchDescription = false;

View File

@ -90,4 +90,4 @@ public class DesignationComparator implements Comparator<String> {
return COLLATOR.compare(o1, o2);
}
}
}
}

View File

@ -74,6 +74,28 @@ public interface Motor {
public Type getMotorType();
/**
* Return the motor code
*
* @return the code
*/
public String getCode();
/**
* Return the common name of the motor.
*
* @return the common name
*/
public String getCommonName();
/**
* Return the common name of the motor, including a delay.
*
* @param delay the delay of the motor.
* @return common name with delay.
*/
public String getCommonName(double delay);
/**
* Return the designation of the motor.
*

View File

@ -62,11 +62,11 @@ public class MotorConfiguration implements FlightConfigurableParameter<MotorConf
return ignitionOveride;
}
public String toMotorDesignation(){
public String toMotorCommonName(){
if( motor == null ){
return trans.get("empty");
}else{
return this.motor.getDesignation(this.getEjectionDelay());
return this.motor.getCommonName(this.getEjectionDelay());
}
}
@ -237,7 +237,7 @@ public class MotorConfiguration implements FlightConfigurableParameter<MotorConf
}
public String toDescription(){
return ( this.toMotorDesignation()+
return ( this.toMotorCommonName()+
" in: "+mount.getDebugName()+
" ign@: "+this.toIgnitionDescription() );
}
@ -253,7 +253,7 @@ public class MotorConfiguration implements FlightConfigurableParameter<MotorConf
mount.getDebugName(),
fcid.toShortKey(),
mid.toDebug(),
toMotorDesignation(),
toMotorCommonName(),
toIgnitionDescription() ));
return buf.toString();

View File

@ -58,7 +58,7 @@ public class MotorConfigurationSet extends FlightConfigurableParameterSet<MotorC
loopFCID.toShortKey(),
curConfig.getFCID().toShortKey(),
curConfig.getMID().toShortKey(),
curConfig.toMotorDesignation(),
curConfig.toMotorCommonName(),
curConfig.toIgnitionDescription() ));
}

View File

@ -4,6 +4,8 @@ import java.io.Serializable;
import java.text.Collator;
import java.util.Arrays;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -33,7 +35,10 @@ public class ThrustCurveMotor implements Motor, Comparable<ThrustCurveMotor>, Se
private String digest = "";
private Manufacturer manufacturer = Manufacturer.getManufacturer("Unknown");
private String code = "";
private String commonName = "";
private String designation = "";
private String description = "";
private Motor.Type type = Motor.Type.UNKNOWN;
private double[] delays = {};
@ -74,6 +79,16 @@ public class ThrustCurveMotor implements Motor, Comparable<ThrustCurveMotor>, Se
motor.description = d;
return this;
}
public Builder setCode(String c) {
motor.code = c;
return this;
}
public Builder setCommonName(String n) {
motor.commonName = n;
return this;
}
public Builder setDesignation(String d) {
motor.designation = d;
@ -130,10 +145,28 @@ public class ThrustCurveMotor implements Motor, Comparable<ThrustCurveMotor>, Se
return this;
}
public Builder setAvailablity(boolean avail) {
public Builder setAvailability(boolean avail) {
motor.available = avail;
return this;
}
/**
* Simplify a motor designation, if possible. This attempts to reduce the designation
* into a simple letter + number notation for the impulse class and average thrust.
*
* @param str the designation to simplify
* @return the simplified designation, or the string itself if the format was not detected
*/
private static final Pattern SIMPLIFY_PATTERN = Pattern.compile("^[0-9]*[ -]*([A-Z][0-9]+).*");
public static String simplifyDesignation(String str) {
str = str.trim();
Matcher m = SIMPLIFY_PATTERN.matcher(str);
if (m.matches()) {
return m.group(1);
} else {
return str.replaceAll("\\s", "");
}
}
public ThrustCurveMotor build() {
// Check argument validity
@ -202,6 +235,19 @@ public class ThrustCurveMotor implements Motor, Comparable<ThrustCurveMotor>, Se
motor.unitRotationalInertia = Inertia.filledCylinderRotational( motor.diameter / 2);
motor.unitLongitudinalInertia = Inertia.filledCylinderLongitudinal( motor.diameter / 2, motor.length);
// If I don't have a motor designation (will be the case if I read the thrustcurve from a file)
// use the motor code
if (motor.designation.equals("")) {
motor.designation = motor.code;
}
// If I don't have a motor common name (will be the case if I read the thrustcurve from a flle)
// apply the motor code simplification heuristics to generate a common name
if (motor.commonName.equals("")) {
motor.commonName = simplifyDesignation(motor.designation);
}
motor.computeStatistics();
return motor;
@ -440,6 +486,21 @@ public class ThrustCurveMotor implements Motor, Comparable<ThrustCurveMotor>, Se
public double getUnitIzz(){
return this.unitLongitudinalInertia;
}
@Override
public String getCode() {
return code;
}
@Override
public String getCommonName() {
return commonName;
}
@Override
public String getCommonName(double delay) {
return commonName + "-" + getDelayString(delay);
}
@Override
public String getDesignation() {

View File

@ -441,7 +441,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
}
if( ! motorConfig.isEmpty()){
buff.append(motorConfig.toMotorDesignation());
buff.append(motorConfig.toMotorCommonName());
++activeMotorCount;
}
}

View File

@ -133,14 +133,12 @@ public class SerializeThrustcurveMotors {
builder.setDiameter(mi.getDiameter() / 1000.0);
builder.setLength(mi.getLength() / 1000.0);
builder.setMotorType(type);
builder.setCommonName(mi.getCommon_name());
builder.setDesignation(mi.getDesignation());
if ("OOP".equals(mi.getAvailiability())) {
builder.setDesignation(mi.getDesignation());
builder.setAvailablity(false);
} else if (mi.getDesignation().startsWith("Micro")) {
builder.setDesignation(mi.getDesignation());
} else {
builder.setDesignation(mi.getCommon_name());
if ("OOP".equals(mi.getAvailability())) {
builder.setAvailability(false);
}
allMotors.add(builder.build());

View File

@ -270,7 +270,7 @@ public class TCMotor implements Cloneable {
this.updated_on = updated_on;
}
public String getAvailiability() {
public String getAvailability() {
return availability;
}

View File

@ -22,6 +22,7 @@ public class ThrustCurveMotorSetTest {
private static final ThrustCurveMotor motor1 = new ThrustCurveMotor.Builder()
.setManufacturer(Manufacturer.getManufacturer("A"))
.setCommonName("F12")
.setDesignation("F12X")
.setDescription("Desc")
.setMotorType(Motor.Type.UNKNOWN)
@ -36,6 +37,7 @@ public class ThrustCurveMotorSetTest {
private static final ThrustCurveMotor motor2 = new ThrustCurveMotor.Builder()
.setManufacturer(Manufacturer.getManufacturer("A"))
.setCommonName("F12")
.setDesignation("F12H")
.setDescription("Desc")
.setMotorType(Motor.Type.SINGLE)
@ -50,7 +52,7 @@ public class ThrustCurveMotorSetTest {
private static final ThrustCurveMotor motor3 = new ThrustCurveMotor.Builder()
.setManufacturer(Manufacturer.getManufacturer("A"))
.setDesignation("F12")
.setCode("F12")
.setDescription("Desc")
.setMotorType(Motor.Type.UNKNOWN)
.setStandardDelays(new double[] { 0, Motor.PLUGGED_DELAY })
@ -65,7 +67,7 @@ public class ThrustCurveMotorSetTest {
private static final ThrustCurveMotor motor4 = new ThrustCurveMotor.Builder()
.setManufacturer(Manufacturer.getManufacturer("A"))
.setDesignation("F12")
.setDesignation("Desc")
.setDescription("Desc")
.setMotorType(Motor.Type.HYBRID)
.setStandardDelays(new double[] { 0 })
.setDiameter(0.024)
@ -75,20 +77,7 @@ public class ThrustCurveMotorSetTest {
.setCGPoints(new Coordinate[] { Coordinate.NUL, Coordinate.NUL, Coordinate.NUL })
.setDigest("digestD")
.build();
@Test
public void testSimplifyDesignation() {
assertEquals("J115", ThrustCurveMotorSet.simplifyDesignation("J115"));
assertEquals("J115", ThrustCurveMotorSet.simplifyDesignation(" J115 "));
assertEquals("H115", ThrustCurveMotorSet.simplifyDesignation("241H115-KS"));
assertEquals("J115", ThrustCurveMotorSet.simplifyDesignation("384 J115"));
assertEquals("J115", ThrustCurveMotorSet.simplifyDesignation("384-J115"));
assertEquals("A2", ThrustCurveMotorSet.simplifyDesignation("A2T"));
assertEquals("1/2A2T", ThrustCurveMotorSet.simplifyDesignation("1/2A2T"));
assertEquals("MicroMaxxII", ThrustCurveMotorSet.simplifyDesignation("Micro Maxx II"));
}
@Test
public void testAdding() {
ThrustCurveMotorSet set = new ThrustCurveMotorSet();
@ -108,7 +97,7 @@ public class ThrustCurveMotorSetTest {
assertEquals(1, set.getMotors().size());
assertEquals(motor1, set.getMotors().get(0));
assertEquals(Collections.emptyList(), set.getDelays());
// Add motor1 again
assertTrue(set.matches(motor1));
set.addMotor(motor1);
@ -120,12 +109,12 @@ public class ThrustCurveMotorSetTest {
assertEquals(1, set.getMotors().size());
assertEquals(motor1, set.getMotors().get(0));
assertEquals(Collections.emptyList(), set.getDelays());
// Add motor2
assertTrue(set.matches(motor2));
set.addMotor(motor2);
assertEquals(motor1.getManufacturer(), set.getManufacturer());
assertEquals(motor3.getDesignation(), set.getDesignation());
assertEquals(motor3.getCommonName(), set.getCommonName());
assertEquals(Motor.Type.SINGLE, set.getType());
assertEquals(motor1.getDiameter(), set.getDiameter(), 0.00001);
assertEquals(motor1.getLength(), set.getLength(), 0.00001);
@ -133,21 +122,26 @@ public class ThrustCurveMotorSetTest {
assertEquals(motor2, set.getMotors().get(0));
assertEquals(motor1, set.getMotors().get(1));
assertEquals(Arrays.asList(5.0), set.getDelays());
// Add motor3
assertTrue(set.matches(motor3));
set.addMotor(motor3);
assertEquals(motor1.getManufacturer(), set.getManufacturer());
assertEquals(motor3.getDesignation(), set.getDesignation());
assertEquals(motor3.getCommonName(), set.getCommonName());
assertEquals(Motor.Type.SINGLE, set.getType());
assertEquals(motor1.getDiameter(), set.getDiameter(), 0.00001);
assertEquals(motor1.getLength(), set.getLength(), 0.00001);
assertEquals(3, set.getMotors().size());
System.out.println("motor set");
System.out.println(set.getMotors());
System.out.println(motor3);
System.out.println(motor2);
System.out.println(motor1);
assertEquals(motor3, set.getMotors().get(0));
assertEquals(motor2, set.getMotors().get(1));
assertEquals(motor1, set.getMotors().get(2));
assertEquals(Arrays.asList(0.0, 5.0, Motor.PLUGGED_DELAY), set.getDelays());
// Test that adding motor4 fails
assertFalse(set.matches(motor4));
try {

View File

@ -186,4 +186,16 @@ public class ThrustCurveMotorTest {
}
@Test
public void testSimplifyDesignation() {
assertEquals("J115", ThrustCurveMotor.Builder.simplifyDesignation("J115"));
assertEquals("J115", ThrustCurveMotor.Builder.simplifyDesignation(" J115 "));
assertEquals("H115", ThrustCurveMotor.Builder.simplifyDesignation("241H115-KS"));
assertEquals("J115", ThrustCurveMotor.Builder.simplifyDesignation("384 J115"));
assertEquals("J115", ThrustCurveMotor.Builder.simplifyDesignation("384-J115"));
assertEquals("A2", ThrustCurveMotor.Builder.simplifyDesignation("A2T"));
assertEquals("1/2A2T", ThrustCurveMotor.Builder.simplifyDesignation("1/2A2T"));
assertEquals("MicroMaxxII", ThrustCurveMotor.Builder.simplifyDesignation("Micro Maxx II"));
}
}

View File

@ -22,7 +22,7 @@ class MotorHolder {
@Override
public String toString() {
return motor.getDesignation();
return motor.getCommonName();
}
@Override

View File

@ -50,7 +50,8 @@ class MotorInformationPanel extends JPanel {
private List<ThrustCurveMotor> selectedMotorSet;
// Selected motor
private ThrustCurveMotor selectedMotor;
private final JLabel designationLabel;
private final JLabel totalImpulseLabel;
private final JLabel classificationLabel;
private final JLabel avgThrustLabel;
@ -76,8 +77,13 @@ class MotorInformationPanel extends JPanel {
super(new MigLayout("fill"));
// Thrust curve info
//// Total impulse:
{
//// Designation
this.add(new JLabel(trans.get("TCMotorSelPan.lbl.Designation")));
designationLabel = new JLabel();
this.add(designationLabel, "wrap");
//// Total impulse:
this.add(new JLabel(trans.get("TCMotorSelPan.lbl.Totalimpulse")));
totalImpulseLabel = new JLabel();
this.add(totalImpulseLabel, "split");
@ -223,6 +229,7 @@ class MotorInformationPanel extends JPanel {
public void clearData() {
selectedMotor = null;
selectedMotorSet = null;
designationLabel.setText("");
totalImpulseLabel.setText("");
totalImpulseLabel.setToolTipText(null);
classificationLabel.setText("");
@ -254,6 +261,7 @@ class MotorInformationPanel extends JPanel {
this.selectedMotor = selectedMotor;
// Update thrust curve data
designationLabel.setText(selectedMotor.getDesignation());
double impulse = selectedMotor.getTotalImpulseEstimate();
MotorClass mc = MotorClass.getMotorClass(impulse);
totalImpulseLabel.setText(UnitGroup.UNITS_IMPULSE.getDefaultUnit().toStringUnit(impulse));

View File

@ -30,11 +30,11 @@ enum ThrustCurveMotorColumns {
return Collator.getInstance();
}
},
//// Designation
DESIGNATION("TCurveMotorCol.DESIGNATION") {
//// Common name
COMMON_NAME("TCurveMotorCol.COMMON_NAME") {
@Override
public String getValue(ThrustCurveMotorSet m) {
return m.getDesignation();
return m.getCommonName();
}
@Override

View File

@ -308,7 +308,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
throw new NullPointerException("Motor has a null mount... this should never happen: "+curMotorInstance.getID());
}
String str = motor.getDesignation(curMotorInstance.getEjectionDelay());
String str = motor.getCommonName(curMotorInstance.getEjectionDelay());
int count = mount.getInstanceCount();
if (count > 1) {
str = "" + count + Chars.TIMES + " " + str;