# Team:Washington-Software/Modeling

### From 2009.igem.org

(Difference between revisions)

(Prototype team page) |
|||

Line 1: | Line 1: | ||

- | + | ==Mathematical Modeling== | |

+ | ===Alpha=== | ||

+ | ====Problem==== | ||

+ | Given the following construction and point ''p'', or (''x'',''y'',''z'') find the angles ''θ<sub>1</sub>'', ''θ<sub>2</sub>'', and ''θ<sub>3</sub>''. | ||

+ | |||

+ | Note that positive ''z'' is the down direction. | ||

+ | |||

+ | ====Constants==== | ||

+ | *''TR'' | ||

+ | **Top radius | ||

+ | *''BR'' | ||

+ | **Bottom radius | ||

+ | *''L'' | ||

+ | **Linkage | ||

+ | *''CA'' | ||

+ | **Control Arm | ||

+ | *''φ<sub>1</sub>'' and ''φ<sub>2</sub>'' | ||

+ | **Two angles | ||

+ | |||

+ | ====Construction==== | ||

+ | From the top to the bottom: | ||

+ | *A circle centered at the origin with radius ''TR'', named ''O'' | ||

+ | *Make three lines ''A<sub>1</sub>'', ''A<sub>2</sub>'', and ''A<sub>3</sub>'' such that: | ||

+ | **The lines ''A<sub>x</sub>'' are perpendicular to a tangent of ''O'' and a radius of ''O'', | ||

+ | **The angle between the radii of ''A<sub>1</sub>'' and ''A<sub>2</sub>'' is ''φ<sub>1</sub>'', and | ||

+ | **The angle between the radii of ''A<sub>2</sub>'' and ''A<sub>3</sub>'' is ''φ<sub>2</sub>''. | ||

+ | *Make a circle centered at point ''p'' with radius ''BR'', named ''P'' | ||

+ | *Find three points ''P<sub>1</sub>'', ''P<sub>2</sub>'', and ''P<sub>3</sub>'' such that: | ||

+ | **They are on the circumference of ''P'', | ||

+ | **The angle between the radius which touches ''P<sub>1</sub>'' and the radius that touches ''P<sub>2</sub>'' is ''φ<sub>1</sub>'', | ||

+ | **The angle between the radius which touches ''P<sub>2</sub>'' and the radius that touches ''P<sub>3</sub>'' is ''φ<sub>2</sub>'', | ||

+ | **The ray from the center of ''P'' to ''P<sub>x</sub>'' is parallel to the ray from the center of ''O'' to the point which is on ''A<sub>x</sub>'' and ''O'' 's circumference, for all ''x''. | ||

+ | *Construct three line segments ''CA<sub>1</sub>'', ''CA<sub>2</sub>'', and ''CA<sub>3</sub>'' such that: | ||

+ | **''CA<sub>x</sub>'' is in the same plane as ''A<sub>x</sub>'', for all ''x'', and | ||

+ | **The angle between ''CA<sub>x</sub>'' and ''A<sub>x</sub>'' is ''θ<sub>x</sub>'', for all ''x''. | ||

+ | *The distance between ''P<sub>x</sub>'' and the end point of ''CA<sub>x</sub>'' that is not on ''A<sub>x</sub>'' is ''L'', for all ''x''. | ||

+ | |||

+ | ====Solution==== | ||

+ | #Note that the control arms can only move in a circle, while linkage can move in a sphere. | ||

+ | #We will calculate ''θ<sub>1</sub>'' first, which only involves the points, circles and lines ''p'', ''CA<sub>1</sub>'', ''A<sub>1</sub>'', and ''P<sub>1</sub>''. | ||

+ | #Find the plane where ''CA<sub>1</sub>'' 's circle resides in. Use it to cut the sphere around ''P<sub>1</sub>''. For future reference, call ''CA<sub>1</sub>'' 's circle ''C<sub>1</sub>'' and the circle resulting from the cut ''C<sub>2</sub>'' | ||

