Connect to Granta MI
Specify a database and table. Set the unit system explicitly to ensure repeatable results.Get the folder containing test records
Records in the Tensile Test Data table are stored in folders grouped by Test Temperature. Get the parent folder to iterate through the different values of Test Temperature.Fetch relevant attributes for the analysis using the Bulk Export tool
The attributes Test Temperature and Tensile Response (11 axis) are required for our analysis. Export both attributes plus the Pseudo-AttributeName for efficiency. Filter out records that do not have values for the required attributes.
Store the record objects in a dictionary keyed by the
test temperature, and extract the unit symbols for use when displaying results.
Define the Ramberg-Osgood model
The Ramberg-Osgood model expresses the total stress as a function of the strain, the Elastic Modulus and two model parameters, conventionallyK and n:
Define a helper function to fit the model to a series
Using thescipy.optimize package, fit the Ramberg-Osgood model to the stress-strain data at each temperature.
Provide initial values and constrain the parameters to positive and realistic values. These values are material
dependent - for Steel we use the following:
The goodness of fit can be estimated by inspecting the diagonal of the covariance matrix, which is returned by the
curve_fit function. Take the square root to obtain the sum-of-squares error for each model parameter.
Define additional helper functions
Define three more helper functions to make the main loop easier to understand:get_response_dataiterates over the provided records and extracts the contents of theTensile Response (11 axis)attribute into a numpy array.compute_fitted_datatakes the fitted model parameters and a stress range and computes the predicted stress-strain curve. This is used to plot the model results.compute_yield_pointtakes a fitted stress-strain curve and the elastic modulus and performs a basic fit to calculate the 0.2% Offset Yield Stress and Strain of the material.
Fit to the data
For each set of test records, extract the stress-strain curve and fit to the Ramberg-Osgood model using the helper functions defined above. Combine all the test runs into one dataset and fit the model to the aggregate data. In your own scripts, you will also need to take into account multiple series, range data, and other features of your data such asEstimated and Not-Applicable flags.
Plot the results
Plot the source data for each temperature run, with common axis scales to make comparison easier. In addition to the response data and the fitted model, plot the elastic stress-strain line and the yield point at each temperature.