hypersizer tutorial scripting spreadsheet utilities

72
© 2012 Collier Research Corp. HyperSizer Tutorial Scripting Spreadsheet Utilities Collier Research Corporation Hampton, VA

Upload: others

Post on 16-Oct-2021

19 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2012 Collier Research Corp.

HyperSizer Tutorial Scripting Spreadsheet Utilities Collier Research Corporation Hampton, VA

Page 2: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Scripting

2

Page 3: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Scripting

3

Provides programmatic interface to automate common tasks

Scripting

User Interaction

components = project.Components component = components.GetComponent(205) component.Size()

Page 4: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Object Model

4

Application

Components

Projects

Assemblies

Isotropics

Foams

Honeycombs

Orthotropics

Laminates

Materials

Groups

Page 5: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Technical Details

5

• Built on COM Technology (Component Object Model) • Windows technology the enables language independent

interoperability

• Programming Language Support • VBA (Excel) • C# • MATLAB • Python • IronPython

Page 6: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Sample Code: MATLAB

6

function RunHyperSizer(databasePath, projectName)

% Open HyperSizer.exe.

hs = actxserver('HyperSizer.Application');

while(hs.AutomationMode == false)

hs = actxserver('HyperSizer.Application');

end

% Login and open the database.

hs.Login('HyperSizer Admin', '');

hs.OpenDatabase(databasePath);

% Retrieve the project by name.

project = hs.Projects.GetProject(projectName);

% Size the project.

project.Size();

Page 7: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Sample Code: Python

7

import win32com.client

def run_hypersizer(database_path, project_name)

# Open HyperSizer.exe.

hs = win32com.client.Dispatch('HyperSizer.Application')

while hs.AutomationMode == False:

hs = win32com.client.Dispatch('HyperSizer.Application')

# Login and open the database.

hs.Login('HyperSizer Admin', '')

hs.OpenDatabase(database_path)

# Retrieve the project by name.

project = hs.Projects.GetProject(project_name)

# Size the project.

project.Size()

Page 8: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Sample Code: Excel VBA

8

Public Sub RunHyperSizer(strDatabasePath as string, strProjectName as String)

Dim objHs As HyperSizer.Application

Dim objProject As HyperSizer.Project

' Start the HyperSizer.exe.

Set objHs = New HyperSizer.Application

Do While objHs.AutomationMode = False

Set objHs = New HyperSizer.Application

Loop

' Login and open the database.

objHs.Login "HyperSizer Admin", ""

objHs.OpenDatabase strDatabasePath

' Retrieve the project by name.

Set objProject = objHs.Projects.Item(strProjectName)

‘ Size the project

objProject.Size()

End Sub

Page 9: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Sample Code: C#

9

void RunHyperSizer(string databasePath, string projectName)

{

// Start HyperSizer.exe.

var hs = new HyperSizer.Application();

while (hs.AutomationMode == false)

hs = new HyperSizer.Application();

// Login and open the database.

hs.Login("HyperSizer Admin", "", "");

hs.OpenDatabase(sDatabaseName);

// Retrieve the project by name.

var project = hs.Project.GetProject(projectName);

// Size the project.

project.Size();

}

Page 10: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Use Cases

10

• Projects • Configure load cases based on subcase definitions (load sets) • Iterate with FEA

• Materials • Create materials from an external data source • Modify temperature dependent properties

• Assemblies • Run quick sizing, set variables, and detailed sizing

• Components • Get individual margins of safety • Set and set design-to loads • Get resultant design – geometry and materials • Set buckling spans, knockdowns factors, load factors, etc.

• Groups • Assign panel/beam concepts • Create and assign components • Set sizing variables and candidate materials

Page 11: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Benefits

11

• Compatible with almost any programming environment

• Automate data input, output

• Can be used to integrate HyperSizer inside of external processes

Page 12: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Scripting Documentation

12

• http://hypersizer.com/help/index_CSH.php#COM/com-jump.php

Page 13: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Scripting Documentation

13

Page 14: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Spreadsheet Utilities

14

• Collection of worksheet performing various function usin the object model.

