Exemplo n.º 1
0
def main():
    if loadcase is Cases.FAT:
        Wind_mult = wind_multipliers.Wind_multipliers(render_hc)
        Wind = wind.Wind(Wind_mult, loadcase)
        Geom = geometry.Geometry(Wind)
        Geom.st_geom_picker()
        if Geom.structure_type is Structure_type.RHS:
            #TODO - Add API calls
            st.warning("Not yet implemented, try selecting SIGNS")
            pass
        if Geom.structure_type is Structure_type.CHS:
            Geom.calc_drag_CHS_AASHTO()
            Geom.calc_wind_pressure_sign_fat()
        if Geom.structure_type is Structure_type.SIGN:
            Geom.calc_drag_sign_AASHTO()
            Geom.calc_wind_pressure_sign_fat()
        #plot_sign = Geom.st_plot_wind_pressure()
        #st.bokeh_chart(plot_sign,False)
    else:
        Wind_mult = wind_multipliers.Wind_multipliers(render_hc)
        Wind_mult.st_region_inputs()
        Wind_mult.st_terrain_inputs()
        Wind_mult.terrain_multiplier()
        Wind_mult.st_wind_multipliers_input()
        Wind_mult.st_wind_direction_inputs()
        Wind_mult.calc_wind_direction_multiplier()
        Wind_mult.render_multipliers()

        Wind = wind.Wind(Wind_mult, loadcase)
        Wind.st_wind_speed_inputs()
        Wind.calc_regional_wind_speed()
        Wind.st_display_regional_wind_speed()
        Wind.calc_site_wind_speed()

        Geom = geometry.Geometry(Wind)
        Geom.st_geom_picker()
        if Geom.structure_type is Structure_type.RHS:
            Geom.calc_drag_RHS_AS1170()
            Geom.calc_wind_pressure_RHS()
            plot_RHS = Geom.st_RHS_plotting()
            st.bokeh_chart(plot_RHS, False)
        elif Geom.structure_type is Structure_type.CHS:
            Geom.calc_drag_CHS_AS1170()
            if Geom.frame_type is Frame.NONE:
                Geom.calc_wind_pressure_CHS()
            else:
                Geom.calc_drag_frame_CHS_AS1170()
                Geom.calc_wind_pressure_CHS()
        elif Geom.structure_type is Structure_type.SIGN:
            Geom.calc_drag_sign_AS1170()
            Geom.calc_solidity_factor()
            Geom.calc_wind_pressure_sign()
            plot_sign = Geom.st_plot_wind_pressure()
            st.bokeh_chart(plot_sign, False)
Exemplo n.º 2
0
def process(flight_plan, wind_vectors, cost_func, barycentric=False):
    fig, plots = plt.subplots(ncols=2, figsize=(12, 6))

    wind = wind_utils.Wind(wind_vectors, barycentric=barycentric)

    plot_scene(plots[0], flight_plan, wind, margin=2)
    plot_cost(plots[1], flight_plan, wind, cost_func)
Exemplo n.º 3
0
    def start(self):
        self.hud = loading.Loading(my.ENGINE.screen)

        self.map = map.Map(self.width, self.height, self.seed)
        self.map.generate()

        self.hud.setStatus('Carregando entidades...', 80)
        spawnX = randint(50, self.width - 50)
        self.player = entities.Player(self, self.playerConfigurations[0],
                                      tank.TankDefault(),
                                      (spawnX, self.map.getMaxHeight(spawnX)))
        self.entities = camera.CameraAwareLayeredUpdates(
            self.player, pygame.Rect(0, 0, self.width, self.height))
        self.entities.add(
            self.map
        )  # Adicionando o mapa em entidades para poder ser scrollado
        for i in range(0, self.enemiesCount):
            x = randint(50, self.width - 50)
            self.entities.add(
                entities.Enemy(self, tank.TankDefault(),
                               (x, self.map.getMaxHeight(x))))

        self.hud.setStatus('Carregando interface...', 99)
        self.hud = hud.Hud(self, my.ENGINE.screen)
        my.ENGINE.interface = self.hud
        self.turncontroller = turn.TurnController(self)
        self.turncontroller.start()

        self.wind = wind.Wind(self)

        self.running = True
Exemplo n.º 4
0
def test_regional_wind_speed_50_ARI_multiple_regions(Wind_mult, region, ARI,
                                                     Vr):
    Wind_mult.region = region
    Wind_new = wind.Wind(render_hc=False, Wind_mult=Wind_mult, loadcase='test')
    Wind_new.ARI = ARI
    Wind_new.calc_regional_wind_speed()
    assert Wind_new.Vr == pytest.approx(Vr)


