From 5787ade45a93262c5c360b197a45e45f5f8f7a98 Mon Sep 17 00:00:00 2001 From: James Goppert <jgoppert@l1.hsl.dynalias.com> Date: Wed, 17 Aug 2011 01:04:47 -0400 Subject: [PATCH] Improved post processing. --- .gitignore | 3 + scripts/737_cruise_steady_turn_simplex.xml | 78 ++++++++++++++++++++++ src/utilities/post_process.sh | 21 ++++-- 3 files changed, 95 insertions(+), 7 deletions(-) create mode 100755 scripts/737_cruise_steady_turn_simplex.xml diff --git a/.gitignore b/.gitignore index b9be357..f733ab5 100644 --- a/.gitignore +++ b/.gitignore @@ -15,8 +15,11 @@ src/JSBSim* src/FGComm* src/Trim* +prep_plot # Generated Files +*.csv +*.pdf *.tgz *.deb setup diff --git a/scripts/737_cruise_steady_turn_simplex.xml b/scripts/737_cruise_steady_turn_simplex.xml new file mode 100755 index 0000000..a8fdae7 --- /dev/null +++ b/scripts/737_cruise_steady_turn_simplex.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="utf-8"?> +<?xml-stylesheet type="text/xsl" href="http://jsbsim.sf.net/JSBSimScript.xsl"?> +<runscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://jsbsim.sf.net/JSBSimScript.xsd" + name="Cruise flight with steady turn in 737."> + + <description> + This is a very simple script that trims the aircraft with running + engines at altitude and runs out to 100 seconds. Some state data + is printed out at ten second intervals. + </description> + + <use aircraft="737" initialize="cruise_steady_turn_init"/> + + <run start="0" end="100" dt="0.008333"> + + <property value="0"> simulation/notify-time-trigger </property> + + <event name="Set engines running"> + <condition> simulation/sim-time-sec le 0.1 </condition> + <set name="propulsion/engine[0]/set-running" value="1"/> + <set name="propulsion/engine[1]/set-running" value="1"/> + <notify/> + </event> + + <!-- + For "do_simple_trim" (Classic trim): + 0: Longitudinal + 1: Full + 2: Ground + 3: Pullup + 4: Custom + 5: Turn + 6: None + --> + + <event name="Trim"> + <condition> + simulation/sim-time-sec gt 0.1 + </condition> + <set name="simulation/do_simplex_trim" value="5"/> + <delay>5.0</delay> + <notify> + <property>propulsion/engine[0]/n2</property> + <property>propulsion/engine[1]/n2</property> + <property>propulsion/engine[0]/thrust-lbs</property> + <property>propulsion/engine[1]/thrust-lbs</property> + <property>velocities/vc-kts</property> + <property>velocities/vc-fps</property> + <property>velocities/vt-fps</property> + <property>attitude/phi-rad</property> + <property>attitude/theta-rad</property> + <property>attitude/psi-rad</property> + </notify> + </event> + + <event name="Repeating Notify" persistent="true"> + <description>Output message at 5 second intervals</description> + <notify> + <property>propulsion/engine[0]/n2</property> + <property>propulsion/engine[1]/n2</property> + <property>propulsion/engine[0]/thrust-lbs</property> + <property>propulsion/engine[1]/thrust-lbs</property> + <property>position/h-agl-ft</property> + <property>velocities/vc-kts</property> + <property>velocities/vc-fps</property> + <property>velocities/vt-fps</property> + <property>attitude/phi-rad</property> + <property>attitude/theta-rad</property> + <property>attitude/psi-rad</property> + </notify> + <condition> simulation/sim-time-sec >= simulation/notify-time-trigger </condition> + <set name="simulation/notify-time-trigger" value="5" type="FG_DELTA"/> + </event> + + </run> + +</runscript> diff --git a/src/utilities/post_process.sh b/src/utilities/post_process.sh index 537f430..5866b88 100755 --- a/src/utilities/post_process.sh +++ b/src/utilities/post_process.sh @@ -1,19 +1,26 @@ #!/bin/bash +PREP_PLOT=./src/utilities/prep_plot + # prepare plots from data -for file in $(ls *.csv) +for file in $(ls *.csv | sed s/\.csv//g) do - echo $file - if [ -f data_plot/$file:r.xml ] + echo $file post processing + if [ -f data_plot/$file.xml ] then - echo preparing plot for: $file - prep_plot $file --plot=data_plot/$file:r.xml | gnuplot + echo -e "\tusing xml style: $file.xml" + $PREP_PLOT $file.csv --plot=data_plot/$file.xml | gnuplot + else + echo -e "\tusing comprehensive plot" + $PREP_PLOT $file.csv --comp | gnuplot fi done # convert ps to pdf -for file in $(ls *.ps) +for file in $(ls *.ps | sed s/\.ps//g) do - gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$file.pdf $file + echo -e "\tconverting to pdf: $file" + gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$file.pdf $file.ps + rm $file.ps done # vim:ts=4:sw=4:expandtab -- GitLab