• Available online.

Page 15: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Application: Crippling Validation

15

• Crippling specimen geometry input for test validation (100+)

HyperSizer test data histogram (Failure load / Predicted load)

Page 16: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Application: Crippling Validation

16

• Challenges • Cross section dimensioning

• Ex: Convert centerline height to total height

• Load • Ex: Convert total applied load (F)

to panel running load (F/L)

• Uncertainty of inputs • Ex: Should I use nominal ply

thickness or measured ply thickness?

Page 17: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Automated Input: Crippling Validation

17

• Spreadsheet + Scripting • Store source data • Convert data to HyperSizer convention • Push data into database

Page 18: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Tutorial

18

Page 19: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Tutorial Overview

19

Task: Upload crippling data into HyperSizer to view the test data correlation

Create AS4/3502 tape

material and layups

Create a workspace with 21 beams.

Assign dimensions, loads, and materials to beams.

View the test data correlation.

Export the crippling predictions to a spreadsheet.

Majority of tasks automated with spreadsheet.

Page 20: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Open a Database

1. Open or create a new HyperSizer database.

20

Page 21: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Create a New Orthotropic Material

1. Browse to the “Graphite/Epoxy” Orthotropic material family.

2. Right-click and select Create Material in “Graphite/Epoxy”

21

Page 22: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Create a New Orthotropic Material (cont.)

1. Click the Create New radio button.

2. Click OK.

22

1 2

Page 23: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Create the “Typical” Ply Material

1. Name the material “Wieland_AS4/3502 Tape_Typical”

2. Set the Thickness to 0.00525”.

3. Set the Density is 0.057 lb/in3.

23

1

2

3

Page 24: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Enter the Stiffness Properties

1. Enter the following lamina stiffness properties.

24

Page 25: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Enter the Lamina Stress Allowables

1. Enter the following lamina stress allowables.

25

Page 26: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Compute the Lamina Strain Allowables

1. Go to the Lamina Strain Allowables I tab.

2. Click Apply Linear Stress/Strain Relationship.

Strain allowables are automatically computed using the current lamina stress and stiffness values.

26

2

Page 27: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Enter the Thermal Expansion Coefficients

1. Go to the Thermal tab.

2. Enter the following thermal properties.

27

Page 28: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Save the Material

1. Click Save

2. Close the form.

28

1

Page 29: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

• We have a created a tape material with “typical” or average material properties. This is appropriate because we are doing a test data correlation where we hope to hit the average test result.

• Next we will create some laminates. We will do this using the object model spreadsheet.

29

Create AS4/3502 tape material and

layups Create a workspace

with 21 beams. Assign dimensions,

loads, and materials to beams.

View the test data correlation.

Export the crippling predictions to a spreadsheet.

Page 30: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Open the Spreadsheet

1. Open the spreadsheet

2. Go to the Sign In worksheet.

3. Verify that the user name and password is valid.

4. A blank workgroup means that the default will be used. This is sufficient for most users.

Most users will not have to change anything here.

30

Page 31: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

(Optional) View the Code-Behind

1. On the keyboard press [Alt + F11]. The Microsoft Visual Basic Editor will appear. All the code used to run the spreadsheet is located here. Interested users learn how the code works by setting break points (left-click next to a line of code).

31

Page 32: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

(Optional) View the Object Browser 1. In the Editor select View | Object Browser.

2. Select HyperSizer from the drop-down menu. Here you can browse all of the classes in the object model.

32

2

1

Page 33: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

(Optional) View the Reference to HyperSizer

1. In the main toolbar select Tools | References.

2. Note the reference to the HyperSizer object model. The spreadsheet will not work if this reference is missing.

3. Click Cancel.

4. Close the Visual Basic Editor.

33

Page 34: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

• The spreadsheet contains a wealth of code examples using the object model.

• The rest of the tutorial will not deal with programming.

• Users interested in coding their own applications should refer to the Getting Started of the Programming customization documentation coding tutorials for Excel VBA, MATLAB, Python, and C#.

34

Page 35: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Create Laminates

1. Go to the Upload Laminates tab.

