Write Number Function

Similar documents
Exercise 2. Read Text Record. read_text_record( records.out.01 )

Group Elements EXERCISE 12. Objectives:

The Select Files Form

EXERCISE 4. Create Lug Geometry. Objective: Write a function to create the geometry of the lug. PATRAN 304 Exercise Workbook 4-1

Load Lug Model EXERCISE 6. Objective: Write a function to apply the loads and element properties to the finite element mesh of the lug.

Creating Nodal Results

Apply Load Function Graphical User Interface

Importing Results using a Results Template

Cylinder with T-Beam Stiffeners

Lug Model EXERCISE 15. Objectives: Class clevis_ui. Class dimension. Class clevis_loads. lug_create ( ) lug_mesh ( ) lug_load ( )

Time Dependent Boundary Conditions

Post-Buckling Analysis of a Thin Plate

Linear Bifurcation Buckling Analysis of Thin Plate

Multi-Step Analysis of a Cantilever Beam

APPENDIX B. PBEAML Exercise. MSC.Nastran 105 Exercise Workbook B-1

Materials, Load Cases and LBC Assignment

Animating Results with Insight

The Essence of Result Post- Processing

Merging Databases LESSON 2. Objectives: Construct two databases which have distinct similarities and differences.

Post-Processing of Time-Dependent Results

Restarting a Linear Static Analysis of a Simply- Supported Stiffened Plate

Construct Hybrid Microcircuit Geometry

Post Processing of Results

Verification and Property Assignment

Spring Element with Nonlinear Analysis Parameters (Multi-Step Analysis)

Normal Modes Analysis of a Simply-Supported Stiffened Plate

Alternate Bar Orientations

Nonlinear Creep Analysis

A Sprinkler System Hydraulic Analysis

Post-Processing Modal Results of a Space Satellite

Transient Response of a Rocket

Normal Modes with Differential Stiffness

Importing a PATRAN 2.5 Model into P3

Sliding Block LESSON 26. Objectives: Demonstrate the use of Contact LBCs in a simple exercise.

Modifying Unigraphics Parameters and Features

Static and Normal Mode Analysis of a Space Satellite

Elasto-Plastic Deformation of a Thin Plate

Getting Started LESSON 1. Objectives: In this exercise you will perform the following tasks. Access MSC PATRAN and run a Session File.

Static and Normal Mode Analysis of a Space Satellite

Write a Portion of the Pat3mir Translator

Post Processing of Stress Results

Normal Modes - Rigid Element Analysis with RBE2 and CONM2

Composite Trimmed Surfaces

Tutorial 2: Compiling and Running C++ Source Code

Transient and Modal Animation

Spatial Variation of Physical Properties

Spatial Variation of Physical Properties

Elastic Stability of a Plate

Stiffened Plate With Pressure Loading

Direct Transient Response Analysis

Loads and Boundary Conditions on a 3-D Clevis

Introduction to MSC.Patran

Modeling a Shell to a Solid Element Transition

Post Processing of Displacement Results

Temperature Dependent Material Properties

Elasto-Plastic Deformation of a Truss Structure

Helical Spring. Supplementary Exercise - 6. Objective: Develop model of a helical spring

Linear Static Analysis of a Simply-Supported Truss

Views of a 3-D Clevis

Modal Transient Response Analysis

Comparison of Two Heat Sink Designs

Using Notes. System: Using CounterPoint. Overview. Adding notes

BEG 6. 50p. Getting Started with the Emacs Screen Editor. An introduction to the Emacs screen editor, which is available on Unix systems.

Post Processing of Stress Results With Results

Modal Analysis of a Beam (SI Units)

Linear Buckling Load Analysis (without spring)

Linear and Nonlinear Analysis of a Cantilever Beam

Steady State Radiative Boundary Conditions

Heat Transfer Analysis of a Pipe

Load Analysis of a Beam (using a point force and moment)

Tutorial 1: Unix Basics

Building the Finite Element Model of a Space Satellite

WORKSHOP 33 A1 A2 A1. Subcase 1 4 Subcase 2 X: -16,000 lbs. X: 16,000 lbs Y: -12,000 lbs. Y: -12,000 lbs. Objectives:

Projected Coordinate Systems

Linear Static Analysis of a Spring Element (CELAS)

Thermal Analysis using Imported CAD Geometry

Building the Finite Element Model of a Space Satellite

Normal Modes - Rigid Element Analysis with RBE2 and CONM2

LogiQL programs and the workspaces they deal with are managed by

Sliding Split Tube Telescope

Modal Transient Response Analysis

Using Groups and Lists

Modal Analysis of A Flat Plate using Static Reduction

Lab 1 Introduction to UNIX and C

Operating System Interaction via bash

Healthcare Desktop Office GPO Templates for GPMC v1