+ | #Define ''x<sub>o<sub>1</sub></sub>'', for x offset, for the difference in the ''x'' coordinates of the center of ''C<sub>1</sub>'' and the point ''P<sub>1</sub>''. | ||

+ | #*''x<sub>o<sub>1</sub></sub> = TR - (BR + x)'' | ||

+ | #*''x<sub>o<sub>1</sub></sub> = TR - BR - x'' | ||

+ | #Define ''D<sub>1</sub>'' to be the distance between the center of ''C<sub>1</sub>'' and ''C<sub>2</sub>''. It will also be the line connecting the centers. | ||

+ | #*''D<sub>1</sub> = sqrt(x<sub>1</sub><sup>2</sup> + z<sup>2</sup>)'' | ||

+ | #Obviously, ''D<sub>1</sub>'', ''CA<sub>1</sub>'', and linkage form a triangle. The angle between ''CA<sub>1</sub>'' and ''D<sub>1</sub>'' is a close approximation to ''θ<sub>1</sub>'', but it is not exact. We will call this angle ''θ<sub>1<sub>1</sub></sub>''. We use the law of cosines to calculate ''θ<sub>1<sub>1</sub></sub>''. | ||

+ | #*''L<sup>2</sup> = CA<sup>2</sup> + D<sup>2</sup> - CA * D * cos(θ<sub>1<sub>1</sub></sub>)''<br><br> | ||

+ | #*''θ<sub>1<sub>1</sub></sub> = cos<sup>-1</sup>((D<sup>2</sup> + CA<sup>2</sup> - L<sup>2</sup>)/(2*D*CA))''<br><br> | ||

+ | #One endpoint of ''D<sub>1</sub>'' is on ''A<sub>1</sub>''. Thus, we can make another triangle, and the angle between ''D<sub>1</sub>'' and ''A<sub>1</sub>'' is the difference between ''θ<sub>1</sub>'' and ''θ<sub>1<sub>1</sub></sub>''. We will call this angle ''θ<sub>1<sub>2</sub></sub>''. If we have the length of the side on ''A<sub>1</sub>'' be ''z'', then the last side will be ''x<sub>o</sub>'' and the triangle will be a right angle triangle. Since only ''x<sub>o<sub>1</sub></sub>'' changes sign in the good interval, we should use a trigonometric function that involves ''x<sub>o</sub>'' in the numerator. Thus, | ||

+ | #*''θ<sub>1<sub>2</sub></sub> = sin<sup>-1</sup>(x<sub>o<sub>1</sub></sub>/D<sub>1</sub>)''<br><br> | ||

+ | #*''θ<sub>1</sub> = cos<sup>-1</sup>((D<sup>2</sup> + CA<sup>2</sup> - L<sup>2</sup>)/(2*D*CA)) - sin<sup>-1</sup>(x<sub>o<sub>1</sub></sub>/D<sub>1</sub>)'' | ||

+ | #You just have to rotate the model ''φ<sub>1</sub>'' degrees counterclockwise for ''θ<sub>2</sub>'', and another ''φ<sub>2</sub>'' degrees for ''θ<sub>3</sub>'' using the two dimensional rotational matrixes | ||

+ | {''cos(φ<sub>2</sub>),-sin(φ<sub>2</sub>)''} | ||

+ | ''R<sub>1</sub>''={ } | ||

+ | {''sin(φ<sub>2</sub>) cos(φ<sub>2</sub>)''} | ||

+ | |||

+ | {''cos(φ<sub>3</sub>) -sin(φ<sub>3</sub>)''} | ||

+ | ''R<sub>2</sub>''={ } | ||

+ | {''sin(φ<sub>3</sub>) cos(φ<sub>3</sub>)''} |

## Revision as of 23:31, 5 October 2009

## Contents |

## Mathematical Modeling

### Alpha

#### Problem

Given the following construction and point *p*, or (*x*,*y*,*z*) find the angles *θ _{1}*,

*θ*, and

_{2}*θ*.

_{3}Note that positive *z* is the down direction.

#### Constants

*TR*- Top radius

*BR*- Bottom radius

*L*- Linkage

*CA*- Control Arm

