msd FileWrapper

This is an example FileWrapper file for a C++ program called msd, a Mass Spring Damper solver.

Download Windows Binary Package(msd.zip)     Download UNIX Source Package(msd_src.tgz)
NOTE: Some platforms include the msd package in the default analyses directory.

The FileWrapper File

#
# This is an example of a simple FileWrapper. The FileWrapper
# wraps the msd input and output files and extracts some
# basic information.
#
# @author: Phoenix Integration
# @version: Training
# @description: mass-spring-damper analysis
# @keywords: msd, training
# @helpURL www.phoenix-int.com

RunCommands
{
    generate msdin
    run "msd"
    parse msdout
}

RowFieldInputFile msdin
{
   templateFile: msd.in.template
   fileToGenerate: msd.in

   variable: k      double 7 2  description="stiffness coefficient" lowerBound=0
   variable: c      double 8 2  description="damping coefficient" lowerBound=0
   variable: m      double 9 2  description="mass" lowerBound=0
   variable: x0     double 10 2 description="initial position"
   variable: v0     double 11 2 description="initial velocity"
   variable: force  double 12 2 description="magnitude of forcing function"
   variable: w      double 13 2 description="forcing frequency"
   variable: tStart double 16 2 description="simulation start time"
   variable: tEnd   double 17 2 description="simulation end time"
   variable: tStep  double 18 2 description="simulation step size"
}

RowFieldOutputFile msdout
{
   fileToParse: msd.out

   markAsBeginning "calculated parameters"
   setDelimiters " ="
   keyVar: wN       double "wN"   description="natural frequency"
   keyVar: wD       double "wD"   description="damped natural frequency"
   keyVar: xMag     double "xMag" description="magnitude of steady-state oscillation"

   markAsBeginning "time"
   setDelimiters " \t"
   array: x      double  3:-1 2 description="x position"
   array: x_ss   double  3:-1 3 description="x steady-state position"
   array: x_trans double 3:-1 4 description="x transient position"
}

The Input File

#
# Mass-Spring-Damper analysis input file
#
#

# mass-damper information
k: 1
c: 1
m: 1
x0: 0
v0: 1
force: 1
w: 60

# time-step information
tStart: 0
tEnd: 10
tStep: 1

The Output File

# Mass-Spring-Damper Analysis Results
# Mon Oct 07 13:39:35 2002
#
#INPUT: #
#INPUT: # Mass-Spring-Damper analysis input file
#INPUT: #
#INPUT: #
#INPUT: 
#INPUT: # mass-damper information
#INPUT: k: 1.0
#INPUT: c: 1.0
#INPUT: m: 1.0
#INPUT: x0: 0.0
#INPUT: v0: 1.0
#INPUT: force: 1.0
#INPUT: w: 60.0
#INPUT: 
#INPUT: # time-step information
#INPUT: tStart: 0.0
#INPUT: tEnd: 10.0
#INPUT: tStep: 1.0
#INPUT: 

# calculated parameters
wN=1.000000
wD=0.866025
zeta=0.500000
xMag=0.000196
phi=3.124923

time      x           x-ss        x-trans
--------  ----------  ----------  ----------
0.000000  -3.275e-006  -3.275e-006  0.000e+000
1.000000  5.336e-001  6.299e-005  5.335e-001
2.000000  4.192e-001  -1.167e-004  4.193e-001
3.000000  1.334e-001  1.593e-004  1.332e-001
4.000000  -4.972e-002  -1.868e-004  -4.953e-002
5.000000  -8.775e-002  1.964e-004  -8.794e-002
6.000000  -5.108e-002  -1.874e-004  -5.089e-002
7.000000  -7.483e-003  1.606e-004  -7.644e-003
8.000000  1.260e-002  -1.184e-004  1.272e-002
9.000000  1.287e-002  6.501e-005  1.280e-002

See also Analysis Server | FileWrapper | FileWrapper Commands