Module Compiler Relative Placement Flow

9.2 Linux Essentials Exam Objectives

AMS 200: Working on Linux/Unix Machines

Mills HPC Tutorial Series. Linux Basics I

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Post Processing of Displacement Results

Short Version of Matlab Manual

Direct Transient Response Analysis

Normal Modes - Rigid Element Analysis with RBE2 and CONM2

Importing Geometry from an IGES file

4. COMPILING AND RUNNING FORTRAN PROGRAMS

Importing Geometry from an IGES file

Shear and Moment Reactions - Linear Static Analysis with RBE3

Total Life (S-N) Analysis of Keyhole Specimen

Transcription:

EXERCISE 1 Write Number Function write_number (5, this is record number ) this is record number 1 this is record number 2 this is record number 3 this is record number 4 this is record number 5 Objectives: Write a function to open an external file called records.out. Write a given number of records to the file. PATRAN 304 Exercise Workbook 1-1

1-2 PATRAN 304 Exercise Workbook

EXERCISE 1 Write Number Function Exercise Description: The function, write_number (max_number, leading_text) will have two parameters, an integer for the number of records, and a string of text to identify the records. You will create a unique file, and write a unique line for each record. Finally, send a message to the command window informing the user that the execution of the function is completed. The test case for this function is: For number of records = 5 and identifier this is record number the output file should contain: this is record number 1 this is record number 2 this is record number 3 this is record number 4 this is record number 5 Files: All the files that used in this exercise are listed below. Each list includes the file, where it originated, and a summary of information of how it relates to the exercise. File Supplied/Create Description write_number.pcl Create Create a file that contains a PCL function. records.out.01 Created This file is created when the PCL function is executed. Exercise Procedure: 1. Enter the vi editor and create apcl function in a file called write_number.pcl. There are quick reference pages for vi and UNIX in the appendix of this workbook for your reference. 2. Compile the function. Start the PCL compiler by typing p3pclcomp in your xterm window. 3. Enter the command!!input write_number.pcl at the p3pclcomp PATRAN 304 Exercise Workbook 1-3

prompt: %p3pclcomp P3/PCL Compiler Release 1.4 Exit or ctrl-d to quit ->!!input write_number.pcl Compiling: write_number Compiled: write_number -> All the error messages and diagnostics will be written to the xterm window If a function is to be used repeatedly, it is possible to add it to a library. To create a library with this function, or add this function to an existing library, enter this command instead:!!compile write_number.pcl into pat304.plb Then continue to add each new function to the library. When the functions inside a given library are to be used, the library should be referenced using the following command in the PATRAN command window: -> exit!!library pat304.lib Type exit at the p3pclcomp prompt: 4. Start MSC/PATRAN by typing p3 at the xterm prompt 5. Enter the command:!!input write_number.pcl 6. Then enter the following at the command line: write_number(5, this is record number ) Once executed, PATRAN should return this message $#5 records written to records.out.01 1-4 PATRAN 304 Exercise Workbook

EXERCISE 1 Write Number Function : PATRAN File Group Viewport Viewing Display Preferences Tools Help Geometry Finite Elements Loads/BCs Materials Properties Load Cases Fields Results Insight XY write_number(5, this is record number ) $# Write number completed $# 5 records written to records.out.01 Change to your xterm window and type: The file should contain: this is record number 1 this is record number 2 this is record number 3 this is record number 4 this is record number 5 %more records.out.01 PATRAN 304 Exercise Workbook 1-5

Sample Solution: FUNCTION write_number(max_number, leading_text) / Purpose: This function opens an external file in the current working directory called records.out and writes max_number records of a format as follows: this is record number 1 this is record number 2 this is record number 3 this is record number 4 this is record number 5 (if leading_text is this is record number and max_number = 5) Input: max_number I max_number of records leading_text S prefix on each record Output: none Side Effects: The file records.out is either created or the version incremented and the above described records are written to it. Errors: Return 0, no error Otherwise it is a file utility error / INTEGER max_number STRING leading_text[] STRING filename[80], outstr[720] INTEGER rec, channel / Build a filename with version number and open the external file / file_build_fname(, records, out, NV, filename) text_open(filename, NOW, 0, 0, channel) / Loop to max_number and write concatenated string / FOR (rec = 1 TO max_number) outstr = leading_text// //STR_FROM_INTEGER(rec) text_write_string(channel, outstr) END FOR / Close the external file / text_close(channel, ) 1-6 PATRAN 304 Exercise Workbook

EXERCISE 1 Write Number Function / Tell user complete / ui_write( Write_number completed. ) ui_write(str_from_integer(rec-1)// records written to //@ filename) RETURN 0 END FUNCTION PATRAN 304 Exercise Workbook 1-7

1-8 PATRAN 304 Exercise Workbook