*φ*and_{1}*φ*_{2}- Two angles

#### Construction

From the top to the bottom:

- A circle centered at the origin with radius
*TR*, named*O* - Make three lines
*A*,_{1}*A*, and_{2}*A*such that:_{3}- The lines
*A*are perpendicular to a tangent of_{x}*O*and a radius of*O*, - The angle between the radii of
*A*and_{1}*A*is_{2}*φ*, and_{1} - The angle between the radii of
*A*and_{2}*A*is_{3}*φ*._{2}

- The lines
- Make a circle centered at point
*p*with radius*BR*, named*P* - Find three points
*P*,_{1}*P*, and_{2}*P*such that:_{3}- They are on the circumference of
*P*, - The angle between the radius which touches
*P*and the radius that touches_{1}*P*is_{2}*φ*,_{1} - The angle between the radius which touches
*P*and the radius that touches_{2}*P*is_{3}*φ*,_{2} - The ray from the center of
*P*to*P*is parallel to the ray from the center of_{x}*O*to the point which is on*A*and_{x}*O*'s circumference, for all*x*.

- They are on the circumference of
- Construct three line segments
*CA*,_{1}*CA*, and_{2}*CA*such that:_{3}*CA*is in the same plane as_{x}*A*, for all_{x}*x*, and- The angle between
*CA*and_{x}*A*is_{x}*θ*, for all_{x}*x*.

- The distance between
*P*and the end point of_{x}*CA*that is not on_{x}*A*is_{x}*L*, for all*x*.

#### Solution

- Note that the control arms can only move in a circle, while linkage can move in a sphere.
- We will calculate
*θ*first, which only involves the points, circles and lines_{1}*p*,*CA*,_{1}*A*, and_{1}*P*._{1} - Find the plane where
*CA*'s circle resides in. Use it to cut the sphere around_{1}*P*. For future reference, call_{1}*CA*'s circle_{1}*C*and the circle resulting from the cut_{1}*C*_{2} - Define
*x*, for x offset, for the difference in the_{o1}*x*coordinates of the center of*C*and the point_{1}*P*._{1}*x*_{o1}= TR - (BR + x)*x*_{o1}= TR - BR - x

- Define
*D*to be the distance between the center of_{1}*C*and_{1}*C*. It will also be the line connecting the centers._{2}*D*_{1}= sqrt(x_{1}^{2}+ z^{2})

- Obviously,
*D*,_{1}*CA*, and linkage form a triangle. The angle between_{1}*CA*and_{1}*D*is a close approximation to_{1}*θ*, but it is not exact. We will call this angle_{1}*θ*. We use the law of cosines to calculate_{11}*θ*._{11}*L*^{2}= CA^{2}+ D^{2}- CA * D * cos(θ_{11})

*θ*_{11}= cos^{-1}((D^{2}+ CA^{2}- L^{2})/(2*D*CA))

- One endpoint of
*D*is on_{1}*A*. Thus, we can make another triangle, and the angle between_{1}*D*and_{1}*A*is the difference between_{1}*θ*and_{1}*θ*. We will call this angle_{11}*θ*. If we have the length of the side on_{12}*A*be_{1}*z*, then the last side will be*x*and the triangle will be a right angle triangle. Since only_{o}*x*changes sign in the good interval, we should use a trigonometric function that involves_{o1}*x*in the numerator. Thus,_{o}*θ*_{12}= sin^{-1}(x_{o1}/D_{1})

*θ*_{1}= cos^{-1}((D^{2}+ CA^{2}- L^{2})/(2*D*CA)) - sin^{-1}(x_{o1}/D_{1})

- You just have to rotate the model
*φ*degrees counterclockwise for_{1}*θ*, and another_{2}*φ*degrees for_{2}*θ*using the two dimensional rotational matrixes_{3}

{cos(φ}_{2}),-sin(φ_{2})R={ } {_{1}sin(φ}_{2}) cos(φ_{2})

{cos(φ}_{3}) -sin(φ_{3})R={ } {_{2}sin(φ}_{3}) cos(φ_{3})