# @pytest.mark.parametrize()
# def test_site_wind_speed_against_
Exemplo n.º 5
0
    def __init__(self, swells, winds):
        self.swell_winds = []
        self.merge(swells, winds)

    def get(self, start=0, end=3600 * 24 * 365 * 100000):
        result = []
        for swell_wind in self.swell_winds:
            if swell_wind[0] >= start and swell_wind[0] < end:
                result.append(swell_wind)
        return result

    def print(self, start=0, end=3600 * 24 * 365 * 100000):
        results = self.get(start, end)
        print("<----    Swell    ----> | <---- Wind ---->")
        for result in results:
            ts = time.gmtime(result[0])
            print("{}: {:2.1f}m, {:4.1f}s, {:3s} | {:4.1f}km/h, {}".format(
                time.strftime("%H:%M", ts), float(result[1]), float(result[3]),
                result[2], float(result[4]), result[5]))


if __name__ == "__main__":
    swelli = swell.Swell(
        r"https://swell.willyweather.com.au/nsw/sydney/south-head.html")
    windi = wind.Wind(
        r"https://wind.willyweather.com.au/nsw/sydney/south-head.html")

    swell_wind = SwellWind(swelli.get(), windi.get())
    swell_wind.print()
Exemplo n.º 6
0
                     region[1],
                     color=colors[i % len(colors)],
                     alpha=0.25)
        plot.text(region[0],
                  0.5,
                  region[2],
                  transform=trans,
                  verticalalignment='center',
                  rotation=90,
                  color=colors[i % len(colors)])


if not 'wind_dir' in data['air'][0] or args.wind_time:
    # run a quick wind estimate
    import wind
    w = wind.Wind()
    winds = w.estimate(data, args.wind_time)
    df1_wind = pd.DataFrame(winds)
    time = df1_wind['time']
    wind_dir = df1_wind['wind_deg']
    wind_speed = df1_wind['wind_kt']
    pitot_scale = df1_wind['pitot_scale']
else:
    time = df0_air['time']
    wind_dir = df0_air['wind_dir']
    wind_speed = df0_air['wind_speed']
    pitot_scale = df0_air['pitot_scale']

wind_fig, (ax0, ax1) = plt.subplots(2, 1, sharex=True)
ax0.set_title("Winds Aloft")
ax0.set_ylabel("Heading (degrees)", weight='bold')
Exemplo n.º 7
0
cdimport time
import solarcalc
import relays
import calibration
import wind

#minimalni posun
THRESHOLD=5

#instance ostanich trid
solar_calc=solarcalc.SolarCalc()
relays = relays.Relays()
calibration = calibration.Calibration()
wind=wind.Wind()

#kalibrace
print("calibrace azimutu")
one_degree_right=calibration.azimuth()
print("calibrace elevace")
one_degree_up=calibration.elevation()
    
print("stupen do prava ", one_degree_right)
print("stupen nahoru ", one_degree_up)

#hlavni cyklus
while True:
    
    #hlidani vetru
    while True:
        is_strong_wind=wind.is_wind()
        if (is_strong_wind==False):
Exemplo n.º 8
0
        sun.print(start_secs, start_secs + 3600*24)
    if rain != None:
        rain.print(start_secs, start_secs + 3600*24)
    if moon != None:
        moon.print(start_secs, start_secs + 3600*24)
    if seatemp != None:
        seatemp.print(start_secs, start_secs + 3600*24)
    if tide != None:
        tide.print(start_secs, start_secs + 3600*24)
    if swell_wind != None:
        swell_wind.print(start_secs, start_secs + 3600*24)
    print("")

location = "sydney"
locations = ["sydney", "newcastle", "wollongong", "frazer_beach", "boat_harbour"]
if len(sys.argv) >= 1 and sys.argv[1] in locations:
    location = sys.argv[1]

suni = sun.Sun(willy_uri_get("sun", location))
raini = rain.Rain(willy_uri_get("rain", location))
mooni = moon.Moon(willy_uri_get("moon", location))
seatempi = seatempnet.Seatempnet(seatemp_page[location])
tidei = tide.Tide(willy_uri_get("tide", location))
swelli = swell.Swell(willy_uri_get("swell", location))
windi = wind.Wind(willy_uri_get("wind", location))
swell_windi = swell_wind.SwellWind(swelli.get(), windi.get())

for i in range(0, 7):
    secs = now + 3600 * 24 * i
    print_a_day(secs, suni, raini, mooni, seatempi, tidei, swell_windi)