Esempio n. 1
0
    def __init__(self):
        super(HyperloopSim, self).__init__()

        # --------------------------------------------------------------------------- #
        #   Freestream Component
        # --------------------------------------------------------------------------- #
        self.add('freestream', Freestream())

        # --------------------------------------------------------------------------- #
        #    Inlet Design Component
        # --------------------------------------------------------------------------- #
        #self.add('supin', SUPIN())

        # --------------------------------------------------------------------------- #
        #    Thermo Cycle Component
        # --------------------------------------------------------------------------- #
        self.add('cycle', CycleWrap())  # NPSS
        #self.add('cycle', CompressionCycle()) # Pycycle

        # --------------------------------------------------------------------------- #
        #    Geometry Component
        # --------------------------------------------------------------------------- #
        #self.add('geometry', ESP()) # Engineering Sketch Pad (uses .csm files)
        #self.add('geometry', SolidWorks()) # Solidworks

        # --------------------------------------------------------------------------- #
        #    Pointwise Mesher Component
        # --------------------------------------------------------------------------- #
        self.add('pointwise', Pointwise())

        # --------------------------------------------------------------------------- #
        #    AFLR3 Mesher Component
        # --------------------------------------------------------------------------- #
        self.add('aflr3', AFLR3())

        # --------------------------------------------------------------------------- #
        #    Fun3D CFD Component
        # --------------------------------------------------------------------------- #
        #self.add('fun3d', Fun3D())

        # --------------------------------------------------------------------------- #
        #    Liner Induction Motor Component
        # --------------------------------------------------------------------------- #
        #self.add('lim', LIM())

        # --------------------------------------------------------------------------- #
        #    Cost Component
        # --------------------------------------------------------------------------- #
        self.add('cost', TubeCost())  # Tom Gregory Model

        # --------------------------------------------------------------------------- #
        #    Mission Workflow
        # --------------------------------------------------------------------------- #
        # Rob Faulk

        # --------------------------------------------------------------------------- #
        #    Power Component
        # --------------------------------------------------------------------------- #
        self.add('battery', Battery())
        # add more here for vacuum, lim

        # --------------------------------------------------------------------------- #
        #    Tube Structure Component
        # --------------------------------------------------------------------------- #
        self.add('struct', TubeStructural())

        # --------------------------------------------------------------------------- #
        #    Vacuum Component
        # --------------------------------------------------------------------------- #
        self.add('vacuum', Vacuum())

        # --------------------------------------------------------------------------- #
        #    Tube Thermal Component
        # --------------------------------------------------------------------------- #
        self.add('thermal', TubeWallTemp())

        # --------------------------------------------------------------------------- #
        #   Create Main Group Workflow
        # --------------------------------------------------------------------------- #
        #   Add component instances to top-level Group
        self.set_order(['freestream', 'cycle',  \
             'pointwise', 'aflr3',  'cost', 'battery', 'struct', \
              'vacuum', 'thermal']) # 'supin', geometry', 'fun3d',
