This document describes a C program written by Salar Delavar Qashqai to analyze the geometric and material nonlinearity of a 2D truss structure under force and ductility damage index control. The program imports input data files, performs a pushover analysis using incremental loading, calculates member forces and displacements, and exports output to text, Excel, MATLAB, and HTML files. Key sections of code are presented to demonstrate how the program assembles and solves the system stiffness matrix, calculates element forces and stiffness, and checks for convergence at each iteration.
Nonlinear analysis of braced frame with hinge by hinge method in c programmingSalar Delavar Qashqai
This document is a C program code for nonlinear analysis of braced frames with hinge elements using the hinge method. The program imports input data, calculates the global stiffness matrix and its inverse, determines member forces and displacements through matrix operations, and outputs results to Excel files. Key steps include importing geometry, material properties, and loading, calculating element and system stiffness matrices, inverting the system matrix, determining member forces and displacements, and reporting results.
Geometric nonlinearity analysis of springs with rigid element displacement co...Salar Delavar Qashqai
This document contains the code for analyzing the geometric and material nonlinearity of springs under displacement-controlled loading. The code imports input data on spring properties and stress-strain behavior, performs an incremental analysis to calculate the base shear and displacement at each step, and exports the results to Excel and MATLAB files. Negative or invalid input values trigger error messages. The analysis calculates the strain, stiffness, and force in each spring at each increment until the ultimate displacement is reached.
Geometric and material nonlinearity analysis of 2 d truss with force control ...Salar Delavar Qashqai
This document describes a C++ program for analyzing the geometric and material nonlinearity of a 2D truss structure under force control and ductility damage index control. The program performs a pushover analysis of the truss by applying incremental lateral forces and calculating the member forces, displacements, and base shear at each step. The program results are verified against the structural analysis programs SEISMOSTRUCT and ABAQUS. Key aspects of the program include importing input data files, assembling the structure stiffness matrix, calculating displacements and internal forces through an iterative solution, and exporting the results to text, Excel, MATLAB, and HTML files.
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Salar Delavar Qashqai
This C program performs a geometric nonlinearity analysis of springs with rigid elements under displacement-controlled large deformations. It imports input data, performs an incremental analysis to calculate critical buckling loads, and exports output to Excel and HTML files. The analysis calculates forces, displacements, and critical pressures at each increment until the ultimate displacement is reached. Output graphs the displacement versus critical pressure relationship.
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Salar Delavar Qashqai
This C program performs a geometric nonlinearity analysis of springs with rigid elements under displacement-controlled large deformations. It imports input data, analyzes the system over multiple increments of applied displacement, and outputs the results to Excel and HTML files. The analysis calculates forces, displacements, base shear, and critical buckling load at each increment. When the ultimate displacement is reached, the program terminates and displays completion messages.
Pushover analysis force analogy method with force control based on euler bern...Salar Delavar Qashqai
This C program code analyzes the pushover response of semi-rigid frame connections using the force analogy method based on Euler-Bernoulli beam theory. It includes functions for importing input data, generating stiffness matrices, performing analysis calculations, and exporting output to Excel and HTML files. The program checks for valid input values and will terminate with an error if negative or unreasonable values are provided.
Pushover analysis force analogy method with force control based on timoshenko...Salar Delavar Qashqai
This C program performs a pushover analysis using the force analogy method based on Timoshenko beam theory. It includes functions for importing input data, defining system matrices, calculating element internal forces, and outputting results to Excel and HTML files. The program checks that all input data is valid before running the analysis, which consists of incrementally applying an external force and calculating displacements and member forces over the structure.
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Salar Delavar Qashqai
This C program performs a nonlinear analysis of a fixed support beam with hinge using the hinge method. It includes functions for importing data, generating stiffness matrices, performing matrix operations like inversion and multiplication, calculating element internal forces, and outputting results to text, MATLAB, and Excel files. The main function calls the various analysis functions and outputs initial data, analysis reports, and any error messages.
Nonlinear analysis of braced frame with hinge by hinge method in c programmingSalar Delavar Qashqai
This document is a C program code for nonlinear analysis of braced frames with hinge elements using the hinge method. The program imports input data, calculates the global stiffness matrix and its inverse, determines member forces and displacements through matrix operations, and outputs results to Excel files. Key steps include importing geometry, material properties, and loading, calculating element and system stiffness matrices, inverting the system matrix, determining member forces and displacements, and reporting results.
Geometric nonlinearity analysis of springs with rigid element displacement co...Salar Delavar Qashqai
This document contains the code for analyzing the geometric and material nonlinearity of springs under displacement-controlled loading. The code imports input data on spring properties and stress-strain behavior, performs an incremental analysis to calculate the base shear and displacement at each step, and exports the results to Excel and MATLAB files. Negative or invalid input values trigger error messages. The analysis calculates the strain, stiffness, and force in each spring at each increment until the ultimate displacement is reached.
Geometric and material nonlinearity analysis of 2 d truss with force control ...Salar Delavar Qashqai
This document describes a C++ program for analyzing the geometric and material nonlinearity of a 2D truss structure under force control and ductility damage index control. The program performs a pushover analysis of the truss by applying incremental lateral forces and calculating the member forces, displacements, and base shear at each step. The program results are verified against the structural analysis programs SEISMOSTRUCT and ABAQUS. Key aspects of the program include importing input data files, assembling the structure stiffness matrix, calculating displacements and internal forces through an iterative solution, and exporting the results to text, Excel, MATLAB, and HTML files.
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Salar Delavar Qashqai
This C program performs a geometric nonlinearity analysis of springs with rigid elements under displacement-controlled large deformations. It imports input data, performs an incremental analysis to calculate critical buckling loads, and exports output to Excel and HTML files. The analysis calculates forces, displacements, and critical pressures at each increment until the ultimate displacement is reached. Output graphs the displacement versus critical pressure relationship.
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Salar Delavar Qashqai
This C program performs a geometric nonlinearity analysis of springs with rigid elements under displacement-controlled large deformations. It imports input data, analyzes the system over multiple increments of applied displacement, and outputs the results to Excel and HTML files. The analysis calculates forces, displacements, base shear, and critical buckling load at each increment. When the ultimate displacement is reached, the program terminates and displays completion messages.
Pushover analysis force analogy method with force control based on euler bern...Salar Delavar Qashqai
This C program code analyzes the pushover response of semi-rigid frame connections using the force analogy method based on Euler-Bernoulli beam theory. It includes functions for importing input data, generating stiffness matrices, performing analysis calculations, and exporting output to Excel and HTML files. The program checks for valid input values and will terminate with an error if negative or unreasonable values are provided.
Pushover analysis force analogy method with force control based on timoshenko...Salar Delavar Qashqai
This C program performs a pushover analysis using the force analogy method based on Timoshenko beam theory. It includes functions for importing input data, defining system matrices, calculating element internal forces, and outputting results to Excel and HTML files. The program checks that all input data is valid before running the analysis, which consists of incrementally applying an external force and calculating displacements and member forces over the structure.
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Salar Delavar Qashqai
This C program performs a nonlinear analysis of a fixed support beam with hinge using the hinge method. It includes functions for importing data, generating stiffness matrices, performing matrix operations like inversion and multiplication, calculating element internal forces, and outputting results to text, MATLAB, and Excel files. The main function calls the various analysis functions and outputs initial data, analysis reports, and any error messages.
The document contains 10 programs related to sorting and graph algorithms. Program 1-7 implement different sorting algorithms - insertion sort, selection sort, heap sort, quick sort, counting sort, merge sort and radix sort. Program 8 implements the greedy knapsack problem. Program 9 implements the travelling salesman problem. Program 10 implements Kruskal's algorithm to find the minimum spanning tree of a graph.
COMPUTER SCIENCE CLASS 12 PRACTICAL FILEAnushka Rai
Here's my Computer Science Board Practical File. I hope you find it as useful as it was to me.This file is however of CBSE class 12th 2020-2021 syllabus.
The document describes a C program that implements selection sort using pointers and functions. It takes input of array size and elements, calls the selection sort function sel() on the array, and prints the sorted output. The sel() function takes the array, start and end indexes, finds the minimum element in the range and swaps it with the start element, then calls itself recursively to sort the rest.
The document contains programs for various sorting and searching algorithms like insertion sort, selection sort, bubble sort, linear search, binary search, etc. It also includes programs for stack operations, queue operations, tower of Hanoi, infix to postfix conversion and postfix evaluation. Each program is written in C language and contains the main logic/code to implement the given algorithm or data structure operation.
design and analysis of algorithm Lab filesNitesh Dubey
This document contains details of experiments conducted as part of a "Design and Analysis of Algorithm Lab" course. It includes 10 experiments covering algorithms like binary search, heap sort, merge sort, selection sort, insertion sort, quick sort, knapsack problem, travelling salesman problem, minimum spanning tree (using Kruskal's algorithm), and N queen problem (using backtracking). For each experiment, it provides the objective, program code implementation, and result. The document is submitted by a student to their professor for the lab session.
This document contains C program code examples for various programming problems. It is divided into 5 weeks. Some of the programs included are: exchanging values between two variables with and without a temporary variable, finding the sum of digits of a positive integer, generating factors of numbers, calculating the factorial of a number, computing the sine function as a series, generating the Fibonacci sequence, reversing digits of an integer, converting decimal to binary, octal and hexadecimal, calculating terms of a series, and performing basic mathematical operations based on user input. The document provides the code and output for each problem.
This document contains computer programming lab solutions for various problems as per the JNTU Hyderabad syllabus. It is authored by Srinivas Reddy Amedapu, a full time research scholar at the National Institute of Technology in Trichy, Tamil Nadu. The document provides C code solutions to problems like finding the sum of digits of a number, generating Fibonacci sequences, finding prime numbers between a range, calculating mathematical series, solving quadratic equations, recursive and non-recursive functions for factorial and GCD, the Towers of Hanoi problem, distance calculation with velocity and acceleration, a calculator program using switch statements, finding minimum and maximum elements in an array, and matrix addition. Contact details for S
The document contains C program code solutions to common programming problems submitted by Srinivas Reddy Amedapu. It includes programs to:
1) Find the sum of digits of a positive integer.
2) Generate the first n terms of the Fibonacci sequence.
3) Generate all prime numbers between 1 and n.
4) Calculate a series involving factorials and powers of x.
5) Find the roots of a quadratic equation.
6) Calculate the factorial and greatest common divisor of integers using recursive and non-recursive functions.
7) Solve the Towers of Hanoi problem.
8) Calculate distance travelled given initial velocity, acceleration, and time.
This document contains code snippets for various operations on linked lists and polynomials in C programming language. It includes 9 questions covering topics like:
1. Counting characters, words, digits in a string
2. Squeezing a string by removing spaces
3. Swapping values using pointers
4. Comparing two strings
5. Concatenating two strings
6. Multiplying two matrices
7. Reversing a string
8. Performing insertion, deletion and traversal on singly linked lists
9. Implementing polynomial addition and multiplication by representing polynomials as linked lists
For each question, the C code to implement the operation is provided along with sample input/output.
The document contains 10 programming problems related to basic C concepts like data types, operators, functions, arrays, pointers etc. Each problem has the code to solve it along with sample input/output. The problems cover topics like number formatting, arithmetic operations using switch case, finding min/max, addition of numbers, matrix operations, string functions and recursion.
This document contains C++ code for a railway reservation system. It defines classes for login, passenger details, reservations, cancellations, and manages the user interface and database interactions. The main function displays a menu and calls additional functions for administrative tasks like adding/viewing train schedules or passenger details, and user tasks like reservation, cancellation or inquiries. Database files store details, reservations and user login information.
The document discusses object oriented programming concepts in C++. It contains 4 questions with solutions. Question 1 defines a BankAccount class with data members like name, account number etc. and member functions to assign values, deposit, withdraw amounts. Question 2 overloads the increment operator ++. Question 3 overloads the > operator to find greater of two class instances. Question 4 demonstrates single and multiple inheritance - single inheritance defines a PhysicalFit class derived from BasicInfo class, multiple inheritance defines a DerivedD class derived from 3 base classes.
1. The document provides a lab manual for computer networks and operating systems labs containing 8 programs to implement various networking and security algorithms.
2. The programs include implementing data link layer framing methods, CRC polynomials, Dijkstra's shortest path algorithm, distance vector routing, DES encryption, breaking the DES code, and RSA encryption/decryption.
3. The document contains instructions for 8 programs to implement computer network and security algorithms as part of a lab course covering topics like data link layer, routing, encryption, and public key cryptography.
Declaring friend function with inline codeRajeev Sharan
The document describes programs using object oriented programming concepts in C++. It includes programs on friend functions, nested classes with file handling, and multiple level inheritance. The friend function program demonstrates accessing private data of a class using a friend function. The nested classes program stores student information in arrays of nested classes and reads/writes to a file. The inheritance program uses multiple inheritance to store and display details of students applying for financial assistance.
The document provides examples of basic C programs that demonstrate fundamental programming concepts like printing values, arithmetic operations, arrays, functions, conditionals, loops, and matrices. The programs cover topics such as printing and reading integers, adding/multiplying numbers, swapping values, checking vowels/consonants, Armstrong numbers, palindromes, summing matrices, and finding the transpose of a matrix.
This document contains 8 C programming code examples demonstrating various scheduling algorithms:
1. First Come First Serve scheduling
2. Non-preemptive Shortest Job First scheduling
3. Round Robin scheduling
4. Priority scheduling
5. Banker's algorithm for deadlock avoidance
6. Producer-consumer problem synchronization
7. Dekker's algorithm for mutual exclusion
Each program example includes comments explaining the algorithm and includes functions to calculate waiting times, turnaround times, and other metrics.
The document contains code snippets for several C programs including:
1) A program to add complex numbers by defining a structure for complex numbers and taking user input for real and imaginary parts of two numbers and printing their sum.
2) A binary search algorithm implementation to search a sorted array for a key and return its index.
3) A bubble sort algorithm implementation to sort an array of long integers in ascending order by swapping adjacent elements.
The document contains C code for multiple programs that perform various calculations and operations on arrays and numbers. The programs include:
1. Evaluating mathematical expressions by taking input values, performing calculations defined by the expressions, and outputting results.
2. Performing logical operations and comparisons on input values to determine output values based on if/else or switch statements.
3. Calculating factorials, digit sums, reversing numbers, checking for palindromes, and other numeric operations using loops.
4. Generating patterns and diagrams by iterating with for loops.
5. Performing array operations like reversing elements, calculating sums, and swapping arrays.
The document contains code snippets demonstrating the use of arrays in C programming language. It includes examples of declaring and initializing arrays, accessing array elements, passing arrays to functions, string handling functions like strlen(), strcpy() etc. It also contains examples of 2D arrays, reading/writing arrays at runtime, finding maximum element in an array. The document is intended to teach the fundamentals of array programming in C.
This C program allows a user to answer multiple choice questions (MCQs) and checks their answers. It prints out 5 questions, each with 3 possible answers, and prompts the user to enter the number of the correct answer. It then checks each submitted answer and prints whether it is true or false. This allows the program to automatically grade a short quiz consisting of basic MCQs.
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...Salar Delavar Qashqai
This C program performs a nonlinear analysis of a 2D cantilever beam with plastic hinges using force control. The program was written by Salar Delavar Ghashghaei and verified using ABAQUS. It includes functions for importing input data, calculating element stiffness matrices, inverting matrices, performing iterations to solve for displacements, and outputting results to Excel, MATLAB, and HTML files. The input data is checked for errors before running the analysis, which is reported with incremental loads, displacements, and rotations at each step. Plastic hinge data of moment vs. rotation is also reported.
The document contains 10 programs related to sorting and graph algorithms. Program 1-7 implement different sorting algorithms - insertion sort, selection sort, heap sort, quick sort, counting sort, merge sort and radix sort. Program 8 implements the greedy knapsack problem. Program 9 implements the travelling salesman problem. Program 10 implements Kruskal's algorithm to find the minimum spanning tree of a graph.
COMPUTER SCIENCE CLASS 12 PRACTICAL FILEAnushka Rai
Here's my Computer Science Board Practical File. I hope you find it as useful as it was to me.This file is however of CBSE class 12th 2020-2021 syllabus.
The document describes a C program that implements selection sort using pointers and functions. It takes input of array size and elements, calls the selection sort function sel() on the array, and prints the sorted output. The sel() function takes the array, start and end indexes, finds the minimum element in the range and swaps it with the start element, then calls itself recursively to sort the rest.
The document contains programs for various sorting and searching algorithms like insertion sort, selection sort, bubble sort, linear search, binary search, etc. It also includes programs for stack operations, queue operations, tower of Hanoi, infix to postfix conversion and postfix evaluation. Each program is written in C language and contains the main logic/code to implement the given algorithm or data structure operation.
design and analysis of algorithm Lab filesNitesh Dubey
This document contains details of experiments conducted as part of a "Design and Analysis of Algorithm Lab" course. It includes 10 experiments covering algorithms like binary search, heap sort, merge sort, selection sort, insertion sort, quick sort, knapsack problem, travelling salesman problem, minimum spanning tree (using Kruskal's algorithm), and N queen problem (using backtracking). For each experiment, it provides the objective, program code implementation, and result. The document is submitted by a student to their professor for the lab session.
This document contains C program code examples for various programming problems. It is divided into 5 weeks. Some of the programs included are: exchanging values between two variables with and without a temporary variable, finding the sum of digits of a positive integer, generating factors of numbers, calculating the factorial of a number, computing the sine function as a series, generating the Fibonacci sequence, reversing digits of an integer, converting decimal to binary, octal and hexadecimal, calculating terms of a series, and performing basic mathematical operations based on user input. The document provides the code and output for each problem.
This document contains computer programming lab solutions for various problems as per the JNTU Hyderabad syllabus. It is authored by Srinivas Reddy Amedapu, a full time research scholar at the National Institute of Technology in Trichy, Tamil Nadu. The document provides C code solutions to problems like finding the sum of digits of a number, generating Fibonacci sequences, finding prime numbers between a range, calculating mathematical series, solving quadratic equations, recursive and non-recursive functions for factorial and GCD, the Towers of Hanoi problem, distance calculation with velocity and acceleration, a calculator program using switch statements, finding minimum and maximum elements in an array, and matrix addition. Contact details for S
The document contains C program code solutions to common programming problems submitted by Srinivas Reddy Amedapu. It includes programs to:
1) Find the sum of digits of a positive integer.
2) Generate the first n terms of the Fibonacci sequence.
3) Generate all prime numbers between 1 and n.
4) Calculate a series involving factorials and powers of x.
5) Find the roots of a quadratic equation.
6) Calculate the factorial and greatest common divisor of integers using recursive and non-recursive functions.
7) Solve the Towers of Hanoi problem.
8) Calculate distance travelled given initial velocity, acceleration, and time.
This document contains code snippets for various operations on linked lists and polynomials in C programming language. It includes 9 questions covering topics like:
1. Counting characters, words, digits in a string
2. Squeezing a string by removing spaces
3. Swapping values using pointers
4. Comparing two strings
5. Concatenating two strings
6. Multiplying two matrices
7. Reversing a string
8. Performing insertion, deletion and traversal on singly linked lists
9. Implementing polynomial addition and multiplication by representing polynomials as linked lists
For each question, the C code to implement the operation is provided along with sample input/output.
The document contains 10 programming problems related to basic C concepts like data types, operators, functions, arrays, pointers etc. Each problem has the code to solve it along with sample input/output. The problems cover topics like number formatting, arithmetic operations using switch case, finding min/max, addition of numbers, matrix operations, string functions and recursion.
This document contains C++ code for a railway reservation system. It defines classes for login, passenger details, reservations, cancellations, and manages the user interface and database interactions. The main function displays a menu and calls additional functions for administrative tasks like adding/viewing train schedules or passenger details, and user tasks like reservation, cancellation or inquiries. Database files store details, reservations and user login information.
The document discusses object oriented programming concepts in C++. It contains 4 questions with solutions. Question 1 defines a BankAccount class with data members like name, account number etc. and member functions to assign values, deposit, withdraw amounts. Question 2 overloads the increment operator ++. Question 3 overloads the > operator to find greater of two class instances. Question 4 demonstrates single and multiple inheritance - single inheritance defines a PhysicalFit class derived from BasicInfo class, multiple inheritance defines a DerivedD class derived from 3 base classes.
1. The document provides a lab manual for computer networks and operating systems labs containing 8 programs to implement various networking and security algorithms.
2. The programs include implementing data link layer framing methods, CRC polynomials, Dijkstra's shortest path algorithm, distance vector routing, DES encryption, breaking the DES code, and RSA encryption/decryption.
3. The document contains instructions for 8 programs to implement computer network and security algorithms as part of a lab course covering topics like data link layer, routing, encryption, and public key cryptography.
Declaring friend function with inline codeRajeev Sharan
The document describes programs using object oriented programming concepts in C++. It includes programs on friend functions, nested classes with file handling, and multiple level inheritance. The friend function program demonstrates accessing private data of a class using a friend function. The nested classes program stores student information in arrays of nested classes and reads/writes to a file. The inheritance program uses multiple inheritance to store and display details of students applying for financial assistance.
The document provides examples of basic C programs that demonstrate fundamental programming concepts like printing values, arithmetic operations, arrays, functions, conditionals, loops, and matrices. The programs cover topics such as printing and reading integers, adding/multiplying numbers, swapping values, checking vowels/consonants, Armstrong numbers, palindromes, summing matrices, and finding the transpose of a matrix.
This document contains 8 C programming code examples demonstrating various scheduling algorithms:
1. First Come First Serve scheduling
2. Non-preemptive Shortest Job First scheduling
3. Round Robin scheduling
4. Priority scheduling
5. Banker's algorithm for deadlock avoidance
6. Producer-consumer problem synchronization
7. Dekker's algorithm for mutual exclusion
Each program example includes comments explaining the algorithm and includes functions to calculate waiting times, turnaround times, and other metrics.
The document contains code snippets for several C programs including:
1) A program to add complex numbers by defining a structure for complex numbers and taking user input for real and imaginary parts of two numbers and printing their sum.
2) A binary search algorithm implementation to search a sorted array for a key and return its index.
3) A bubble sort algorithm implementation to sort an array of long integers in ascending order by swapping adjacent elements.
The document contains C code for multiple programs that perform various calculations and operations on arrays and numbers. The programs include:
1. Evaluating mathematical expressions by taking input values, performing calculations defined by the expressions, and outputting results.
2. Performing logical operations and comparisons on input values to determine output values based on if/else or switch statements.
3. Calculating factorials, digit sums, reversing numbers, checking for palindromes, and other numeric operations using loops.
4. Generating patterns and diagrams by iterating with for loops.
5. Performing array operations like reversing elements, calculating sums, and swapping arrays.
The document contains code snippets demonstrating the use of arrays in C programming language. It includes examples of declaring and initializing arrays, accessing array elements, passing arrays to functions, string handling functions like strlen(), strcpy() etc. It also contains examples of 2D arrays, reading/writing arrays at runtime, finding maximum element in an array. The document is intended to teach the fundamentals of array programming in C.
This C program allows a user to answer multiple choice questions (MCQs) and checks their answers. It prints out 5 questions, each with 3 possible answers, and prompts the user to enter the number of the correct answer. It then checks each submitted answer and prints whether it is true or false. This allows the program to automatically grade a short quiz consisting of basic MCQs.
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...Salar Delavar Qashqai
This C program performs a nonlinear analysis of a 2D cantilever beam with plastic hinges using force control. The program was written by Salar Delavar Ghashghaei and verified using ABAQUS. It includes functions for importing input data, calculating element stiffness matrices, inverting matrices, performing iterations to solve for displacements, and outputting results to Excel, MATLAB, and HTML files. The input data is checked for errors before running the analysis, which is reported with incremental loads, displacements, and rotations at each step. Plastic hinge data of moment vs. rotation is also reported.
This document discusses functions in C programming. It begins by asking questions about functions and their syntax and benefits. It then provides examples of built-in library functions like sqrt, pow, and isupper. The document demonstrates how to write user-defined functions with a factorial function as an example. It also provides examples using functions like calculating factorials, binomial coefficients, GCD, prime checking, and printing prime numbers within a range.
Nonlinear analysis of frame with hinge by hinge method in c programmingSalar Delavar Qashqai
This C program performs a nonlinear analysis of a frame structure with hinge elements. It contains functions for importing input data, generating the global stiffness matrix, inverting matrices, calculating element forces, and outputting results to Excel. The main function obtains input, checks for errors, performs the analysis, and displays initial data and a report.
The document contains C code to perform matrix addition and multiplication using functions. It includes functions to read and write matrices, take user input for matrix dimensions and elements, perform the operations, and output the results. The code provides a menu for the user to select addition or multiplication and handles different cases for valid and invalid inputs.
Ex.1 Write a program to print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ex.2 Write a program to find bigger of three integers.
Ex.3 Write a program to calculate GCD between two numbers.
Ex.4 Write a program to find transpose of matrix.
Ex.5 Write a program which deletes an element from an array & display all other elements.
Ex.6 Write a program to calculate XA+YB where A & B are matrix & X=2, Y=3.
Ex.7 Write a program to calculate the total amount of money in the piggy bank, given that coins of Rs.10, Rs.5, Rs.2, RS.1.
& many more.....
The document describes an experiment to write a program for translating an object by a vector. The program uses Turbo C to take in coordinates of points, draw lines between them, and then translate the entire object based on translation values provided by the user. The translation is performed by adding the translation vector to each point coordinate. The program draws the object both before and after translation to demonstrate the effect.
- To translate an object by a vector v, each homogeneous vector p (written in homogeneous coordinates) would need to be multiplied by thistranslation matrix
The document is a presentation on matrices that includes:
1) Definitions of matrices, types of matrices, and algorithms for matrix addition and multiplication.
2) Code examples for adding and multiplying matrices using nested for loops to iterate through the elements.
3) The multiplication algorithm checks that the number of columns in the first matrix matches the number of rows in the second matrix before performing the operation.
4) The presentation covers key matrix concepts and includes working C code examples to demonstrate adding and multiplying matrices.
The document contains 10 programs written in C programming language to perform various 2D and 3D graphics operations like drawing lines, rectangles, circles, ellipses, torus, scaling, rotating, shearing and reflecting objects. Program 1-5 demonstrate drawing basic shapes like line, rectangle, circle and ellipse. Program 6 draws a 3D torus using OpenGL. Program 7-9 demonstrate transformations like scaling, rotating and shearing of objects. Program 10 shows reflection of an object about x-axis, y-axis and origin.
The document discusses the C programming language. It provides a brief history of C, describes its data types and operators. It then presents 26 sample C programs demonstrating basic concepts like input/output, conditional statements, loops, functions, arrays and strings. The programs cover calculations, pattern printing, factorial, Fibonacci series and other simple programming examples.
Nonlinear 2nd order analysis of 2 d fixed support beam with plastic hinge con...Salar Delavar Qashqai
This C program performs a nonlinear 2nd-order analysis of a 2D fixed support beam considering plastic hinge behavior and large deformations. The program imports input data, performs the analysis, and outputs results to Excel and HTML files. Key aspects of the analysis include calculating the element stiffness matrix, incorporating plastic hinge stiffness, and using an iterative approach to solve for displacements.
This document contains source code for 14 programs written in C programming language by Sumant Diwakar as part of a practical file for a Computer Programming Lab course. The programs include conversions between Fahrenheit and Celsius temperatures, checking if a number is a perfect square, sorting numbers in ascending and descending order, checking vowels, calculating factorials, and other numerical calculations and patterns. Each program section contains the source code and output for that program.
In C Programming create a program that converts a number from decimal.docxtristans3
In C Programming create a program that converts a number from decimal to binary. You must use a stack to complete this assignment. • Void pop() • Void push(int data) • Int top() • Int isEmpty() You must create an implementation of a stack. You may use either an array or a linked list as the underlying structure. You will, at a minimum, need to implement the following stack functions: Your program should take decimal input from the user, and convert it to binary, and simply print it out.
Solution
normal program
#include<stdio.h>
int main(){
long int decimalNumber,remainder,quotient;
int binaryNumber[100],i=1,j;
printf(\"Enter any decimal number: \");
scanf(\"%ld\",&decimalNumber);
quotient = decimalNumber;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
printf(\"Equivalent binary value of decimal number %d: \",decimalNumber);
for(j = i -1 ;j> 0;j--)
printf(\"%d\",binaryNumber[j]);
return 0;
}
using stack
.
This document contains C programming code examples and exercises provided by Vikram Neerugatti, an assistant professor. It includes multiple code snippets demonstrating various programming concepts like data types, operators, control structures, functions, arrays, strings, pointers, structures and file handling. The document is divided into sections with labels like 1(A), 2(B) etc. and each section contains 1-3 code examples/exercises on different C programming topics.
The document contains instructions for implementing three network algorithms in C/C++: 1) An error detecting code using CRC CCIT(16 bits), 2) A distance vector algorithm to find suitable transmission paths, and 3) A congestion control algorithm using the leaky bucket method. Sample code is provided for each algorithm to calculate checksums, routing tables, and regulate output rate based on bucket size.
This program uses recursive functions to:
1. Calculate the standard deviation of an array of values by calculating the mean, summing the squared differences from the mean, and taking the square root.
2. Find the factorial of a number by multiplying it by the factorial of the previous number down to 1.
3. Find the sum of odd numbers between a range by recursively adding each odd number.
Similar to Geometric and material nonlinearity analysis of 2 d truss with force and ductility damage index control in c programming (20)
Pushover 2order (p delta effect) analysis force analogy method with force con...Salar Delavar Qashqai
This document describes a C program for pushover (P-Delta effect) analysis of structures using the force analogy method based on Timoshenko beam theory. The program analyzes plastic hinges using moment-rotation and shear-shear deformation relationships. It takes inputs from multiple CSV files, runs the analysis, and outputs results to CSV and HTML files including a base shear-displacement graph. The program was written by Salar Delavar Qashqai and published on March 23, 2021.
Pushover analysis of frame by force analogy method with force control based o...Salar Delavar Qashqai
This document describes a C program for performing pushover analysis of frames using the force analogy method based on Euler-Bernoulli beam theory. The program models plastic hinges using moment-rotation curves and outputs results in CSV and HTML files, including a base shear-displacement graph. It was written by Salar Delavar Qashqai and published on March 13, 2021.
This document contains information about optimizing a Pratt truss structure using Excel Solver, including:
- The program was written by Salar Delavar Ghashghaei on February 12, 2017.
- It provides member cross-sectional areas, displacement results from the optimization, and equilibrium equations for the joints of the truss structure.
- The objective is to minimize the total weight of the truss subject to stress constraints on each member.
Pushover analysis of triangular steel membrane element subjected to lateral d...Salar Delavar Qashqai
This MATLAB program models the pushover analysis of a triangular steel membrane subjected to lateral displacements. It uses finite element analysis to calculate the stiffness matrix and account for geometric and material nonlinearity under small strains. The program defines the geometry and material properties of the membrane, applies incremental lateral displacements, calculates the element stiffness matrices, and assembles the global stiffness matrix to solve for displacements at each step. The results of the MATLAB analysis are verified against a similar ABAQUS model.
Pushover analysis of simply support steel section beam based on plastic hinge...Salar Delavar Qashqai
This document describes a MATLAB program for performing pushover analysis of a simply supported steel beam based on plastic hinge concepts. The program defines parameters for the beam geometry and material properties. It calculates the section properties and element stiffness coefficients. Plastic hinge properties are also defined. The MATLAB program then performs the pushover analysis and reports on the number of iterations required for convergence at each increment. The results of the MATLAB analysis are then verified using SAP2000 software, which also reports completing the analysis in a small number of iterations.
Pushover analysis of steel section beam subjected to incremental vertical loa...Salar Delavar Qashqai
This document describes a MATLAB program that performs pushover analysis of a steel beam subjected to incremental vertical loads. The program models the beam as a fixed support beam, defines parameters such as beam geometry and material properties, and analyzes the beam up to failure by incrementally increasing the load and checking for plastic hinge formation. The results from MATLAB are verified against a model of the same beam analyzed in SAP2000.
Moment curvature analysis of unconfined concrete section with matlab and sap2000Salar Delavar Qashqai
This document presents a moment-curvature analysis of an unconfined concrete section using MATLAB and SAP2000. It describes the section properties, material properties of the steel reinforcement and concrete, and runs a moment-curvature analysis in SAP2000. The analysis results are presented over 17 increments showing the top strain, neutral axis depth, curvature, flexural rigidity, and moment. Graphs of the analysis curve and moment-curvature relationship are also given.
Large deformation analysis of cantilever beam subjected to concentrated const...Salar Delavar Qashqai
This document describes the large deformation analysis of a cantilever beam subjected to a concentrated vertical load using ABAQUS and MATLAB. The beam's properties, including its length, flexural rigidity, and applied load, are defined. The deformation of the beam is then analyzed using pseudo-linear, linear, and ABAQUS models, with the deflection, slope, shear, and moment results reported along the beam's length.
Moment curvature analysis unconfined concrete section with different tension...Salar Delavar Qashqai
This MATLAB program analyzes the moment-curvature behavior of unconfined concrete sections with varying amounts of tension steel reinforcement. It performs an incremental analysis to determine the moment-curvature response up to the ultimate concrete strain limit of 0.004. Results are presented for sections with tension reinforcement ratios (ρ) of 0, 0.2, 0.4, etc. The analysis converges successfully for each reinforcement ratio and reports the moment and curvature at each increment.
Optimization of steel section based on moment and section ductilitySalar Delavar Qashqai
This document describes a program for optimizing steel section designs based on moment and ductility. The program allows the user to find optimal layer lengths based on these criteria. It requires initial input conditions like maximum iterations, strain-stress relationships, and minimum/maximum layer lengths to function. The output then displays the results of the optimization analyses.
Import data from csv excel file and export to xml excel file in c programmingSalar Delavar Qashqai
This C program imports data from a CSV file, analyzes it, and exports it to an XML Excel file. It reads double data values from the CSV file into arrays, checks for any negative or invalid values, and displays the data in a formatted table. It then writes the data and additional XML tags to a new XML file to generate an Excel spreadsheet with the formatted data table. The program opens the XML file upon completion for viewing.
This C program code generates elastic response spectra including displacement, pseudo-acceleration, and pseudo-velocity spectra needed for structural response spectrum analysis. The code uses the Newmark linear method to solve the equation of motions for different periods. It inputs ground motion acceleration data, performs the analysis, and outputs the response spectra and graphs the results in an HTML file for visualization.
This document discusses verifying C programs for structural eigen value analysis using the SEISMOSTRUCT v.7.0 structural analysis program. It was written by Salar Delavar Ghashghaei on October 28, 2018 and includes plots of the C code file, analysis file, input CSV file, and input for section properties, coordinate properties, restraint properties, and output restraint properties in SEISMOSTRUCT.
Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...Salar Delavar Qashqai
This document describes a MATLAB program that analyzes the first-order and second-order nonlinear behavior of a braced frame subjected to lateral pushover loading. The program models the nonlinear rotational springs of the columns and axial displacement spring of the brace. It reports the results of the first-order and second-order nonlinear analyses, including displacement and base shear values, ductility and overstrength ratios, and initial and tangent structural stiffness values.
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...Salar Delavar Qashqai
This document describes a nonlinear analysis of a semi-rigid frame subjected to lateral displacement in MATLAB. Parameters for the frame geometry, material properties, and nonlinear rotational springs are defined. The analysis is conducted using both first-order and second-order theory, tracking displacement, base shear, and internal moments over increments. Results are provided for ductility ratio, overstrength ratio, initial stiffness, and tangent stiffness.
This MATLAB program performs moment-curvature analysis on confined concrete sections. It analyzes a sample reinforced concrete section with specified material properties and reinforcement details. The program outputs 54 increments of the analysis, reporting the strain, curvature, moment, and number of iterations to converge at each increment. The goal is to verify the MATLAB program against a commercial moment-curvature analysis software called XTRACT.
Moment curvature analysis of unconfined circular concrete pipe section with m...Salar Delavar Qashqai
This document presents a moment-curvature analysis of an unconfined circular concrete pipe section using MATLAB and SAP2000. The analysis calculates the moment-curvature relationship in increments and determines key values like elastic rigidity, plastic rigidity, and ductility ratio. Graphs of results are presented comparing concrete strain, rebar stress, rigidity, neutral axis, and moment-curvature between the two programs.
1st order pushover analysis of column subjected to compression and tension ax...Salar Delavar Qashqai
This document summarizes the results of a pushover analysis of a reinforced concrete column subjected to both compression and tension axial loads. The analysis was conducted using MATLAB and SeismoStruct to verify the MATLAB model. The column is modeled with unconfined concrete properties and bilinear steel reinforcement. The analysis reports the load-displacement response for the column in both compression and tension, including yield capacities, ultimate capacities, and ductility ratios.
Pushover analysis of steel section beam with semi rigid connection in matlab ...Salar Delavar Qashqai
This document describes a pushover analysis of a steel cantilever beam with a semi-rigid connection conducted in MATLAB and ABAQUS. Parameters of the I-section beam and steel properties are defined. A moment-rotation relationship is used to model the semi-rigid connection. The analysis is performed through 250 increments up to a maximum displacement of 250mm. Figures of the moment-rotation behavior, base shear-displacement curve, and results from ABAQUS are presented.
Pushover analysis of simply support concrete section beam subjected to increm...Salar Delavar Qashqai
This document describes a MATLAB program for performing pushover analysis of a simply supported reinforced concrete beam subjected to incremental vertical loads. The program uses plastic hinge concepts and is verified using SAP2000 software and experimental data. The MATLAB program outputs the number of iterations required for convergence at each load increment stage, as well as the final internal forces in the beam under linear and nonlinear analysis. SAP2000 is also used to analyze the beam and outputs similar convergence information at each analysis stage.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...IJECEIAES
Climate change's impact on the planet forced the United Nations and governments to promote green energies and electric transportation. The deployments of photovoltaic (PV) and electric vehicle (EV) systems gained stronger momentum due to their numerous advantages over fossil fuel types. The advantages go beyond sustainability to reach financial support and stability. The work in this paper introduces the hybrid system between PV and EV to support industrial and commercial plants. This paper covers the theoretical framework of the proposed hybrid system including the required equation to complete the cost analysis when PV and EV are present. In addition, the proposed design diagram which sets the priorities and requirements of the system is presented. The proposed approach allows setup to advance their power stability, especially during power outages. The presented information supports researchers and plant owners to complete the necessary analysis while promoting the deployment of clean energy. The result of a case study that represents a dairy milk farmer supports the theoretical works and highlights its advanced benefits to existing plants. The short return on investment of the proposed approach supports the paper's novelty approach for the sustainable electrical system. In addition, the proposed system allows for an isolated power setup without the need for a transmission line which enhances the safety of the electrical network
The CBC machine is a common diagnostic tool used by doctors to measure a patient's red blood cell count, white blood cell count and platelet count. The machine uses a small sample of the patient's blood, which is then placed into special tubes and analyzed. The results of the analysis are then displayed on a screen for the doctor to review. The CBC machine is an important tool for diagnosing various conditions, such as anemia, infection and leukemia. It can also help to monitor a patient's response to treatment.
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...shadow0702a
This document serves as a comprehensive step-by-step guide on how to effectively use PyCharm for remote debugging of the Windows Subsystem for Linux (WSL) on a local Windows machine. It meticulously outlines several critical steps in the process, starting with the crucial task of enabling permissions, followed by the installation and configuration of WSL.
The guide then proceeds to explain how to set up the SSH service within the WSL environment, an integral part of the process. Alongside this, it also provides detailed instructions on how to modify the inbound rules of the Windows firewall to facilitate the process, ensuring that there are no connectivity issues that could potentially hinder the debugging process.
The document further emphasizes on the importance of checking the connection between the Windows and WSL environments, providing instructions on how to ensure that the connection is optimal and ready for remote debugging.
It also offers an in-depth guide on how to configure the WSL interpreter and files within the PyCharm environment. This is essential for ensuring that the debugging process is set up correctly and that the program can be run effectively within the WSL terminal.
Additionally, the document provides guidance on how to set up breakpoints for debugging, a fundamental aspect of the debugging process which allows the developer to stop the execution of their code at certain points and inspect their program at those stages.
Finally, the document concludes by providing a link to a reference blog. This blog offers additional information and guidance on configuring the remote Python interpreter in PyCharm, providing the reader with a well-rounded understanding of the process.
Null Bangalore | Pentesters Approach to AWS IAMDivyanshu
#Abstract:
- Learn more about the real-world methods for auditing AWS IAM (Identity and Access Management) as a pentester. So let us proceed with a brief discussion of IAM as well as some typical misconfigurations and their potential exploits in order to reinforce the understanding of IAM security best practices.
- Gain actionable insights into AWS IAM policies and roles, using hands on approach.
#Prerequisites:
- Basic understanding of AWS services and architecture
- Familiarity with cloud security concepts
- Experience using the AWS Management Console or AWS CLI.
- For hands on lab create account on [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
# Scenario Covered:
- Basics of IAM in AWS
- Implementing IAM Policies with Least Privilege to Manage S3 Bucket
- Objective: Create an S3 bucket with least privilege IAM policy and validate access.
- Steps:
- Create S3 bucket.
- Attach least privilege policy to IAM user.
- Validate access.
- Exploiting IAM PassRole Misconfiguration
-Allows a user to pass a specific IAM role to an AWS service (ec2), typically used for service access delegation. Then exploit PassRole Misconfiguration granting unauthorized access to sensitive resources.
- Objective: Demonstrate how a PassRole misconfiguration can grant unauthorized access.
- Steps:
- Allow user to pass IAM role to EC2.
- Exploit misconfiguration for unauthorized access.
- Access sensitive resources.
- Exploiting IAM AssumeRole Misconfiguration with Overly Permissive Role
- An overly permissive IAM role configuration can lead to privilege escalation by creating a role with administrative privileges and allow a user to assume this role.
- Objective: Show how overly permissive IAM roles can lead to privilege escalation.
- Steps:
- Create role with administrative privileges.
- Allow user to assume the role.
- Perform administrative actions.
- Differentiation between PassRole vs AssumeRole
Try at [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsVictor Morales
K8sGPT is a tool that analyzes and diagnoses Kubernetes clusters. This presentation was used to share the requirements and dependencies to deploy K8sGPT in a local environment.
artificial intelligence and data science contents.pptxGauravCar
What is artificial intelligence? Artificial intelligence is the ability of a computer or computer-controlled robot to perform tasks that are commonly associated with the intellectual processes characteristic of humans, such as the ability to reason.
› ...
Artificial intelligence (AI) | Definitio
john krisinger-the science and history of the alcoholic beverage.pptx
Geometric and material nonlinearity analysis of 2 d truss with force and ductility damage index control in c programming
1. >> IN THE NAME OF GOD <<
Geometric and Material Nonlinearity Analysis of 2D Truss with Force and
Ductility Damage Index Control in C programming
C program is written by Salar Delavar Qashqai – Publication Date: 12/April/2021
E-mail: salar.d.ghashghaei@gmail.com
2. C Code:
#include <stdio.h>
#include <windows.h> // text color
#include <conio.h>
#define N 10000 // number of increment
#define NN 5 // number of degree of freedom
#define Ne 6 // number of element
#define ShowText01 "PushoverNonlinear2DTrussFCGNDI-inputDATA.csv"
#define ShowText02 "PushoverNonlinear2DTrussFCGNDI-inputELEPROP.csv"
#define ShowText03 "Output data is written in Text, Excel, Matlab and Html file"
#define ShowText04 "PushoverNonlinear2DTrussFCGNDI-outputEXCEL.csv"
#define ShowText05 "PushoverNonlinear2DTrussFCGNDI-outputHTML.html"
#define ShowText06 "PushoverNonlinear2DTrussFCGNDI-outputTEXT.txt"
#define ShowText07 "PushoverNonlinear2DTrussFCGNDI-outputMATLAB.m"
#define ShowText08 "Graph-outputHTML.html"
void IMPORT_FILE01(double &Length,double &Height,double Force[],double &Fini,int &itermax,double &tolerance,double &DI);
void IMPORT_FILE02(double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int &n);
void SLOPE(double D1[],double F1[],double D2[],double F2[],double D3[],double F3[],double D4[],double F4[],double E1[],double E2[],double E3[],double E4[],int kn);
void MessageInitialData(double Length,double Height,double Force[],double Fini,int itermax,double tolerance,int M,double DI,double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int n);
void MatrixAssembled(double [Ne][4][4],double [][NN]);
void MatrixDetermination(double [][NN],int );
void MatrixInverse(double [][NN], double [][NN],int );
void MatrixMulti01(double [][NN], double [], double [], double [],int );
void MatrixMulti02(double [][NN], double [], double [], double [],int );
double ABS(double );
double MAX_ABS(double [],int );
double SQRT2(double );
void ElementInternalForce(double EA[],double es[],double ele_f[]);
void ElementStiffness(int n,double Length,double Height,double es[],double u[],double D1[],double D2[],double D3[],double D4[],double E1[],double E2[],double E3[],double E4[],double F1[],double F2[],double F3[],double F4[],double A[],double EA[],double k[][4][4],double G[]);
void MessageCheck_IMPORT_FILE01(double ,double ,int ,double,double );
void MessageCheck_IMPORT_FILE02(double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int n);
void MessageErrorReportTEXT();
void MessageAnalysisReportTEXT();
void MessageInputDataTEXT();
void MessageNotConverge(int ,int );
void MessageConverge(int ,int ,double [],double []);
void OUTPUT_text(int zMAX,int I[],int IT[],double reaction[],double DISP[][NN],double eleF[][Ne]);
void OUTPUT_matlab(int zMAX,double reaction[],double DISP[][NN]);
void OUTPUT_excel(int zMAX,int I[],double DISP[][NN],double eleF[][Ne],double reaction[]);
void OUTPUT_html(double Length,double Height,double Force[],double Fini,int itermax,double tolerance,int M,double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int zMAX,int I[],double DISP[][5],double eleF[][6],double reaction[],double DI);
void Distance(int );
double MAX(double A[],int n);
void SHOW_INITAL_REPORT_TEXT();
void ANALYSIS(double Length,double Height,double Force[],double Fini,int itermax,double tolerance,double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int kn,int m,double DI);
void textcolor(int ForgC);
void DATE_TIME();
void BILINEAR_CURVE(double A[],double B[],int M);
void OUTPUT_HTML_GRAPH(double DISP[][5],double reaction[],int n);
int main(){
int itermax,kn,m;
double Length,Height,Force[5],Fini,residual,tolerance,DI;
double F1[Ne],D1[Ne],F2[Ne],D2[Ne],F3[Ne],D3[Ne],F4[Ne],D4[Ne],A[Ne];
IMPORT_FILE01(Length,Height,Force,Fini,itermax,tolerance,DI);
MessageCheck_IMPORT_FILE01(Length,Height,itermax,tolerance,DI);
m = ABS(Fini)/ABS(Force[1]) +1;
IMPORT_FILE02(F1,D1,F2,D2,F3,D3,F4,D4,A,kn);
MessageCheck_IMPORT_FILE02(F1,D1,F2,D2,F3,D3,F4,D4,A,kn);
textcolor(11);
MessageInitialData(Length,Height,Force,Fini,itermax,tolerance,m,DI,F1,D1,F2,D2,F3,D3,F4,D4,A,kn);
textcolor(14);
MessageAnalysisReportTEXT();
ANALYSIS(Length,Height,Force,Fini,itermax,tolerance,F1,D1,F2,D2,F3,D3,F4,D4,A,kn,m,DI);
getch();
return 0;
}
void IMPORT_FILE01(double &Length,double &Height,double Force[],double &Fini,int &itermax,double &tolerance,double &DI){
double Import_Data[11];
int i=0;
FILE *InputFile;
InputFile = fopen(ShowText01, "r");
if (!InputFile){
MessageErrorReportTEXT();
printf(" File is not available! -> [%s] n",ShowText01);
Sleep(6000);
exit(1);
}
char line[100],a[100];
while(i < N && fgets(line,sizeof(line),InputFile) != NULL){
sscanf(line,"%s",a);
//printf("a[%d]: %sn",i,a);
Import_Data[i]= atof(a);
i++;
}
Length=Import_Data[0];
Height=Import_Data[1];
Force[0]=Import_Data[2];
Force[1]=Import_Data[3];
Force[2]=Import_Data[4];
Force[3]=Import_Data[5];
Force[4]=Import_Data[6];
Fini=Import_Data[7];
itermax=Import_Data[8];
tolerance=Import_Data[9];
DI=Import_Data[10];
}
void IMPORT_FILE02(double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int &n){
int i = 0;
FILE *InputFile;
InputFile = fopen(ShowText02, "r");
if (!InputFile){
MessageErrorReportTEXT();
printf(" File is not available! -> [%s] n",ShowText02);
Sleep(6000);
exit(1);
}
char line[1000];
do{
fscanf(InputFile,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&D1[i],&F1[i],&D2[i],&F2[i],&D3[i],&F3[i],&D4[i],&F4[i],&A[i]);
i++;
}
while(i < N && fgets(line,sizeof(line),InputFile) != NULL);
n = i-1;
//printf("%dn",n);
}
void MessageInitialData(double Length,double Height,double Force[],double Fini,int itermax,double tolerance,int M,double DI,double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int n){
char Qa,Qb,Qc,Qd,Qe,Qf,Qg,Qk;
int i;
Qa=201;Qb=205;Qc=187;Qd=200;Qe=188,Qf=186,Qg=204,Qk=185;
printf("tttt%c",Qa);
for (i=1;i<80;i++)
printf("%c",Qb);
printf("%cn",Qc);
printf("tttt%c >>IN THE NAME OF GOD << %cn",Qf,Qf);
printf("tttt%c Geometric and Material Nonlinearity Analysis of 2D Truss with Force Control %cn",Qf,Qf);
printf("tttt%c and Ductility Damage Index Control. %cn",Qf,Qf);
printf("tttt%c UNIT: Free Unit %cn",Qf,Qf);
printf("tttt%c",Qg);
for (i=1;i<80;i++)
printf("%c",Qb);
printf("%cn",Qk);
printf("tttt%c This program is written by Salar Delavar Ghashghaei %cn",Qf,Qf);
printf("tttt%c E-mail: salar.d.ghashghaei@gmail.com %cn",Qf,Qf);
printf("tttt%c",Qd);
for (i=1;i<80;i++)
printf("%c",Qb);
printf("%cn",Qe);
MessageInputDataTEXT();
printf(" Length of truss structure: %.3en",Length);
printf(" Height of truss structure: %.3en",Height);
printf(" External force [DOF(3)]: %.3en",Force[0]);
printf(" External force [DOF(5)]: %.3en",Force[1]);
printf(" External force [DOF(6)]: %.3en",Force[2]);
printf(" External force [DOF(7)]: %.3en",Force[3]);
printf(" External force [DOF(8)]: %.3en",Force[4]);
printf(" Ultimate external force [DOF(5)]: %.3en",Fini);
printf(" Maximum number of iterations: %.3en",itermax);// maximum number of iterations
printf(" Specified tolerance for convergence: %.3en",tolerance);// specified tolerance for convergence
printf(" Number of increments: %dn",M);
printf(" Ductility Damage Index: %.3enn",DI);
printf(" ");
for(i=0;i<125;i++)
printf("=");
printf("n");
printf(" Strain01 Stress01 Strain02 Stress02 Strain03 Stress03 Strain04 Stress04 Element Arean");
printf(" ");
for(i=0;i<125;i++)
printf("=");
printf("n");
for(i=0;i<n;i++)
printf(" Element[%d]: %.3e %.3e %.3e %.3e %.3e %.3e %.3e %.3e %.3en",i+1,D1[i],F1[i],D2[i],F2[i],D3[i],F3[i],D4[i],F4[i],A[i]);
printf(" ");
for(i=0;i<125;i++)
printf("=");
printf("n");
}
void MatrixInverse(double A[][NN], double C[][NN],int n){
int i,j,l;
double c_A[n][n],B[n][n],m,Sum;
for (i=0;i<n;i++)
for (j=0;j<n;j++)
c_A[i][j]=A[i][j];
// Inverse [Kinit]
for (i=0;i<n;i++)
for (j=0;j<n;j++){
if (i==j)
B[i][j]=1;
else
B[i][j]=0;
}
for (j=0;j<n-1;j++)
for (i=j+1;i<n;i++){
m=c_A[i][j]/c_A[j][j];
for (l=0;l<n;l++){
3. c_A[i][l] -= m*c_A[j][l];
B[i][l] -= m*B[j][l];
}
}
// backward substitutions
for (i=n-1;i>=0;i--)
for (j=0;j<n;j++){
Sum=0;
for (l=i+1;l<n;l++)
Sum += c_A[i][l]*C[l][j];
C[i][j]=(B[i][j]-Sum)/c_A[i][i];
}
}
void MatrixMulti01(double A[][NN], double B[], double C[], double D[],int n){
int i,j;
double ff;
// [f] =[Ktot] - [u] - [F]
for (i=0; i<n; i++){
ff=0;
for (j=0; j<n; j++)
ff += A[i][j]*B[j];
D[i] = ff-C[i];
}
}
void MatrixMulti02(double A[][NN], double B[], double C[], double D[],int n){
int i,j;
double Dx;
// [du] =[InvKinit] *[f]
for (i=0; i<n; i++){
Dx=0;
for (j=0; j<n; j++)
Dx += A[i][j]* -B[j];
C[i]=Dx;
D[i] += C[i];// u= u+du
}
}
void ElementInternalForce(double EA[],double es[],double ele_f[]){
for (int I=0; I<6;I++)
ele_f[I] = EA[I]*(es[I]+.5*es[I]*es[I]);
}
void ElementStiffness(int n,double Length,double Height,double es[],double u[],double D1[],double D2[],double D3[],double D4[],double E1[],double E2[],double E3[],double E4[],double F1[],double F2[],double F3[],double F4[],double A[],double EA[],double k[][4][4],double G[]){
double x1,y1,x2,y2,x3,y3,x4,y4,L[6],Lpr[Ne],lanX[Ne],lanY[Ne],lanxx[Ne],lanxy[Ne],lanyy[Ne];
int i;
Lpr[0]=Length;Lpr[1]=Height;
Lpr[2]=SQRT2(Length*Length+Height*Height);Lpr[3]=SQRT2(Length*Length+Height*Height);
Lpr[4]=Height;Lpr[5]=Length;
x1=0;y1=0;
x2=Length+u[0];y2=0;
x3=u[1];y3=Height+u[2];
x4=Length+u[3];y4=Height+u[4];
L[0]=SQRT2((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
L[1]=SQRT2((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
L[2]=SQRT2((x4-x1)*(x4-x1)+(y4-y1)*(y4-y1));
L[3]=SQRT2((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
L[4]=SQRT2((x4-x2)*(x4-x2)+(y4-y2)*(y4-y2));
L[5]=SQRT2((x4-x3)*(x4-x3)+(y4-y3)*(y4-y3));
lanX[0]=(x2-x1)/L[0];lanY[0]=(y2-y1)/L[0];
lanX[1]=(x3-x1)/L[1];lanY[1]=(y3-y1)/L[1];
lanX[2]=(x4-x1)/L[2];lanY[2]=(y4-y1)/L[2];
lanX[3]=(x3-x2)/L[3];lanY[3]=(y3-y2)/L[3];
lanX[4]=(x4-x2)/L[4];lanY[4]=(y4-y2)/L[4];
lanX[5]=(x4-x3)/L[5];lanY[5]=(y4-y3)/L[5];
for (i=0;i<n;i++){
es[i]=(L[i]-Lpr[i])/Lpr[i];
if (ABS(es[i])>= 0 && ABS(es[i])<= D1[i])
EA[i] = E1[i]*A[i];
else if (ABS(es[i])> D1[i] && ABS(es[i])<= D2[i])
EA[i] = ((F1[i]+E2[i]*(ABS(es[i])-D1[i]))/ABS(es[i]))*A[i];
else if (ABS(es[i])> D2[i] && ABS(es[i])<= D3[i])
EA[i] = ((F2[i]+E3[i]*(ABS(es[i])-D2[i]))/ABS(es[i]))*A[i];
else if (ABS(es[i])> D3[i] && ABS(es[i])<= D4[i])
EA[i] = ((F3[i]+E4[i]*(ABS(es[i])-D3[i]))/ABS(es[i]))*A[i];
else
EA[i] =0;
// Element
G[i] = EA[i]/L[i];lanxx[i]=lanX[i]*lanX[i];lanxy[i]=lanX[i]*lanY[i];lanyy[i]=lanY[i]*lanY[i];
k[i][0][0]=G[i]*lanxx[i];k[i][0][1]=G[i]*lanxy[i];k[i][0][2]=-G[i]*lanxx[i];k[i][0][3]=-G[i]*lanxy[i];
k[i][1][0]=G[i]*lanxy[i];k[i][1][1]=G[i]*lanyy[i];k[i][1][2]=-G[i]*lanxy[i];k[i][1][3]=-G[i]*lanyy[i];
k[i][2][0]=-G[i]*lanxx[i];k[i][2][1]=-G[i]*lanxy[i];k[i][2][2]=G[i]*lanxx[i];k[i][2][3]=G[i]*lanxy[i];
k[i][3][0]=-G[i]*lanxy[i];k[i][3][1]=-G[i]*lanyy[i];k[i][3][2]=G[i]*lanxy[i];k[i][3][3]=G[i]*lanyy[i];
}
}
void MatrixAssembled(double k[Ne][4][4],double K[][NN]){
K[0][0]= k[0][2][2]+k[3][0][0]+k[4][0][0];
K[0][1]= k[3][0][2];
K[0][2]= k[3][0][3];
K[0][3]= k[4][0][2];
K[0][4]= k[4][0][3];
K[1][0]= k[3][2][0];
K[1][1]= k[1][2][2]+k[3][2][2]+k[5][0][0];
K[1][2]= k[1][2][3]+k[3][2][3]+k[5][0][1];
K[1][3]= k[5][0][2];
K[1][4]= k[5][0][3];
K[2][0]= k[3][3][0];
K[2][1]= k[1][3][2]+k[3][3][2]+k[5][1][0];
K[2][2]= k[1][3][3]+k[3][3][3]+k[5][1][1];
K[2][3]= k[5][1][2];
K[2][4]= k[5][1][3];
K[3][0]= k[4][2][0];
K[3][1]= k[5][2][0];
K[3][2]= k[4][2][1];
K[3][3]= k[2][2][2]+k[4][2][2]+k[5][2][2];
K[3][4]= k[2][2][3]+k[4][2][3]+k[5][2][3];
K[4][0]= k[4][3][0];
K[4][1]= k[5][3][0];
K[4][2]= k[5][3][1];
K[4][3]= k[2][2][2]+k[4][3][2]+k[5][3][2];
K[4][4]= k[2][3][3]+k[4][3][3]+k[5][3][3];
}
void MessageInputDataTEXT(){
int i;
char Ql=176;
printf("n ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf(" Input Data ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf("n");
}
double SQRT2(double D){
int it,itermax;
double residual,tolerance,x,dx,dx_ABS,f,df;
it = 0; // initialize iteration count
itermax = 100000;
residual = 100; // initialize residual
tolerance = 1e-8;
x = 1;// initialize answer
while (residual > tolerance){
f = x*x - D;
df = 2 * x;
dx = f/df;
x= x - dx;
residual = ABS(dx); // abs residual
it = it + 1; // increment iteration count
//printf("f: %f -tdx: %f -tresidual: %fn",f,dx,residual);
if (it == itermax){
//printf("tSQRT2(number,power) : SQRT2(%f) - iteration: %d -> ## The solution is not converged ##n",D,it);
break;
}
}
if (it < itermax){
//printf("tSQRT(number,power) - SQRT(%f,%f) : %f n",D,n, x);
return x;
}
}
double ABS(double B){
if (B < 0)
B = -B;//Absolute number
else
B = B;
return B;
}
void OUTPUT_text(int zMAX,int I[],int IT[],double reaction[],double DISP[][5],double eleF[][6]){
// TEXT OUTPUT
int i;
FILE *OutputFile;
OutputFile = fopen(ShowText06, "w");
fprintf(OutputFile,"ttttt ___________________________________________________________________________________________________________________n");
fprintf(OutputFile,"ttttt | >> IN THE NAME OF GOD << |n");
fprintf(OutputFile,"ttttt | Geometric and Material Nonlinearity Analysis of 2D Truss with Force Control and Ductility Damage Index Control. |n");
fprintf(OutputFile,"ttttt |___________________________________________________________________________________________________________________|n");
fprintf(OutputFile,"ttttt | Unit: Free unit |n");
fprintf(OutputFile,"ttttt | Newton-Raphson Method : Tangent procedure |n");
fprintf(OutputFile,"ttttt |___________________________________________________________________________________________________________________|n");
fprintf(OutputFile,"ttttt | Program is written by Salar Delavar Ghashghaei |n");
fprintf(OutputFile,"ttttt | E-mail: salar.d.ghashghaei@gmail.com |n");
fprintf(OutputFile,"ttttt |___________________________________________________________________________________________________________________|n");
fprintf(OutputFile," ");
for (i=1;i<=145;i++)
fprintf(OutputFile,"-");
fprintf(OutputFile,"n");
fprintf(OutputFile," Increment Iteration Reaction Disp.[DOF(3)] Disp.[DOF(5)] Disp.[DOF(6)] Disp.[DOF(7)] Disp.[DOF(8)] n");
fprintf(OutputFile," ");
for (i=1;i<=145;i++)
fprintf(OutputFile,"-");
fprintf(OutputFile,"n");
for (i=0;i<zMAX;i++)
fprintf(OutputFile,"t%dt %d %e %e %e %e %e %en",I[i]+1,IT[i],reaction[i],DISP[i][0],DISP[i][1],DISP[i][2],DISP[i][3],DISP[i][4]);
fprintf(OutputFile," ");
for (i=1;i<=140;i++)
fprintf(OutputFile,"-");
fprintf(OutputFile,"n");
fprintf(OutputFile," Increment Axial Force-Ele(1) Axial Force-Ele(2) Axial Force-Ele(3) Axial Force-Ele(4) Axial Force-Ele(5) Axial Force-Ele(6) n");
fprintf(OutputFile," ");
for (i=1;i<=140;i++)
4. fprintf(OutputFile,"-");
fprintf(OutputFile,"n");
for (i=0;i<zMAX;i++)
fprintf(OutputFile,"t%dt %e %e %e %e %e %en",I[i]+1,eleF[i][0],eleF[i][1],eleF[i][2],eleF[i][3],eleF[i][4],eleF[i][5]);
fclose(OutputFile);
}
void OUTPUT_matlab(int zMAX,double reaction[],double DISP[][5]){
// MATLAB OUTPUT
int i;
FILE *OutputFile;
OutputFile = fopen(ShowText07, "w");
fprintf(OutputFile," %% Geometric and Material Nonlinearity Analysis of 2D Truss with Force Control and Ductility Damage Index Control. %%n");
fprintf(OutputFile,"BaseShear=[0n");
for(i=0;i<zMAX;i++)
fprintf(OutputFile,"%en",reaction[i]);
fprintf(OutputFile,"];nn");
fprintf(OutputFile,"Displacement=[0n");
for(i=0;i<zMAX;i++)
fprintf(OutputFile,"%en",DISP[i][1]);
fprintf(OutputFile,"];nn");
fprintf(OutputFile,"figure(1)n");
fprintf(OutputFile,"plot(Displacement,BaseShear,'LineWidth',3);n");
fprintf(OutputFile,"title(['#BASESHEAR - DISPLACEMENT DIAGRAM #'],'Color','b');n");
fprintf(OutputFile,"legend('C++','Location','NorthEastOutside');n");
fprintf(OutputFile,"xlabel('DISPLACEMENT [DOF(5)]');ylabel('BASESHEAR [DOF(1)]');grid on;n");
fclose(OutputFile);
}
void OUTPUT_excel(int zMAX,int I[],double DISP[][5],double eleF[][6],double reaction[]){
// EXCEL OUTPUT
int i;
FILE *OutputFile;
OutputFile = fopen(ShowText04, "w");
fprintf(OutputFile," ### Geometric and Material Nonlinearity Analysis of 2D Truss with Force Control and Ductility Damage Index Control ###n");
fprintf(OutputFile,"Increment,Base Shear [DOF(1)],Displacement [DOF(3)],Displacement [DOF(5)],Displacement [DOF(6)],Displacement [DOF(7)],Displacement [DOF(8)],Axial Force-Ele(1),Axial Force-Ele(2),Axial Force-Ele(3),Axial Force-Ele(4),Axial Force-Ele(5),Axial Force-Ele(6)n");
for(i=0;i<zMAX;i++)
fprintf(OutputFile,"%d,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%en",I[i]+1,reaction[i],DISP[i][0],DISP[i][1],DISP[i][2],DISP[i][3],DISP[i][4],eleF[i][0],eleF[i][1],eleF[i][2],eleF[i][3],eleF[i][4],eleF[i][5]);
fclose(OutputFile);
}
void OUTPUT_html(double Length,double Height,double Force[],double Fini,int itermax,double tolerance,int M,double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int zMAX,int I[],double DISP[][5],double eleF[][6],double reaction[],double DI){
// HTML OUTPUT
int i;
FILE *OutputFile;
OutputFile = fopen(ShowText05, "w");
fprintf(OutputFile,"<html> <body bgcolor="green">n");
// IMPORT IMAGE
fprintf(OutputFile,"<img src="PushoverNonlinear2DTrussFCGNDI-image01.png" style="width:1000px ; height:500px" alt="analysis01"><br><br>n");
// TOP TITLE oF HTML FILE
fprintf(OutputFile,"<table style=”width:100%” border="2px" width="1000px" height="120px" bgcolor="yellow">n");
fprintf(OutputFile,"<th bgcolor="cyan"> Geometric and Material Nonlinearity Analysis of 2D Truss with Force Control and Ductility Damage Index Control. - Output Report </th> n");
// TABLE 1
fprintf(OutputFile,"<table style=”width:100%” border="1px" width="1000px" height="120px" bgcolor="yellow">n");
fprintf(OutputFile,"<tr><th colspan="2" bgcolor="orange"> Input Data </th> </tr>n");
fprintf(OutputFile,"<tr> <th bgcolor="orange">Length of truss structure: </th><th> %.3e </th> </tr>n",Length);
fprintf(OutputFile,"<tr> <th bgcolor="orange">Height of truss structure: </th><th> %.3e </th> </tr>n",Height);
fprintf(OutputFile,"<tr> <th bgcolor="orange">External force [DOF(3)]: </th><th> %.3e </th> </tr>n",Force[0]);
fprintf(OutputFile,"<tr> <th bgcolor="orange">External force [DOF(5)]: </th><th> %.3e </th> </tr>n",Force[1]);
fprintf(OutputFile,"<tr> <th bgcolor="orange">External force [DOF(6)]: </th><th> %.3e </th> </tr>n",Force[2]);
fprintf(OutputFile,"<tr> <th bgcolor="orange">External force [DOF(7)]: </th><th> %.3e </th> </tr>n",Force[3]);
fprintf(OutputFile,"<tr> <th bgcolor="orange">External force [DOF(8)]: </th><th> %.3e </th> </tr>n",Force[4]);
fprintf(OutputFile,"<tr> <th bgcolor="orange">Ultimate external force [DOF(5)]: </th><th> %.3e </th> </tr>n",Fini);
fprintf(OutputFile,"<tr> <th bgcolor="orange">Number of increments: </th><th> %d </th> </tr>n",M);
fprintf(OutputFile,"<tr> <th bgcolor="orange">Maximum number of iterations: </th><th> %d </th> </tr>n",itermax);
fprintf(OutputFile,"<tr> <th bgcolor="orange">Specified tolerance for convergence: </th><th> %.3e </th> </tr>n",tolerance);
fprintf(OutputFile,"<tr> <th bgcolor="orange">Ductility Damage Index: </th><th> %.3e </th> </tr>n",DI);
// TABLE 2
fprintf(OutputFile,"<table style=”width:100%” border="1px" width="1000px" height="120px" bgcolor="yellow">n");
fprintf(OutputFile,"<tr><th colspan="10" bgcolor="orange"> Elements Strain-Stress </th> <tr>n");
fprintf(OutputFile,"<tr> <th bgcolor="orange"> Element Number </th> <th bgcolor="orange">Strain [1]</th> <th bgcolor="orange">Stress [1]</th><th bgcolor="orange">Strain [2]</th><th bgcolor="orange">Stress [2]</th><th bgcolor="orange">Strain [3]</th><th bgcolor="orange">Stress [3]</th><th bgcolor="orange">Strain [4]</th> <th bgcolor="orange">Stress [4]</th><th bgcolor="orange">Section Area </th></tr>n");
for(i=0;i<6;i++){
fprintf(OutputFile,"<tr> <td align ="center"> %d </td> <td align ="center"> %.3e </td> <td align ="center"> %.3e </td><td align ="center">%.3e </td><td align ="center"> %.3e </td><td align ="center"> %.3e </td><td align ="center"> %.3e </td><td align ="center"> %.3e </td><td align ="center"> %.3e </td><td align ="center"> %.3e </td></td> </tr>n",i+1,D1[i],F1[i],D2[i],F2[i],D3[i],F3[i],D4[i],F4[i],A[i]);
}
// TABLE 3
fprintf(OutputFile,"<table style=”width:100%” border="1px" width="1000px" height="120px" bgcolor="yellow">n");
fprintf(OutputFile,"<tr><th colspan="6" bgcolor="orange"> Structral Deformation </th> <tr>n");
fprintf(OutputFile,"<tr> <th bgcolor="orange"> Increment </th> <th bgcolor="orange">Displacement [DOF(3)]</th> <th bgcolor="orange">Displacement [DOF(5)]</th><th bgcolor="orange">Displacement [DOF(6)]</th><th bgcolor="orange">Displacement [DOF(7)]</th><th bgcolor="orange">Displacement [DOF(8)]</th></tr>n");
for(i=0;i<zMAX;i++){
fprintf(OutputFile,"<tr> <td align ="center"> %d </td> <td align ="center"> %.3e </td> </td> <td align ="center"> %.3e </td></td> <td align ="center"> %.3e </td></td> <td align ="center"> %.3e </td></td> <td align ="center"> %.3e </td></tr>n",i+1,DISP[i][0],DISP[i][1],DISP[i][2],DISP[i][3],DISP[i][4]);
}
// TABLE 4
fprintf(OutputFile,"<table style=”width:100%” border="1px" width="1000px" height="120px" bgcolor="yellow">n");
fprintf(OutputFile,"<tr><th colspan="10" bgcolor="orange"> Structral Element Internal Forces </th> </tr>n");
fprintf(OutputFile,"<tr> <th bgcolor="orange"> Increment </th> <th bgcolor="orange">Base Shear [DOF(1)]</th> <th bgcolor="orange">Axial Force-Ele(1)</th> <th bgcolor="orange">Axial Force-Ele(2)</th> <th bgcolor="orange">Axial Force-Ele(3)</th> <th bgcolor="orange">Axial Force-Ele(4)</th> <th bgcolor="orange">Axial Force-Ele(5)</th> <th bgcolor="orange">Axial Force-Ele(6)</th></tr>n");
for(i=0;i<zMAX;i++){
fprintf(OutputFile,"<tr> <td align ="center"> %d </td> <td align ="center"> %.3e </td> <td align ="center"> %.3e </td> <td align ="center">%.3e </td><td align ="center"> %.3e </td><td align ="center"> %.3e </td><td align ="center"> %.3e </td> <td align ="center"> %.3e </td></tr>n",i+1,reaction[i],eleF[i][0],eleF[i][1],eleF[i][2],eleF[i][3],eleF[i][4],eleF[i][5]);
}
fprintf(OutputFile,"</table></body></html>n");
fclose(OutputFile);
}
void MatrixDetermination(double A[][NN],int n){
// row operations
int i,j,k;
double Product,m,B[n][n];
for (i=0;i<n;i++)
for (j=0;j<n;j++)
B[i][j]=A[i][j];
for (k=0;k<n-1;k++)
for (i=k+1;i<n;i++)
{
m=B[i][k]/B[k][k];
for (j=0;j<n;j++)
B[i][j]-=m*B[k][j];
}
Product=1;
for (i=0;i<n;i++)
Product *= B[i][i];
// display results
if (Product == 0)
{
printf("ant ### it Seens that Golobal Matrix is singular or structure is unstable!!! ###n");
Sleep(40000);
exit(1);
}
}
void MessageErrorReportTEXT(){
int i;
char Ql;
Ql=176;
textcolor(12);
printf("an ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf(" Error Report ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf("n");
}
void MessageCheck_IMPORT_FILE01(double Length,double Height,int itermax,double tolerance,double DI){
if ( Length <0 || Height <0 || itermax < 0 || tolerance<0 ){
MessageErrorReportTEXT();
printf(" Please check this file! ->[%s]n",ShowText01);
printf(" *** Negative data input value is not acceptable ***n");
printf(" Truss length: %fn",Length);
printf(" Truss height: %fn",Height);
printf(" Maximum iteration: %dn",itermax);
printf(" Tolerance: %.3en",tolerance);
printf(" Damage Index: %.3en",DI);
Sleep(40000);
exit(1);
}
}
void MessageCheck_IMPORT_FILE02(double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int n){
int i;
for (i=0;i<n;i++){
if (F1[i] <= 0 || D1[i] <= 0 || F2[i] <= 0 || D2[i] <= 0 || F3[i] <= 0 || D3[i] <=0 || F4[i] <=0 || D4[i] <= 0 || A[i] <= 0){
MessageErrorReportTEXT();
printf(" Please check this file! ->[%s]n",ShowText02);
printf(" *** Negative data input value is not acceptable ***n");
printf(" Row %d has a negative value.n",i+1);
printf(" Strain-1 [%d]: %fn",i,D1[i]);
printf(" Stress-1 [%d]: %fn",i,F1[i]);
printf(" Strain-2 [%d]: %fn",i,D2[i]);
printf(" Stress-2 [%d]: %fn",i,F2[i]);
printf(" Strain-3 [%d]: %fn",i,D3[i]);
printf(" Stress-3 [%d]: %fn",i,F3[i]);
printf(" Strain-4 [%d]: %fn",i,D4[i]);
printf(" Stress-4 [%d]: %fn",i,F4[i]);
printf(" Section area [%d]: %fn",i,A[i]);
Sleep(40000);
exit(1);
}
}
}
void MessageNotConverge(int ii,int iit){
Distance(ii+1);
printf("%dt %d -> ## This step is not converged ##n",ii+1,iit);
}
void MessageConverge(int ii,int iit,double A[],double B[]){
Distance(ii+1);
printf("%dt %d %.3e %.3e %.3e %.3e %.3e %.3en",ii+1,iit,B[ii],A[0],A[1],A[2],A[3],A[4]);
}
void Distance(int i){
if (i < 10)
printf("t");
if (i >= 10 && i <= 99)
printf("btb");
if (i >= 100 && i <= 999)
printf("btbb");
if (i >= 1000 && i <= 9999)
printf("btbbb");
if (i >= 10000 && i <= 20000)
printf("btbbbb");
}
double MAX(double A[],int n){
int i;
double Amax;
Amax = A[0];
5. for (i=1;i<n;i++){
if (Amax < A[i])
Amax=A[i];
}
return Amax;//Maximum DATA
}
void SLOPE(double D1[],double F1[],double D2[],double F2[],double D3[],double F3[],double D4[],double F4[],double E1[],double E2[],double E3[],double E4[],int kn){
for (int i=0;i<kn;i++){
E1[i]=(F1[i]-0)/(D1[i]-0);
E2[i]=(F2[i]-F1[i])/(D2[i]-D1[i]);
E3[i]=(F3[i]-F2[i])/(D3[i]-D2[i]);
E4[i]=(F4[i]-F3[i])/(D4[i]-D3[i]);
//printf("E4: %fn",E4[i]);
}
}
void SHOW_INITAL_REPORT_TEXT(){
int i;
printf(" ");
for (i=1;i<=145;i++)
printf("-");
printf("n");
printf(" Increment Iteration Reaction Disp.[DOF(3)] Disp.[DOF(5)] Disp.[DOF(6)] Disp.[DOF(7)] Disp.[DOF(8)] n");
printf(" ");
for (i=1;i<=145;i++)
printf("-");
printf("n");
}
void textcolor(int ForgC){
WORD wColor;
//This handle is needed to get the current background attribute
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
//csbi is used for wAttributes word
if(GetConsoleScreenBufferInfo(hStdOut, &csbi)){
//To mask out all but the background attribute, and to add the color
wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F);
SetConsoleTextAttribute(hStdOut, wColor);
}
return;
}
void ANALYSIS(double Length,double Height,double Force[],double Fini,int itermax,double tolerance,double F1[],double D1[],double F2[],double D2[],double F3[],double D3[],double F4[],double D4[],double A[],int kn,int m,double DI){
int i,it,zz,zMAX,well_done;
double residual;
double EA[Ne],G[Ne],lanX[Ne],lanY[Ne],ele_force[Ne],es[Ne],strain[Ne];
double k[Ne][4][4],u[NN],F[NN],Ktot[NN][NN],Kt[NN][NN],InvKtot[NN][NN],f[NN],du[NN];
double E1[10],E2[10],E3[10],E4[10];
double *reaction= new double [N];
double *DU= new double [N];
int *I= new int [N];
int *IT= new int [N];
double *DISP_DOF_5 = new double [N];
double DISP[N][5],eleF[N][Ne];
SLOPE(D1,F1,D2,F2,D3,F3,D4,F4,E1,E2,E3,E4,kn);
F[0]=Force[0];F[2]=Force[2];F[3]=Force[3];F[4]=Force[4];
SHOW_INITAL_REPORT_TEXT();
for (zz=0;zz <= m || well_done !=1;zz++){
F[1] =Force[1]*(zz+1);// Define the applied load
ElementStiffness(Ne,Length,Height,es,u,D1,D2,D3,D4,E1,E2,E3,E4,F1,F2,F3,F4,A,EA,k,G);
// Total Stiffness
MatrixAssembled(k,Ktot);
// Inverse [Ktot]
MatrixInverse(Ktot,InvKtot,NN);
it = 0; // initialize iteration count
residual = 100; // initialize residual
while (residual > tolerance){
ElementStiffness(Ne,Length,Height,es,u,D1,D2,D3,D4,E1,E2,E3,E4,F1,F2,F3,F4,A,EA,k,G);
MatrixAssembled(k,Kt);
// Finding the determinant of a square matrix
MatrixDetermination(Kt,NN);
// [f] =[Kt] - [u] - [F]
MatrixMulti01(Kt,u,F,f,NN);
// [du] =[InvKtot] * [f]
MatrixMulti02(InvKtot,f,du,u,NN);
// Max residual
residual = MAX_ABS(du,NN);
it += 1; // increment iteration count
if (it == itermax){
MessageNotConverge(zz,it);
break;
}
} // while
// Force and Dispalcement for each increment
reaction[zz] = Force[1]*(zz+1) + Force[0] + Force[3];
DISP_DOF_5[zz] = u[1];
DU[zz]=residual;I[zz]=zz;IT[zz]=it;
// iteration control
if (it < itermax)
MessageConverge(zz,it,u,reaction);
zMAX = zz+1;
// Internal force of each element
ElementInternalForce(EA,es,ele_force);
// Internal force and displacement of each increment
for (i=0;i<Ne;i++){
eleF[zz][i] = ele_force[i];
DISP[zz][i] = u[i];
}
for (i=0;i<Ne;i++){ // Control Strain Damage Index.
strain[i] = DI*(D4[i]-D1[i])+D1[i];
// printf("tt DI strain[%d]: %.3e - ele. strain[%d]: %.3e n",i+1,strain[i],i+1,es[i]);
if (ABS(es[i]) >= ABS(strain[i])){
printf("n ## Strain in element[%d]: %.3e reached to Strain Damage Index: %.3e ##nn",i+1,es[i],strain[i]);
well_done = 1;
}
if (well_done ==1)
break;
}
if (ABS(u[0]) >= Fini){
printf("n ## External force [DOF(5)] reached to ultimate force ##nn");
well_done = 1;
break;
}
if (ABS(reaction[zz]) >= Fini){
printf("n ## External force [DOF(5)] reached to ultimate force ##nn");
well_done = 1;
break;
}
}// for - force increment
if (well_done ==1 ){
if (zMAX >= 25) BILINEAR_CURVE(DISP_DOF_5,reaction,zMAX);
OUTPUT_text(zMAX,I,IT,reaction,DISP,eleF);
OUTPUT_matlab(zMAX,reaction,DISP);
OUTPUT_excel(zMAX,I,DISP,eleF,reaction);
OUTPUT_html(Length,Height,Force,Fini,itermax,tolerance,m,D1,F1,D2,F2,D3,F3,D4,F4,A,zMAX,I,DISP,eleF,reaction,DI);
OUTPUT_HTML_GRAPH(DISP,reaction,zMAX);
textcolor(15);
printf("na - %s -",ShowText03);
system("start /w Graph-outputHTML.html");
DATE_TIME();
}
}
void DATE_TIME(){
printf("nt");
system("echo %date%");
printf("t");
system("echo %time%");
}
void MessageAnalysisReportTEXT(){
int i;
char Ql;
Ql=176;
printf("an ");
for (i=1;i<64;i++)
printf("%c",Ql);
printf(" Analysis Report ");
for (i=1;i<64;i++)
printf("%c",Ql);
printf("n");
}
void BILINEAR_CURVE(double A[],double B[],int M){
double AaSUM=0,B_max=0,k0;
int I,Mmax;
double *AA = (double *) malloc(N);
double *BB = (double *) malloc(N);
double C[6];
for (I=0;I<6;I++);
C[I] =0;
Mmax=0;
for (I=0;I<M;I++){
if (ABS(B_max) < ABS(B[I])){
B_max = ABS(B[I]);
Mmax =I;
}//if
}//for
Mmax =I;
for (I=0;I<Mmax;I++){
AA[I+1]=ABS(A[I]);
BB[I+1]=ABS(B[I]);
}
for (I=0;I<Mmax;I++){ // Mmax-1
AaSUM += ((BB[I]+BB[I+1])*0.5*(AA[I+1]-AA[I]));;
}
C[1]=0;// C[0]=D_y ; C[1]=D_u ; C[2]=F_y ; C[3]=F_u ; C[4]=SC ; C[5]=OF ;
B_max=0;
for (I=0;I<Mmax+1;I++){ // find max
if(C[1] < AA[I])
C[1]=AA[I];
if(B_max < BB[I])
B_max =BB[I];
}
C[3]=BB[I-1];//printf("t %fn",C[3]);
k0 =BB[4]/AA[4];//printf("t %fn",k0);
C[0] = (C[3]*C[1]*0.5-AaSUM)/(C[3]*0.5 - k0*C[1]*0.5);//printf("t %fn",C[0]);