2. Delete the contents of the Database, Material Name, and Date cells.

3. Delete all the data below the header row.

35

3

2

Page 36: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Copy Ply Angles

1. Go to the “Wieland Data” worksheet.

2. Scroll down the laminate stacking sequences

3. Copy the Wieland layup data to the Upload Laminates worksheet as shown below.

36

copy

Page 37: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Browse to the Database

1. In the Upload Laminates worksheet, click Open Database Browser.

37

1

Page 38: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Browse to the Database (cont.)

1. Click the ellipsis next to the database field.

2. Browse your database and click OK.

3. Click OK. The database path is now located in the worksheet.

38

2

1

Page 39: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Select the Tape Material

1. Enter “Wieland_AS4/3502 Tape_Typical” as the tape material. Copy and paste the name from HyperSizer to avoid spelling errors.

39

Page 40: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

• Before we perform the operation, make sure the database, taper material, and laminate definition rows are populated.

• The Database Browser form is used to populate the inputs for each worksheet in the spreadsheet.

40

Page 41: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Create the Laminates

1. (Optional) Close the database in HyperSizer (File | Close Database).

2. In the spreadsheet, click Operate on Composites.

3. Click OK.

41

1 2

Page 42: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

• Verify that you have 3 new laminates in the database.

• They are located in the “User Laminates” material family.

42

Page 43: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint (cont.)

• Next we will create a new non-FEA project with 21 beam components representing the crippling specimens.

43

Create AS4/3502 tape material and

layups

Create a workspace with 21

beams.

Assign dimensions, loads, and

materials to beams. View the test data

correlation. Export the crippling

predictions to a spreadsheet.

Page 44: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Create the Project

1. Right-click on Non-FEA Projects and select Create Non-FEA Project.

2. Enter “Wieland Crippling” for the project name.

3. Click OK.

44

Page 45: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Go to the Sizing Form

1. Right-click the project name and select Sizing Form.

45

Page 46: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Create an Assembly

1. In the Home tab click Create.

2. Name the assembly “All”.

3. Click OK.

4. Select components 301 through 321.

5. Click OK.

46

Page 47: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set Assembly Mode

1. Set the assembly analysis mode to Composite.

2. Set the assembly sizing mode to Final Analysis.

47

1 2

Page 48: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set the Beam Concept

1. Click the Select Concept ellipsis (…).

2. Select the Z Beam concept.

3. Select Apply to Assembly.

4. Click OK.

48

1 2

3

Page 49: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

• The Dimension tab should be as shown below. • Composite mode • Final Analysis mode • 21 Z-beam components

49

Page 50: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

• With the beam components created, we can now assign materials, dimensions, and loads.

• We will set these variables using the Set Variables worksheet

50

Create AS4/3502 tape material and

layups Create a workspace

with 21 beams.

Assign dimensions and

loads to the beams.

View the test data correlation.

Export the crippling predictions to a spreadsheet.

Page 51: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set Sizing Variables

1. Go to the Set Variables worksheet.

2. Clear out all existing data except for the units. The data in row 5 are “keywords”. These point to a specific action for the worksheet to perform.

51

Page 52: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Copy Geometry Data

1. Go to the Geometry worksheet in the “Wieland” worksheet.

2. Copy the entire table to the HyperSizer spreadsheet starting at cell K6.

52

Page 53: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set the Database and Project

1. In the Set Variables worksheet, click Open Database Browser.

2. Set the database and project as you have done before. You can also copy this data from the Setup Groups worksheet.

53

2 1

Page 54: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Name the Components

1. Populate the first column with component numbers 301 through 321.

2. Enter “Component Name” keyword in column B.

3. Name the components and the group using the specimen ID and the crippling load Pcc. Use the following formula starting in cell B8.

=CONCATENATE(K8, " - Pcc = ", ROUND(S8,0), " lb")

54

1

2

3

Page 55: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Name the Components (cont.)

1. Click Set Component Variables.

2. Verify that the component and group names have changed. You may need to click Refresh or press [F5]. The worksheet scans the 6th row for any keywords. It stops at the first blank cell.