Esempio n. 2
0
    def add_isttok(self, pixel_samples=1000000):
        nickel_roughness = 0.23
        min_wl = 50
        max_wl = 51

        # add vessel and cameras
        self.vessel = import_stl(
            "../isttok_3d/vessel5_stl.stl",
            scaling=1,
            mode='binary',
            parent=self.world,
            material=RoughNickel(nickel_roughness),  #AbsorbingSurface(),
            transform=translate(0, 0, 0) * rotate(0, 0, 0))

        self.camera_top = import_stl(
            "../isttok_3d/camera_top3_stl.stl",
            scaling=1,
            mode='binary',
            parent=self.world,
            material=AbsorbingSurface(),
            transform=translate(
                self.x_shift_top, self.y_shift_top + self.tube_height +
                self.lid_top, self.vessel_width / 2.0) * rotate(0, -90, 0))

        # self.camera_outer = import_stl("../isttok_3d/camera_outer3_stl.stl", scaling=1, mode='binary', parent=self.world,
        #                                material=AbsorbingSurface(),
        #                                transform=translate(self.x_shift_outer - self.tube_height - self.lid_outer,
        #                                                    0.0,
        #                                                    self.vessel_width / 2.0) * rotate(-90, 0, 0))

        self.camera_outer = import_stl(
            "../isttok_3d/camera_outer4_newpin_stl.stl",
            scaling=1,
            mode='binary',
            parent=self.world,
            material=AbsorbingSurface(),
            transform=translate(
                self.x_shift_outer - self.tube_height - self.lid_outer, 0.0,
                self.vessel_width / 2.0) * rotate(-90, 0, 0))

        pinhole_sphere_radius = 0.0005  # 0.0005
        self.top_pinhole = Sphere(radius=pinhole_sphere_radius,
                                  parent=self.world,
                                  transform=translate(self.x_shift_top,
                                                      self.y_shift_top,
                                                      self.vessel_width / 2),
                                  material=Vacuum())
        pinhole_sphere_radius = 0.00035  # 0.0005
        self.out_pinhole = Sphere(radius=pinhole_sphere_radius,
                                  parent=self.world,
                                  transform=translate(self.x_shift_outer, 0.0,
                                                      self.vessel_width / 2),
                                  material=Vacuum())

        for i in range(16):
            self.top_power.append(PowerPipeline0D(accumulate=False))
            self.out_power.append(PowerPipeline0D(accumulate=False))

            top_px_x = self.top_px_first_x - i * 0.00095
            top_px_y = self.top_px_first_y - i * 2 * (self.top_twist / 15)
            top_angle = degrees(asin(2 * self.top_twist / 0.01425))

            out_px_y = self.out_px_first_y - i * 0.00095
            out_px_x = self.out_px_first_x - i * 2 * (self.out_twist / 15)
            out_angle = -degrees(asin(2 * self.out_twist / 0.01425))

            self.top_px.append(
                TargettedPixel(
                    targets=[self.top_pinhole],
                    targetted_path_prob=1.0,
                    pipelines=[self.top_power[i]],
                    x_width=0.00075,
                    y_width=0.00405,
                    min_wavelength=min_wl,
                    max_wavelength=max_wl,
                    spectral_bins=1,
                    pixel_samples=pixel_samples,
                    parent=self.world,
                    quiet=True,
                    ray_importance_sampling=True,
                    ray_important_path_weight=0.05,
                    ray_max_depth=50,
                    transform=translate(top_px_x, top_px_y, self.top_px_z) *
                    rotate(0, 0, top_angle) * rotate(0, -90, 0)))

            self.out_px.append(
                TargettedPixel(
                    targets=[self.out_pinhole],
                    targetted_path_prob=1.0,
                    pipelines=[self.out_power[i]],
                    x_width=0.00075,
                    y_width=0.00405,
                    min_wavelength=min_wl,
                    max_wavelength=max_wl,
                    spectral_bins=1,
                    pixel_samples=pixel_samples,
                    parent=self.world,
                    quiet=True,
                    ray_importance_sampling=True,
                    ray_important_path_weight=0.05,
                    ray_max_depth=50,
                    transform=translate(out_px_x, out_px_y, self.out_px_z) *
                    rotate(0, 0, out_angle) * rotate(-90, 0, 90)))
Esempio n. 3
0
"""Main module that runs continously to monitor
assorted sensors"""

import time
import json
import graphyte
from pressure import Pressure
from vacuum import Vacuum
from dust import Dust
from temperature import Temperature
from relative_humidity import RelativeHumidity

T = Temperature()
P = Pressure()
V = Vacuum()
D = Dust()
RH = RelativeHumidity()

with open('sensorConfig.json') as json_file:
    FILE_DATA = json.load(json_file)

graphyte.init(FILE_DATA["ip address"]
              )  # initializes Grafana to send data to this ip address

RUN = True

while RUN:

    VACUUM_DATA = V.vacuum()
    PRESSURE_DATA = P.pressure()
    DUST_DATA = D.dust()