Cone Ply Piece Optimization Tool (desicos.cppot
)¶
Please, refer to the CPPOT tutorial for more details about how to use this module.
Cone Virtual Material Model (desicos.cppot.core
)¶
CPPOT-geometry (desicos.cppot.core.geom
)¶
Classes and functions to help with 2D geometrical operations.
-
class
desicos.cppot.core.geom.
ConeGeometry
(H, rbot, alpharad, extra_height)[source]¶ ConeGeometry object
Carries all the information about the geometry of a cone, plus some read-only accessors to calculate often-needed cone properties. These are all calculated on-the-fly, so no rebuild()-ing is necessary.
Attribute
Description
H
float
, height of the free area of the cone.rbot
float
, bottom radius of the conealpharad
float
, semi-vertex angle of the cone, in radians. Must be between 0 and pi/2.extra_height
float
, extra (support) height. A section with this height is added along both the top and bottom edge of the free cone. This represents the extra material that is present during manufacturing.- Attributes
L
Read-only property: Meridional length.
cone_area
Read-only property: Surface area of the free cone (supports excluded).
cos_alpha
Read-only property: Cosine of the semi-vertex angle.
rtop
Read-only property: Top radius of the cone.
s1
Read-only property: Radius of top (support) edge in unfolded coordinates.
s2
Read-only property: Radius of top edge of the free cone in unfolded coordinates.
s3
Read-only property: Radius of bottom edge of the free cone in unfolded coordinates.
s4
Read-only property: Radius of bottom (support) edge in unfolded coordinates.
sin_alpha
Read-only property: Sine of the semi-vertex angle.
tan_alpha
Read-only property: Tangent of the semi-vertex angle.
Methods
from_conecyl
(cc, extra_height)Construct a ConeGeometry object based on an existing ConeCyl
-
property
L
¶ Read-only property: Meridional length.
-
property
cone_area
¶ Read-only property: Surface area of the free cone (supports excluded).
-
property
cos_alpha
¶ Read-only property: Cosine of the semi-vertex angle.
-
classmethod
from_conecyl
(cc, extra_height)[source]¶ Construct a ConeGeometry object based on an existing ConeCyl
- Parameters
- cc
ConeCyl
Existing cone to use. Must be a cone, i.e. alpha > 0.
- extra_heightfloat
Extra support height for this model.
- cc
- Returns
- cg
ConeGeometry
The constructed ConeGeometry object
- cg
-
property
rtop
¶ Read-only property: Top radius of the cone.
-
property
s1
¶ Read-only property: Radius of top (support) edge in unfolded coordinates.
-
property
s2
¶ Read-only property: Radius of top edge of the free cone in unfolded coordinates.
-
property
s3
¶ Read-only property: Radius of bottom edge of the free cone in unfolded coordinates.
-
property
s4
¶ Read-only property: Radius of bottom (support) edge in unfolded coordinates.
-
property
sin_alpha
¶ Read-only property: Sine of the semi-vertex angle.
-
property
tan_alpha
¶ Read-only property: Tangent of the semi-vertex angle.
-
class
desicos.cppot.core.geom.
Line2D
(a, b, c)[source]¶ Class representing a line on a two-dimensional plane It is based on
namedtuple
, which allows both named attribute access (line.a) and iteration / indexing. Line2D instances are immutable after construction.The line is defined based on two equations: a*x + b*y = c a**2 + b**2 = 1 The latter normalization constraint is enforced in
__new__
Attribute
Description
a
float
, Line parameter in equation (a*x + b*y = c)b
float
, Line parameter in equation (a*x + b*y = c)c
float
, Line parameter in equation (a*x + b*y = c)- Attributes
- a
Alias for field number 0
- b
Alias for field number 1
- c
Alias for field number 2
Methods
all_intersections_circle
(radius)Get all intersection points of a line with a circle The center of the circle is presumed to be at the origin
angle
()Calculate the angle of this line with respect to the x-axis
count
(value, /)Return number of occurrences of value.
Obtain a point representing a unit direction vector parallel to the line.
distance_point
(point)Get the shortest Euclidean distance between this line and a point
from_point_angle
(point, angle)Class method, constructs a line based on a point and an angle
from_points
(point1, point2)Class method, constructs a line based on two points
index
(value[, start, stop])Return first index of value.
intersection_circle_near
(radius, near_point)Get the intersection of a line with a circle If there is more than one intersection point, it returns the intersection closest to near_point.
intersection_line
(other)Get the intersection point of this line and another line
point_on_right
(point)Check on which side of this line a point lies
rotate
(angle)Created a new line, rotated with respect to the origin.
-
all_intersections_circle
(radius)[source]¶ Get all intersection points of a line with a circle The center of the circle is presumed to be at the origin
- Parameters
- radiusfloat
Radius of circle
- Returns
- intersection_pointslist of
Point2D
List containing either 0, 1 or 2 intersection points
- intersection_pointslist of
Notes
See also: http://en.wikipedia.org/wiki/Intersection_(Euclidean_geometry)#A_line_and_a_circle
-
angle
()[source]¶ Calculate the angle of this line with respect to the x-axis
- Returns
- anglefloat
The counterclockwise angle (in radians) from the positive x-axis
-
direction
()[source]¶ Obtain a point representing a unit direction vector parallel to the line.
- Returns
- direction
Point2D
The requested unit direction vector
- direction
-
distance_point
(point)[source]¶ Get the shortest Euclidean distance between this line and a point
- Parameters
- point
Point2D
Point to find the distance to
- point
- Returns
- distancefloat
The shortest distance from this line to the given point.
-
classmethod
from_point_angle
(point, angle)[source]¶ Class method, constructs a line based on a point and an angle
-
classmethod
from_points
(point1, point2)[source]¶ Class method, constructs a line based on two points
- Parameters
- Returns
- line
Line2D
The constructed line
- line
Notes
If no line can be constructed, a ValueError is raised. This happens when the points are identical.
See also: http://math.stackexchange.com/questions/422602/convert-two-points-to-line-eq-ax-by-c-0
-
intersection_circle_near
(radius, near_point)[source]¶ Get the intersection of a line with a circle If there is more than one intersection point, it returns the intersection closest to near_point. If there is no intersection, a ValueError is raised.
-
intersection_line
(other)[source]¶ Get the intersection point of this line and another line
- Parameters
- other
Line2D
Other line to find intersection point with
- other
- Returns
- intersection_point
Point2D
The found intersection point
- intersection_point
Notes
If no intersection point could be found, a ValueError is raised. This can happen when the lines are parallel.
See also: http://en.wikipedia.org/wiki/Intersection_(Euclidean_geometry)#Two_lines
-
class
desicos.cppot.core.geom.
Point2D
(x, y)[source]¶ Class representing a point on a two-dimensional plane It is based on
namedtuple
, which allows both named attribute access (point.x) and iteration / indexing. Point2D instances are immutable after construction. Addition / subtraction operators are overloaded, as wel as pre-multiplying by a scalar.Attribute
Description
x
float
, Cartesian x-coordinatey
float
, Cartesian y-coordinate- Attributes
- x
Alias for field number 0
- y
Alias for field number 1
Methods
angle
()Calculate the angle of this point in polar coordinates
count
(value, /)Return number of occurrences of value.
distance
(other)Calculate Euclidean distance between two points.
from_polar
(norm, angle)Class method, creates a point from polar coordinates
index
(value[, start, stop])Return first index of value.
norm
()Calculate distance of this point with respect to the origin.
rotate
(angle)Created a new point, rotated with respect to the origin.
-
angle
()[source]¶ Calculate the angle of this point in polar coordinates
- Returns
- anglefloat
The counterclockwise angle (in radians) from the positive x-axis
-
class
desicos.cppot.core.geom.
Polygon2D
(iterable=(), /)[source]¶ Class representing a polygon on a two-dimensional plane. It is assumed that polygons do not self-intersect
Pass an iterable of
Point2D
-objects to the constructor. Polygon2D instances are immutable after construction.Notes
Even though this object if (currently) a tuple of its points, it is recommended to not rely on this. This to allow possible future changes to the underlying implementation.
Methods
area
()Calculate the area enclosed by this polygon.
contains_point
(point)Determine if a point is inside or outside the polygon
count
(value, /)Return number of occurrences of value.
get_closed_line
([num_points])Get a closed line that can be used to plot this polygon.
index
(value[, start, stop])Return first index of value.
points
()Get an iterator over all corner points in this polygon
rotate
(rotate_angle)Create a new polygon, idential to this one but rotated around the origin by a certain angle.
slice_line
(line)Slice this polygon, returning only the section on the right side of the given line.
-
contains_point
(point)[source]¶ Determine if a point is inside or outside the polygon
- Parameters
- point
Point2D
Point to test
- point
- Returns
- inside_polygonbool
True
if the point is inside the polygon,False
otherwise
Notes
The ‘Ray casting’ algorithm is used, since the ‘interior angle’ algorithm was found to be very slow.
This method has not been verified to work correctly for special cases, such as the point being (almost) exactly on a vertex or line.
-
get_closed_line
(num_points=1)[source]¶ Get a closed line that can be used to plot this polygon.
- Parameters
- num_pointsint
The number of points to use per edge. Default value is 1.
- Returns
- outtuple
out[0] contains a numpy array of x-coordinates, out[1] an array of y-coordinates. The first point in the polygon is repeated, such that plot(x, y) results in a closed polygon.
-
-
desicos.cppot.core.geom.
angle_in_range
(angle, angle_min, angle_max)[source]¶ Check if an angle is within the specified range (min..max) While taking care of all the (mod 2pi)-issues.
- Parameters
- anglefloat
The angle to check
- min_anglefloat
The lower limit of the range
- max_anglefloat
The upper limit of the range
- Returns
- in_rangebool
True iff the given angle is in range min_angle…max_angle
-
desicos.cppot.core.geom.
circle_segment_area
(radius, angle)[source]¶ Calculate the area of a circle segment, which is a region bound by an arc (less than 180 deg) and a straight line connecting the end points of that arc.
- Parameters
- radiusfloat
Radius of the arc
- anglefloat
Angle (in radians) of the arc
- Returns
- areafloat
The calculated area
Notes
Virtual Ply Model (desicos.cppot.core.ply_model
)¶
Classes to create a virtual model of the ply pieces on an actual cone.
-
class
desicos.cppot.core.ply_model.
PlyPiece
(polygon, phi_nom, phi_nom_min, phi_nom_max, phi_limit_min=None, phi_limit_max=None)[source]¶ PlyPiece object
Carries all the information about a single piece of ply in the layup of a cone, with a defined size and orientation.
Attributes
Description
polygon
Polygon2D
, containing the geometry of the ply piece.phi_nom
float
, angle at which the origin line (L0) of the ply piece intersects the circle with radiusstarting_position
phi_nom_min
float
, smallest angle phi that is contained within this ply piece at radiusstarting_position
phi_nom_max
float
, largest angle phi that is contained within this ply piece at radiusstarting_position
phi_limit_min
float
, minimum value of phi for any of the points inpolygon
. Optional, will be calculated if not supplied to the constructor.phi_limit_max
float
, minimum value of phi for any of the points inpolygon
. Optional, will be calculated if not supplied to the constructor.Notes
On the nominal circle (radius
starting_position
), this ply piece occupies the rangephi_nom_min
…``phi_nom_max``.For all points in this ply piece, the inequality
phi_limit_min <= phi <= phi_limit_max
should hold.Methods
angle_deviation
(point)Get the deviation between the local and nominal fiber angle at a certain point
contains_point
(point[, phi])Check if a point is contained in this ply piece
copy_rotated
(rotate_angle)Create a copy of this ply piece, which is rotated by a certain angle.
-
angle_deviation
(point)[source]¶ Get the deviation between the local and nominal fiber angle at a certain point
- Parameters
- pointPoint2D
Cartesian coordinates of the point. These are in the coordinate system of the unfolded cone, so (eta, zeta) (as floats).
- Returns
- angle_difffloat
Local minus nominal fiber angle at this point, in degrees
-
contains_point
(point, phi=None)[source]¶ Check if a point is contained in this ply piece
- Parameters
- pointPoint2D
The point to check. This is in the coordinate system of the unfolded cone, so (eta, zeta).
- phifloat
Angle corresponding to
point
. Parameter is optional, but passing it from the caller can help performance.
- Returns
- cointains_pointbool
True if the point is in this ply piece, false otherwise. For points exactly on the edge of the ply piece, resuls are undefined.
-
-
class
desicos.cppot.core.ply_model.
PlyPieceModel
(cg, fiber_angle, starting_position, max_width, rel_ang_offset=0.0, eccentricity=None)[source]¶ Abstract base class for all ply piece models
This class encapsulates all functionality to create a virtual ply model based on the given parameters. Various methods are available to subsequently extract information about this virtual ply model.
For the different ply piece shapes, subclasses should be made that define at least the method
construct_single_ply_piece
and possibly others.Methods
all_local_orientations
(eta, zeta)Determine the local fiber orientations of all plies at a point.
construct_single_ply_piece
([fraction])Construct a single ply piece.
Get the fiber orientations at all corners of the useful area, which is the area between radii s2 and s3.
Get the lengths of the edges of the (base) ply piece.
effective_area
([ply_piece, max_angle_dev])Get the effective area of a single ply piece.
local_num_pieces
(eta, zeta)Determine the local number of overlapping pieces at a given point.
local_orientation
(eta, zeta)Determine the local fiber orientation at a given point.
Determine the total number of pieces needed to fully cover the cone.
Get the area of a single ply piece that is on the free cone area, i.e.
Get the ratio of continuous fibers, i.e.
rebuild
()Rebuild the model, actually constructing all ply pieces
-
all_local_orientations
(eta, zeta)[source]¶ Determine the local fiber orientations of all plies at a point.
- Parameters
- etafloat
Horizontal coordinate of point, in the coordinate system of the unfolded cone.
- zetafloat
Vertical coordinate of point, in the coordinate system of the unfolded cone.
- Returns
- local_angleslist
Lists of floats representing the local fiber angle of each (possibly overlapping) ply piece at this point, in degrees.
-
construct_single_ply_piece
(fraction=1.0)[source]¶ Construct a single ply piece.
- Parameters
- fractionfloat
Optional, range (0, 1], default is 1. The newly constructed ply piece will normally span an angle
delta_phi
on the nominal circle (radiuss_theta_nom
) fromphi_nom_min
tophi_nom_max
. When this parameter is set unequal to 1,delta_phi
of the resulting ply piece will be the indicated fraction of the value it would normally have. This functionality is used to construct rest-pieces.
- Returns
- ply_piece
PlyPiece
The newly constructed ply piece.
- ply_piece
Notes
This method is just to define the interface, implementation should be provided by a derived class.
-
corner_orientations
()[source]¶ Get the fiber orientations at all corners of the useful area, which is the area between radii s2 and s3.
- Returns
- corner_orientationslist
Fiber angles (in degrees) at the four useful corner points of the base ply piece. The order of values matches P1, P2, P3, P4.
-
edge_lengths
()[source]¶ Get the lengths of the edges of the (base) ply piece.
- Returns
- edge_lengthslist
List of edge lengths (L1 to L4)
-
effective_area
(ply_piece=None, max_angle_dev=2.0)[source]¶ Get the effective area of a single ply piece. This is the area on useful section of the cone, where the deviation of the fiber angle is less than a given maximum.
- Parameters
- ply_piece
PlyPiece
, optional Ply piece to get the effective area for. If not set, the base piece is used.
- max_angle_devfloat, optional
Maximum deviation from the nominal fiber angle to consider the material ‘effective’. In degrees.
- ply_piece
- Returns
- outtuple
2-tuple, where
out[0]
is the effective surface area andout[1]
is the corresponding polygon.
Notes
Note that the polygon has straight edges, while the calculation of the effective area takes into account that some edges of the effective area may be arc sections.
-
local_num_pieces
(eta, zeta)[source]¶ Determine the local number of overlapping pieces at a given point.
- Parameters
- etafloat
Horizontal coordinate of point, in the coordinate system of the unfolded cone.
- zetafloat
Vertical coordinate of point, in the coordinate system of the unfolded cone.
- Returns
- num_piecesint
Number of overlapping pieces at the given point in the ply
-
local_orientation
(eta, zeta)[source]¶ Determine the local fiber orientation at a given point. If the given point is not inside any ply piece, NaN is returned. If there are multiple overlapping ply pieces, the orientation belonging to one of them (the first in the ply piece list) is returned.
- Parameters
- etafloat
Horizontal coordinate of point, in the coordinate system of the unfolded cone.
- zetafloat
Vertical coordinate of point, in the coordinate system of the unfolded cone.
- Returns
- local_anglefloat
Local fiber angle at the given point in the given ply, in degrees.
-
num_pieces
()[source]¶ Determine the total number of pieces needed to fully cover the cone.
- Returns
- num_piecesfloat
The number of needed pieces, as a float. The fractional part indicates the size of the ‘rest piece’ that is needed.
-
ply_piece_area
()[source]¶ Get the area of a single ply piece that is on the free cone area, i.e. between radii s2 and s3.
- Returns
- areafloat
The aforementioned area
-
-
class
desicos.cppot.core.ply_model.
RectPlyPieceModel
(cg, fiber_angle, starting_position, max_width, rel_ang_offset=0.0, eccentricity=None)[source]¶ Sub-class of
PlyPieceModel
, for shape C (rectangle)Methods
all_local_orientations
(eta, zeta)Determine the local fiber orientations of all plies at a point.
construct_single_ply_piece
([fraction])Construct a ply piece for shape C (rectangle)
corner_orientations
()Get the fiber orientations at all corners of the useful area, which is the area between radii s2 and s3.
edge_lengths
()Get the lengths of the edges of the (base) ply piece.
effective_area
([ply_piece, max_angle_dev])Get the effective area of a single ply piece.
local_num_pieces
(eta, zeta)Determine the local number of overlapping pieces at a given point.
local_orientation
(eta, zeta)Determine the local fiber orientation at a given point.
num_pieces
()Determine the total number of pieces needed to fully cover the cone.
ply_piece_area
()Get the area of a single ply piece that is on the free cone area, i.e.
ratio_continuous_fibers
()Get the ratio of continuous fibers, i.e.
rebuild
()Rebuild the model, actually constructing all ply pieces
-
class
desicos.cppot.core.ply_model.
Trapez2PlyPieceModel
(cg, fiber_angle, starting_position, max_width, rel_ang_offset=0.0, eccentricity=None)[source]¶ Sub-class of
PlyPieceModel
, for shape B (trapezium with one overlap)Methods
all_local_orientations
(eta, zeta)Determine the local fiber orientations of all plies at a point.
construct_single_ply_piece
([fraction])Construct a ply piece for shape A (trapezium)
corner_orientations
()Get the fiber orientations at all corners of the useful area, which is the area between radii s2 and s3.
edge_lengths
()Get the lengths of the edges of the (base) ply piece.
effective_area
([ply_piece, max_angle_dev])Get the effective area of a single ply piece.
local_num_pieces
(eta, zeta)Determine the local number of overlapping pieces at a given point.
local_orientation
(eta, zeta)Determine the local fiber orientation at a given point.
num_pieces
()Determine the total number of pieces needed to fully cover the cone.
ply_piece_area
()Get the area of a single ply piece that is on the free cone area, i.e.
ratio_continuous_fibers
()Get the ratio of continuous fibers, i.e.
rebuild
()Rebuild the model, actually constructing all ply pieces
-
class
desicos.cppot.core.ply_model.
TrapezPlyPieceModel
(cg, fiber_angle, starting_position, max_width, rel_ang_offset=0.0, eccentricity=None)[source]¶ Sub-class of
PlyPieceModel
, for shape A (trapezium)Methods
all_local_orientations
(eta, zeta)Determine the local fiber orientations of all plies at a point.
construct_single_ply_piece
([fraction])Construct a ply piece for shape A (trapezium)
corner_orientations
()Get the fiber orientations at all corners of the useful area, which is the area between radii s2 and s3.
edge_lengths
()Get the lengths of the edges of the (base) ply piece.
effective_area
([ply_piece, max_angle_dev])Get the effective area of a single ply piece.
local_num_pieces
(eta, zeta)Determine the local number of overlapping pieces at a given point.
local_orientation
(eta, zeta)Determine the local fiber orientation at a given point.
num_pieces
()Determine the total number of pieces needed to fully cover the cone.
ply_piece_area
()Get the area of a single ply piece that is on the free cone area, i.e.
ratio_continuous_fibers
()Get the ratio of continuous fibers, i.e.
rebuild
()Rebuild the model, actually constructing all ply pieces
CPPOT GUI (desicos.cppot.gui
)¶
All the functionalities of the Graphic User Interface will be started by
clicking on the Click_me.pyw
file.