Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

creating TestMotionBasedCanting #172

Merged
16 changes: 16 additions & 0 deletions opencsp/common/lib/csp/Facet.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ def orthorectified_slope_array(self, x_vec: np.ndarray, y_vec: np.ndarray) -> np
slope_data = np.reshape(slope_data, (2, y_vec.size, x_vec.size)) # facet child
return slope_data # facet child

def get_2D_dimensions(self) -> tuple[float, float]:
"""Returns width and heightin facet's child coordinate
reference frame.

Returns
-------
tuple[float, float]
Width: following (+)x infinity in the (-) direction for x_max(right) - following (-x) infinity in the (+) direction for x_min(left).
Height: following (+)y infinity in the (-) direction for y_max(top) - following (-y) infinity in the (+) direction for y_min(bottom).
Facet's child coordinate reference frame.
"""
left, right, bottom, top = self.axis_aligned_bounding_box
width = right - left
height = top - bottom
return width, height

# override function from RayTraceable
def most_basic_ray_tracable_objects(self) -> list[RayTraceable]:
return self.mirror.most_basic_ray_tracable_objects()
Expand Down
2 changes: 2 additions & 0 deletions opencsp/common/lib/csp/HeliostatAbstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def set_canting_from_equation(self, func: FunctionXYContinuous) -> None:

self.facet_ensemble.set_facet_cantings(facet_canting_rotations)

return facet_canting_rotations

# RENDERING

def draw(self, view: View3d, heliostat_style: RenderControlHeliostat = None, transform: TransformXYZ = None):
Expand Down
49 changes: 36 additions & 13 deletions opencsp/common/lib/csp/Tower.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class Tower(RayTraceable):
parts : list[str]
The parts that build the Tower. Includes walls (top, northface, southface, bottom), and optionl target.
height : float
The height of Tower. Currently set for NSTTF Tower height of 61 m.
The height of Tower. Currently set for NSTTF Tower height of 63.5508 m.
east : float
The East wall of the Tower. Currently set for 8.8 m. TODO, MHH find dimensions of tower (in particular width)
The East wall of the Tower. Currently set for 5.485 m. TODO, MHH find dimensions of tower (in particular width)
west : float
The West wall of the Tower. Currently set for 8.8 m.
The West wall of the Tower. Currently set for 5.485 m.
south : float
The South wall of the Tower. Currently set for 8.8 m.
The South wall of the Tower. Currently set for 9.1168 m.
north : float
The North wall of the Tower. Currently set for 8.8 m.
The North wall of the Tower. Currently set for 6.25 m.
x_aim : float
The x component of the target in relation to the Tower origin.
y_aim : float
Expand All @@ -52,14 +52,16 @@ def __init__(
name: str,
origin: Pxyz,
parts: list[str] = ["whole tower"],
height: float = 100,
east: float = 8.8,
west: float = -8.8,
south: float = -8.8,
north: float = 8.8,
height: float = 63.5508,
east: float = 5.485,
west: float = -5.485,
south: float = -9.1186,
north: float = 6.25,
x_aim: float = 0,
y_aim: float = 8.8,
z_aim: float = 100,
y_aim: float = 6.25,
z_aim: float = 63.5508,
bcs_y_aim: float = 8.8,
bcs_z_aim: float = 28.9,
):

# parameters used for control tower at NSTTF
Expand All @@ -69,7 +71,21 @@ def __init__(
# east = 8.8,
# west = -8.8,
# south = 284,
# north = 300)
# north = 300
# x_aim: float = 0,
# y_aim: float = 6.25,
# z_aim: float = 63.5508,)
# SOFAST_calculations:
# height: float = 63.5508,
# east: float = 5.485,
# west: float = -5.485,
# south: float = -9.1186,
# north: float = 6.25,
# x_aim: float = 0,
# y_aim: float = 6.25,
# z_aim: float = 64.8008,
# bcs_y_aim: float = 8.8,
# bcs_z_aim: float = 28.9,
"""Create a new Tower instance.

Parameters:
Expand All @@ -92,7 +108,10 @@ def __init__(
self.x_aim = x_aim
self.y_aim = y_aim
self.z_aim = z_aim
self.bcs_y_aim = bcs_y_aim
self.bcs_z_aim = bcs_z_aim
self.target_loc = Pxyz([x_aim, y_aim, z_aim])
self.bcs = Pxyz([x_aim, bcs_y_aim, bcs_z_aim])

# Tower faces, top, and bottom
self.top = [
Expand Down Expand Up @@ -135,6 +154,7 @@ def __init__(
"""
The target location given the x, y, and z components.
"""
self.bcs_point = [self.x_aim, self.bcs_y_aim, self.bcs_z_aim]

def walls(self):
"""Returns the list of walls as top, north, south, and bottom."""
Expand Down Expand Up @@ -173,4 +193,7 @@ def draw(self, view: View3d, tower_style: RenderControlTower) -> None:
if "target" in self.parts:
view.draw_xyz(self.point, style=tower_style.target)

if "bcs" in self.parts:
view.draw_xyz(self.bcs_point, style=tower_style.bcs)

return
10 changes: 10 additions & 0 deletions opencsp/common/lib/render_control/RenderControlFacet.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ def outline(color='k'):
)


def outline_thin(color='k', linewidth=0.5):
return RenderControlFacet(
draw_centroid=False,
draw_outline=True,
outline_style=rcps.outline(color=color, linewidth=linewidth),
draw_surface_normal=False,
draw_name=False,
)


def outline_name(color='k'):
return RenderControlFacet(
draw_centroid=False,
Expand Down
11 changes: 11 additions & 0 deletions opencsp/common/lib/render_control/RenderControlFacetEnsemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ def facet_outlines(color='k', **kwargs):
)


def facet_outlines_thin(color='k', linewidth=0.25, **kwargs):
return RenderControlFacetEnsemble(
draw_normal_vector=False,
default_style=rcf.outline_thin(color=color, linewidth=linewidth),
normal_vector_style=rcps.outline(color=color),
normal_vector_base_style=rcps.marker(color=color),
draw_centroid=False,
**kwargs
)


def facet_ensemble_outline(color='k', normal_vector_length=4.0, **kwargs):
return RenderControlFacetEnsemble(
draw_normal_vector=True,
Expand Down
9 changes: 9 additions & 0 deletions opencsp/common/lib/render_control/RenderControlTower.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(
point_styles: RenderControlPointSeq = None,
wire_frame: RenderControlPointSeq = None,
target: RenderControlPointSeq = None,
bcs: RenderControlPointSeq = None,
) -> None:
"""
Controls for rendering a tower.
Expand Down Expand Up @@ -48,6 +49,8 @@ def __init__(
wire_frame = rcps.outline()
if target is None:
target = rcps.marker(marker='x', color='r', markersize=6)
if bcs is None:
bcs = rcps.marker(marker='+', color='b', markersize=6)

super(RenderControlTower, self).__init__()

Expand All @@ -58,6 +61,7 @@ def __init__(
self.point_styles = point_styles
self.wire_frame = wire_frame
self.target = target
self.bcs = bcs

def style(self, any):
""" "style" is a method commonly used by RenderControlEnsemble.
Expand All @@ -75,3 +79,8 @@ def normal_tower():
def no_target():
# tower outline with no target.
return RenderControlTower(wire_frame=rcps.outline(color='g'), target=False)


def no_bcs():
# tower outline with not bcs.
return RenderControlTower(wire_frame=rcps.outline(color='g'), bcs=False)
Loading
Loading