-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPower loss
48 lines (38 loc) · 1.49 KB
/
Power loss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 4 20:33:27 2023
@author: batman
"""
import numpy as np
import matplotlib.pyplot as plt
# Define atmospheric parameters
altitudes = np.linspace(0, 100000, 101) # Altitude range in meters, including 101 altitude layers
absorption_coeff = np.array([0.001, 0.002, 0.003, 0.005, 0.008, 0.01, 0.02, 0.05, 0.1, 0.2]) # Absorption coefficient at each altitude layer, including 10 coefficients
# Define laser parameters
wavelength = 1064e-9 # Laser wavelength in meters
beam_radius = 1e-3 # Laser beam radius in meters
power = 1 # Laser power in watts
# Define simulation parameters
num_steps = 10000 # Number of simulation steps
step_size = np.max(altitudes) / num_steps # Step size in meters
# Initialize variables
distance = 0
intensity = power / (np.pi * beam_radius ** 2)
# Simulate laser propagation
intensity_values = []
for i in range(num_steps):
# Calculate absorption coefficient at current altitude
altitude_index = int(distance / step_size)
absorption = absorption_coeff[altitude_index]
# Calculate distance and intensity at next step
distance += step_size
intensity *= np.exp(-absorption * step_size)
intensity_values.append(intensity)
# Calculate power loss
power_loss = (power - np.array(intensity_values) * np.pi * beam_radius ** 2) / power
# Plot power loss versus distance
plt.plot(np.linspace(0, distance, num_steps), power_loss)
plt.xlabel('Distance (m)')
plt.ylabel('Power loss')
plt.show()