Beispiel #1
0
def command_line():
    import argparse

    argparser = argparse.ArgumentParser()
    argparser.add_argument("result", help="the result.mat file")
    args = argparser.parse_args()

    matFile = DyMatFile(os.path.abspath(args.result))
    x = matFile.data('p.r_r[1]')
    z = matFile.data('p.r_r[3]')

    ax = plt.subplot(111)
    formatter = EngFormatter(unit='m', places=1)
    ax.xaxis.set_major_formatter(formatter)
    ax.yaxis.set_major_formatter(formatter)
    ax.plot(x, -z)
    plt.xlabel('x')
    plt.ylabel('-z')
    plt.title('trajectory of ' + args.result)
    plt.grid()
    plt.show()
Beispiel #2
0
        Parts.RigidLink_B321 t(
          angles={{ {motorAngle}, {motorAngle}, {motorAngle} }},
          r_a={{ {motorX}, {motorX}, {motorX} }});
      equation
        connect(p.fA,structure.fA);
        connect(structure.fA,t.fA);
        connect(t.fB,motor.fA);
      end Rocket;
    ")""".format(**val_dict))

        result = shell.execute(
            "simulate(Rocket,stopTime=1,numberOfIntervals=1000)")
        resultFile = get(result, "SimulationResults.resultFile")[1:-1]
        resultFile = os.path.splitext(resultFile)[0]

        matFile = DyMatFile(resultFile)
        timeTillFailure[motorXIndex][motorAngleIndex] = matFile.abscissa(
            'p.r_r[1]', valuesOnly=True)[-1]
        x = matFile.data('p.r_r[1]')
        y = matFile.data('p.r_r[2]')
        agl = matFile.data('p.agl')

        fig1 = plt.figure()
        a1 = fig1.add_subplot(111)
        a1.set_title('x: {motorX}, angle: {motorAngle}'.format(**val_dict))
        a1.set_xlabel('x')
        a1.set_ylabel('agl')
        a1.xaxis.set_major_formatter(formatter_m)
        a1.yaxis.set_major_formatter(formatter_m)
        a1.plot(x, agl)
        a1.grid()
Beispiel #3
0
 def acquire_result(self, result_id=None):
     """Loads the result file dropped by the executable"""
     if result_id is None:
         result_id = self.result_tag
     return DyMatFile(self.get_result_path(result_id))