Put a 0 thrust at the end of an eng
authorBill Kuker <bkuker@billkuker.com>
Tue, 14 Feb 2012 18:44:43 +0000 (18:44 +0000)
committerBill Kuker <bkuker@billkuker.com>
Tue, 14 Feb 2012 18:44:43 +0000 (18:44 +0000)
src/com/billkuker/rocketry/motorsim/io/ENGExporter.java

index 35f896547523f3baef741907a91255f4eadae10b..043040eaa60813135f782e8c313fae2524a6a7e8 100644 (file)
@@ -71,6 +71,7 @@ public class ENGExporter {
                }
 
                int cnt = 0;
+               double lastTime = 0;
                for (Amount<Duration> t : gs.getDomain()) {
                        cnt++;
                        double thrust = gs.value(t).doubleValue(SI.NEWTON);
@@ -78,11 +79,17 @@ public class ENGExporter {
                                continue; // This is a hack to ignore 0 thrust early in burn
                        }
                        out.append("   ");
-                       out.append(nf.format(t.doubleValue(SI.SECOND)));
+                       out.append(nf.format(lastTime = t.doubleValue(SI.SECOND)));
                        out.append(" ");
                        out.append(nf.format(thrust));
                        out.append("\n");
                }
+               
+               out.append("   ");
+               out.append(nf.format(lastTime + 0.01));
+               out.append(" ");
+               out.append(nf.format(0.0));
+               out.append("\n");
                out.append(";\n\n");
 
                os.write(out.toString().getBytes());