55

Page 56: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set the Materials

1. Enter the web material, Mw, keyword in column C.

2. Populate the column with the laminate names from the source data in column T

56

Page 57: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set the Sizing Variable Data

1. Enter the H (height), wt (top flange), wb (bottom flange) keywords.

2. Height column, H = Bw + t

3. Top flange column, wt = Bf + t/2

4. Bottom flange column, wb = wt.

57

Use the source data in the adjacent columns to generate this data.

Page 58: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set Load and Length

1. Enter the Axial and X Span keywords.

2. Axial load column, Axial = -1 * Pcc

3. X Span column, X Span = L

58

Page 59: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

59

Page 60: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set Sizing Variables

1. Click Set Component Variables.

2. Verify results in Sizing form. You may need to click Refresh or press [F5].

60

Page 61: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

• We have almost completely defined our group and component data - mostly using the HyperSizer object model.

• This technique is convenient for test data. • Conversions are usually required, so it helps to have the source data

in a separate spreadsheet. • Automating the input means that correcting mistakes or trying new

input combinations can be done quickly.

• Next we will define an assembly, set our ultimate load factor, set the failure modes, and set the test margins.

61

Create AS4/3502 tape material and

layups Create a workspace

with 21 beams. Assign dimensions,

loads, and materials to beams.

View the test data correlation.

Export the crippling predictions to a spreadsheet.

Page 62: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set the Ultimate Load Factor = 1.0

1. Go to the Design-to Loads tab.

2. Set the Mechanical Ultimate factor to 1.0.

3. Click Save (upper right corner).

4. Right-click the field and select Apply value to all components in Assembly.

62

Page 63: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Size the Assembly

1. Click Analyze current assembly [Ctrl+H]. The components need to be analyzed before test margins can be set.

63

Page 64: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Set the Test Margins of Safety

1. Return to the Set Variables worksheet

2. Enter the Test MS keyword.

3. Set the sub-keyword to 52. This is the analysis ID for composite crippling (see Crippling HME).

4. Set all margins to zero. This means that the observed failure load is equal to the applied load.

64

2 3

Page 65: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Load the Test Margins

1. Click Set Component Variables.

2. Verify results in the Failure tab of the Sizing form. The composite crippling failure mode will have an asterisk*.

65

Page 66: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

View the Test Data

1. In the main HyperSizer window, select Tools | Test Data Correlation.

2. Select “Correlation #50 Crippling” from the Correlation Category drop-down menu.

66

1

2

Page 67: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

View the Test Data

1. Click Data. The Correlation Test Data dialog appears.

2. Select the correct project from the drop-down menu.

3. Select Assembly #1 “All” from the workspace.

4. Click OK.

5. Click Show Theoretical (T).

67

1

3

4

2

Page 68: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Checkpoint

• The final task is to export the test data predictions to the spreadsheet using the Report worksheet.

68

Create AS4/3502 tape material and

layups Create a workspace

with 21 beams. Assign dimensions,

loads, and materials to beams.

View the test data correlation.

Export the crippling

predictions to a spreadsheet.

Page 69: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Report Results

1. Go to the Report worksheet.

2. Set the Database and Project input cells.

3. Set cell A3 to “All”.

4. Enter the keywords as shown below.

5. Click Report Results.

69

2 5 3

4

Page 70: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Final Checkpoint • These are the final results.

• Check your cell formatting if the results are all zero. • Unit weights should be exact. • Crippling and strength margins may vary slightly depending on your

database default material strength modes.

70

Page 71: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Summary

This tutorial has demonstrated the power of the scripting API.

Our task of performing test validation required a lot of manual data entry. By putting the data into Excel format we were able to use the HS utilities to push the data into HS. This has many advantages. The initial data entry is quicker and less error prone than be hand. Secondly, it is easier to correct translation mistakes (i.e. misinterpreting the flange width) and to perform what-if analyses.

71

Page 72: HyperSizer Tutorial Scripting Spreadsheet Utilities

© 2013 Collier Research Corporation

Other References

• See the Help for more detailed documentation on the spreadsheet.

72