Showing posts with label angle of incidence. Show all posts
Showing posts with label angle of incidence. Show all posts

Sunday, April 16, 2023

Python and Casio fx-4000P: Transmission and Deviation Angles - Prism

Python and Casio fx-4000P:   Transmission and Deviation Angles - Prism




Celebrating 12 Years in the Blogopshere!   Thank you to my readers, subscribers, and everyone who has stopped by during the years!  




Introduction


Today's program calculates the transmission and deviation angles passing through a prism.   The refractive index of the prism is determined by the material it is made of.   





Formulas Used for the transmission and deviation angles, respectively:


θt = arcsin( α * √(n^2 - sin^2 θi) - sin θi * cos α)


δ = θi + θt - α


The Python program calculates for prisms made of acrylic, glass, fluorite, and plastic.  



Python Script:  prism.py


Program Notes:


1.  The angle mode in Python is always radian angle mode. Conversions between degrees and radians are necessary on this code.


2.  This code was programmed with a Casio fx-9750GIII in the Python app.   I could have used the degrees and radians functions, however, they were not present in the calculator's catalog.  


3.  I used a While loop and initialized the choice variable k as -1 to prevent the user from choosing anything from picking outside the range 0-3.  This simulates the Menu command in Casio graphing calculator programming.


4. The refractive indices are average and approximate.  


5. To make everything fit on the screen, the new line escape character, \n, is used.  


Code:


from math import *

# radians mode

print("Enter in Degrees")

i=float(input("Incidence Angle? \n"))

a=float(input("Top Angle? \n"))


# convert to radians

ir=i*pi/180

ar=a*pi/180


# choice of material

# refractive index

ls=[1.4905,1.52,1.433,1.58]

k=-1

while k<0 or k>3:

  print("Select Material")

  print("0. Acrylic")

  print("1. Glass")

  print("2. Fluorite")

  print("3. Plastic")

  k=int(input())

n=ls[k]


# calculation

t=asin(sin(ar)*sqrt(n**2-sin(ir)**2)-sin(ir)*cos(ar))

d=ir+t-ar


# convert to degrees

td=t*180/pi

dd=d*180/pi


# results

print("Results are in Degrees")

print("Transmission Angle: \n"+str(td))

print("Deviation: \n"+str(dd))



Casio fx-4000P Program:  Prism


Notes:


1.  Variables used:

I = incidence angle

A = top angle of the prism

N = refractive index, must be entered manually


2.  Outputs:

Transmission Angle (T)

Deviation Angle (D)


Code:

(59 steps)


Deg :

"I": ?→ I:

"A": ?→A:

"N": ?→N:

sin⁻¹ ( sin A × √( N² - (sin I)²) - sin I × cos A) → T ◢

I + T - A → D



Examples


I = incidence angle

A = top angle of the prism

T = Transmission Angle

D = Deviation Angle



1.  I = 50°, A = 60°,  Glass (1.52)


T ≈  48.932708276°

D ≈ 38.932708276°


2.  I = 10°, A = 45°, Plastic (1.58)


T ≈ 80.99437617°

D ≈ 45.99437617°


3.  I = 33°, A = 25°,  Acrylic (1.4905)


T ≈ 5.32137979°

I ≈ 13.32137979°


4.  I = 17°, A = 40°, Fluorite (1.433)


T ≈ 42.66957975°

I ≈ 19.66957975°



Source


Woan, Graham.  The Cambridge Handbook of Physics Formulas  Cambridge University Press.  Cambridge, New York.  2003 edition



Here is to many more years, 


Eddie 


All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Thursday, March 19, 2015

HP Prime and Casio Prizm: Solar Irradiance

Solar Irradiance

The program IRRAD will calculate two properties:

(1)  The solar angle of incidence given the angular elevation and azimuth (from south going “counterclockwise”:  east-north-west) of both the sun and panel.
(2)  The irradiance given by the solar panel. 

Formulas

Angle of Incidence Given Azimuth

Degree mode is assumed, the angle of incidence (θ) is found in the following equation:

cos θ = cos(ep)*sin(es) + sin(ep)*cos(es)*cos(as-ap)

Where:
θ = angle of incidence
es = elevation of the sun
ep = elevation of the panel
as = azimuth of the sun, from south headed towards east, then north, then west

ap = azimuth of the panel, from south headed towards east, then north, then west

Angle of Incidence

Azimuth and Elevation of the Sun and Solar Panel
Calculating Flux Density of Solar Radiation on a Surface

Calculating the flux density (energy) of solar radiation on a surface, Lambert’s Cosine Law is used.  Lambert’s Cosine Law states that the relation between the irradiance of the sun and the angle of incidence. The result is the irradiance of the surface.  Irradiance is the rate of energy (power) over a unit area.  In SI units, irradiance is measured in Watts per square meter (W/m^2).

ls = lb * cos θ

Where:
lb = the sun’s power or irradiance.  Often this is treated as a constant, which is approximately 1367 W/m^2 for extraterrestrial solar power, or approximately 1000 W/m^2 when we are dealing with the Earth’s surface (taking scattering of light into account)
ls = the panel’s power or irradiance


Casio Prizm IRRAD

Deg
“SUN: ELEL, AZI(S)”
?->A:?->B
“PANEL: ELEV, AZI(S)”
?->C:?->D
“IRRADIANCE OF THE SUN”
“(W÷M²)”
cos C * sin A + cos A * sin C * cos(B-D)
cos¹ Ans -> θ
I * cos θ -> S
“INCIDENCE ANGLE”
θ
“IRRADIANCE OF SUN”
S

HP Prime IRRAD

EXPORT IRRAD()
BEGIN
LOCAL es,as,ep,ap,θinc;
LOCAL ib,is;
HAngle:=1;
INPUT({es,as},”Sun”,{“Elev.:”,”Azi (S):”});
INPUT({ep,ap},”Panel”,{“Elev.:”,”Azi (S):”});
INPUT(ib,”Sun’s Irradiance”,”I:”,”W/m^2”);
// angle of incidence
θinc:=ACOS(COS(ep)*SIN(es)+SIN(ep)*COS(es)*COS(as-ap));
MSGBOX(“Incidence Angle = “+θinc);
// Lambert’s Cosine Law
Is:=ib*COS(θinc);
MSGBOX(“Surface Irradiance = “+is);
RETURN {θinc,is};
END;

Example

Data:

Sun: 
Elevation:  55⁰24’21” ≈ 55.40583⁰
Azimuth:  175⁰15’44” ≈ 175.26222⁰

Panel:
Elevation:  40⁰
Azimuth:  90⁰ (panel is facing due east)

Irradiance of the Sun:  1000 W/m^2

Output:
Incidence Angle ≈ 48.643169⁰
Surface Radiance ≈ 660.746510 W/m^2


Sources:

Baldocchi, Dennis “Lecture 7, Solar Radiation, Part 3, Earth-Sun Geometry”  Biometeorogy, ESPM 129  University of California, Berkeley.
Retrieved February 17, 2015. 

Mortimer, David  “Lambert’s Cosine Law”  30 January 2014.  The Solar Bucket.
Retrieved March 18, 2015

University of Oregon Solar Radiation Monitoring Laboratory  “Solar Radiation Basics”  University of Oregon.  http://solardat.uoregon.edu/SolarRadiationBasics.html   Retrieved February 10, 2015



This blog is property of Edward Shore – 2015. 

HP 71B Basic and Casio fx-CG 100: Weighted Random Sample

HP 71B Basic and Casio fx-CG 100: Weighted Random Sample Introduction In calculators, it is fairly easy to generate a rand...