31-10-2014, 04:44 PM
31-10-2014, 06:45 PM
بارك الله فيكم وجزاكم الله كل خير
04-11-2014, 06:03 PM
من كناب Jean-Meeus Astronomical Algorithms
![[صورة: IauNPX.png]](http://img661.imageshack.us/img661/2724/IauNPX.png)
PHP كود :
procedure TForm2.FormCreate(Sender: TObject);
var SpringEquinox,WinterSolstice,AutumnEquinox,SummerSolstice:Real;
y:Real;
begin
Memo1.Clear;
y:= (2014-2000)/1000;
SpringEquinox :=2451623.80984 + 365242.37404 * y + 0.05169 * Power(y, 2) - 0.00411 * Power(y, 3) - 0.00075 * Power(y, 4);
SummerSolstice :=2451716.56767 + 365241.62603 * Y + 0.00325 * Power(y, 2) + 0.00888 * Power(y, 3) - 0.00030 * Power(y, 4);
AutumnEquinox := 2451810.21715 + 365242.01767 * Y - 0.11575 * Power(y, 2) + 0.00337 * Power(y, 3) + 0.00078 * Power(y, 4);
WinterSolstice := 2451900.05952 + 365242.74049 * Y - 0.06223 * Power(y, 2) - 0.00823 * Power(y, 3) + 0.00032 * Power(y, 4);
Memo1.Lines.Add('الربيع '+DateTimeToStr(JulianDateToDateTime(SpringEquinox))) ;
Memo1.Lines.Add('الصيف '+DateTimeToStr(JulianDateToDateTime(SummerSolstice))) ;
Memo1.Lines.Add('الخريف '+DateTimeToStr(JulianDateToDateTime(AutumnEquinox))) ;
Memo1.Lines.Add('الشتاء '+DateTimeToStr(JulianDateToDateTime(WinterSolstice))) ;
end;
![[صورة: IauNPX.png]](http://img661.imageshack.us/img661/2724/IauNPX.png)
05-11-2014, 10:42 AM
تم اضافة فصول السنة
![[صورة: 1KoE92.png]](http://img903.imageshack.us/img903/497/1KoE92.png)
![[صورة: 1KoE92.png]](http://img903.imageshack.us/img903/497/1KoE92.png)
23-11-2014, 08:05 PM
بالنسبة لثلث الأخير من الليل.
العينة مدينة وهران اليوم هو 23 نوفمبر 2014.
الثلث الأخير من الليل حسب البرنامج هو: 2:24
المغرب : 17:53
الفجر : 06:17
الفرق هو: 12 ساعة و24 دقيقة
الثلث الأخير= المغرب + ((12/3)*2) + ((24/3)*2)
= 17+8 سا و 53+16 د
= 2 سا و9 د
أي الثلث الأخير من الليل هو: 2:09
العينة مدينة وهران اليوم هو 23 نوفمبر 2014.
الثلث الأخير من الليل حسب البرنامج هو: 2:24
المغرب : 17:53
الفجر : 06:17
الفرق هو: 12 ساعة و24 دقيقة
الثلث الأخير= المغرب + ((12/3)*2) + ((24/3)*2)
= 17+8 سا و 53+16 د
= 2 سا و9 د
أي الثلث الأخير من الليل هو: 2:09
24-11-2014, 06:30 AM
بن دهيبة كتب :بالنسبة لثلث الأخير من الليل.السلام عليكم
أي الثلث الأخير من الليل هو: 2:09
اولا الفرق 11 ساعة و 36 دقيقة
وطريقة الحساب
الثلث الاخير = الفجر - ((المغرب-الفجر)/3)
24-11-2014, 06:18 PM
وعليكم السلام ورحمة الله تعالى وبركاته.
الفرق هو: 12 ساعة و24 دقيقة
جرب الكود :
أو : الثلث الاخير = المغرب+( ((المغرب-الفجر)/3) *2)
إقتباس :اولا الفرق 11 ساعة و 36 دقيقة
الفرق هو: 12 ساعة و24 دقيقة
جرب الكود :
كود :
procedure TForm1.Button1Click(Sender: TObject);
var
Date1, Date2, DateD : TDateTime;
HH, MM, SS, MS ,dd: Word;
begin
Date1 := StrToDateTime('23/11/2014 17:53:00');
Date2 := StrToDateTime('24/11/2014 06:17:00');;
DateD := Date2 - Date1;
DecodeTime(DateD , HH, MM, SS, MS);
dd:=DaysBetween(Date1, Date2);
if dd >= 1 then HH := HH + dd*24;
Showmessage('الفرق بين التاريخين هو : ' + inttostr(HH) + 'ساعة ' + inttostr(MM) +
' دقيقة'+ inttostr(SS) +' ثانية '+ inttostr(MS)+' جزئ من الألف ');
end;إقتباس :وطريقة الحساب
الثلث الاخير = الفجر - ((المغرب-الفجر)/3)
أو : الثلث الاخير = المغرب+( ((المغرب-الفجر)/3) *2)
24-11-2014, 07:21 PM
بن دهيبة كتب :وعليكم السلام ورحمة الله تعالى وبركاته.نعم انت محق ستكون التحديثات في الاصدار 4.0
الفرق هو: 12 ساعة و24 دقيقة
جرب الكود :
أو : الثلث الاخير = المغرب+( ((المغرب-الفجر)/3) *2)كود :procedure TForm1.Button1Click(Sender: TObject); var Date1, Date2, DateD : TDateTime; HH, MM, SS, MS ,dd: Word; begin Date1 := StrToDateTime('23/11/2014 17:53:00'); Date2 := StrToDateTime('24/11/2014 06:17:00');; DateD := Date2 - Date1; DecodeTime(DateD , HH, MM, SS, MS); dd:=DaysBetween(Date1, Date2); if dd >= 1 then HH := HH + dd*24; Showmessage('الفرق بين التاريخين هو : ' + inttostr(HH) + 'ساعة ' + inttostr(MM) + ' دقيقة'+ inttostr(SS) +' ثانية '+ inttostr(MS)+' جزئ من الألف '); end;
PHP كود :
Result.ThlthAkhir:= Result.Fajr-(24-Result.Maghrib + Result.Fajr)/3;
22-03-2015, 04:24 PM
تصحيح جديد
PHP كود :
unit MuslimPrayerTimes;
{
Author: onexite
Date: 22/03/2015
Description: Prayer Times Calculator (ver 3.3)
Filename: MuslimPrayerTimes.pas
Purpose: The five Islamic prayers are named Fajr, Zuhr, Asr, Maghrib and Isha. The timing of these five prayers varies from place to place and from day to day. It is obligatory for Muslims to perform these prayers at the correct time.
}
interface
uses
SysUtils,System.Math,System.DateUtils;
type
stTimes=Array[0..4] of TDateTime;
//********************
PTime = record
Time:TDateTime;
SstringTime: string;
Position: Byte ;
name:string;
Alert:Boolean;
end;
//********************
PrayTime = record
Fajr, Sunrise, Dhuhr, Asr, Maghrib, Isha, Sunset,Midnight, Imsak,ThlthAkhir,Doha :TDateTime;
end;
const Version : string ='3.3.0.0';
//********************// Functions //********************
function getQibla (latitude,longitude:Extended):Extended;
function CalcPray(Lon, Lat, Zone,_Elevation,DefaultElev:Real; PrayDate:TDateTime; CalcWay:Byte;MaghribAdd:SmallInt;school:string;view:Byte;_StatusElevation:Boolean=False;_Summer:Boolean=False;isRamadan:Boolean=False): PrayTime;
implementation
procedure modulo(var deg: Extended;const base:integer );
begin
if deg > 0 then deg:= deg - base * trunc(deg / base) else deg:= deg - base*(trunc(deg/base)-1);
end;
//==========================================================================
function getQibla (latitude,longitude:Extended):Extended;
const K_latitude = 21.423333; K_longitude = 39.823333;
begin
Result := RadToDeg( ArcTan(sin(DegToRad(K_longitude - longitude)) /((cos(DegToRad(latitude)) * tan(DegToRad(K_latitude))) -(sin(DegToRad(latitude))* cos(DegToRad(K_longitude - longitude))))) );
if (latitude > 21.423333) then
Result :=Result+ 180;
end;
//==========================================================================
function CalcPray(Lon, Lat, Zone,_Elevation,DefaultElev:Real; PrayDate:TDateTime; CalcWay:Byte;MaghribAdd:SmallInt;school:string;view:Byte;_StatusElevation:Boolean=False;_Summer:Boolean=False;isRamadan:Boolean=False): PrayTime;
var Smr :0..1;
d,tmp,g,q,l,r,ra,e,eqt,alpha,n,_d,MaghribSunni,MaghribShia,MidnightSunni,MidnightShia:Extended;
CalcWayFajr, CalcWayIsha: Real;
function TimeZone_Longitude(long:Real):SmallInt;
begin
if (Frac(long/15)=0) or (long<0) then //
Result:=Trunc(long/15) else Result:=Trunc(long/15) +1
// if long>0 then
// else
// Result:=Trunc(long/15) -1
end;
Begin
{
* Setting rest of Salat calculation configuration
*
* Convention Fajr Angle Isha Angle
*
* Muslim World League -18 -17
*
* Islamic Society of North America (ISNA) -15 -15
*
* Egyptian General Authority of Survey -19.5 -17.5
*
* Umm al-Qura University, Makkah -18.5
* Isha 90 min after Maghrib, 120 min during Ramadan
*
* University of Islamic Sciences, Karachi -18 -18
*
* Institute of Geophysics, University of Tehran -17.7 -14(*)
*
* Shia Ithna Ashari, Leva Research Institute, Qum -16 -14
*
* (*) Isha angle is not explicitly defined in Tehran method
* Fajr Angle = fajrArc, Isha Angle = ishaArc
*
* - حزب العلماء في لندن لدول
* أوروبا في خطوط عرض تزيد على 48
*
* ishaArc = -17
* fajrArc = -17
*
* @param string school [Shafi|Hanafi] to define Muslims Salat
* calculation method (affect Asr time)
* @param decimal sunriseArc Sun rise arc (default value is -0.833333)
* @param decimal ishaArc Isha arc (default value is -17.5)
* @param decimal fajrArc Fajr arc (default value is -19.5)
* @param string view [Sunni|Shia] to define Muslims Salat calculation
* method (affect Maghrib and Midnight time)
}
Smr:=0; if _Summer then Smr:=1;
CalcWayFajr:=-19.5;
CalcWayIsha:=-17.5;
Case CalcWay Of
0: Begin CalcWayFajr:=-18; CalcWayIsha:=-18 End;
1: Begin CalcWayFajr:=-15; CalcWayIsha:=-15 End;
2: Begin CalcWayFajr:=-18; CalcWayIsha:=-17 End;
3: Begin CalcWayFajr:=-18.5;CalcWayIsha:=0 End;
4: Begin CalcWayFajr:=-19.5;CalcWayIsha:=-17.5 End;
5: Begin CalcWayFajr:=-17.7; CalcWayIsha:=-14 End;
6: Begin CalcWayFajr:=-16; CalcWayIsha:=-14 End;
End;
d := DateTimeToJulianDate(PrayDate) ; // jd is the given Julian date
// d := d - Lon / 360; // 15* 24
d := d - 2451545.0;
g := 357.529 + 0.98560028 * d;
modulo(g,360);
q := 280.459 + 0.98564736 * d;
modulo(q,360);
L := q + 1.915 * sin(DegToRad(g)) + 0.020 * sin(DegToRad(2 * g));
modulo(l,360);
R := 1.00014 - 0.01671 * cos(DegToRad(g)) - 0.00014 * cos(DegToRad(2 * g));
e := 23.439 - 0.00000036 * d;
RA := RadToDeg(ArcTan2(cos(DegToRad(e))* sin(DegToRad(L)), cos(DegToRad(L))))/ 15;
// if (RA < 0) then RA := 24 + RA;
modulo(RA,24);
// The declination of the Sun is the angle between the rays of the sun and
// the plane of the earth equator. The declination of the Sun changes
// continuously throughout the year. This is a consequence of the Earth's
// tilt, i.e. the difference in its rotational and revolutionary axes.
// declination of the Sun
_d := RadToDeg(ArcSin(sin(DegToRad(e))* sin(DegToRad(L))));
EqT := (q/15) - RA; // equation of time
tmp := 12 + zone - (lon/15) - EqT;
// if (Result.Dhuhr < 0) then Result.Dhuhr:= 24 + Result.Dhuhr;
modulo(tmp,24);
Result.Dhuhr:=tmp;
// Sunrise & Sunset
// If the observer's location is higher than the surrounding terrain, we
// can consider this elevation into consideration by increasing the above
// constant 0.833 by 0.0347 × sqrt(elevation), where elevation is the
// observer's height in meters
if _StatusElevation then
alpha := 0.833 + 0.0347 * sqrt(_Elevation) else
alpha := 0.833 + 0.0347 * sqrt(DefaultElev) ;//1.32373210614; // 0.8680333 ;
try
n := -1 * sin(DegToRad(alpha)) - sin(DegToRad(lat)) * sin(DegToRad(_d));
d := cos(DegToRad(lat)) * cos(DegToRad(_d));
except
n:=0;d:=0 ;
end;
Result.Sunrise := Result.Dhuhr - (1/15) * RadToDeg(ArcCos(n / d));
Result.Sunset := Result.Dhuhr + (1/15) * RadToDeg(ArcCos(n / d));
n := -1 * sin(DegToRad(abs(CalcWayfajr))) - sin(DegToRad(lat)) * sin(DegToRad(_d));
Result.Fajr := Result.Dhuhr - (1/15) * RadToDeg(ArcCos(n / d));
Result.Imsak := Result.Fajr - (10/60);
n := -1 * sin(DegToRad(abs(CalcWayIsha))) - sin(DegToRad(lat))* sin(DegToRad(_d));
Result.Isha := Result.Dhuhr + (1/15) * RadToDeg(ArcCos(n / d));
if (school = 'Shafi') then
n := sin(ArcTan(1/(1 + tan(DegToRad(lat - _d))))) - sin(DegToRad(lat)) * sin(DegToRad(_d))
else
n := sin(ArcTan(1/(2 + tan(DegToRad(lat - _d)))))- sin(DegToRad(lat)) * sin(DegToRad(_d));
Result.Asr := Result.Dhuhr + (1/15) * RadToDeg(ArcCos(n / d));
// Maghrib
// In the Sunni's point of view, the time for Maghrib prayer begins once
// the Sun has completely set beneath the horizon, that is, Maghrib = Sunset
// (some calculators suggest 1 to 3 minutes after Sunset for precaution)
MaghribSunni := Result.Sunset + MaghribAdd/60;
n := -1 * sin(DegToRad(4)) - sin(DegToRad(lat)) * sin(DegToRad(_d));
MaghribShia := Result.Dhuhr + (1/15) * RadToDeg(ArcCos(n / d));
{
Tehran: {
name: 'Institute of Geophysics, University of Tehran',
params: { fajr: 17.7, isha: 14, maghrib: 4.5, midnight: 'Jafari' // isha is not explicitly specified in this method
Jafari:
name: 'Shia Ithna-Ashari, Leva Institute, Qum',
params: { fajr: 16, isha: 14, maghrib: 4, midnight: 'Jafari'
if CalcWay=5 then
MaghribShia := MaghribShia+(4.5/60);
if CalcWay=6 then
MaghribShia := MaghribShia+(4/60);
if CalcWay=6 then
MaghribShia := MaghribShia+(4/60);
}
if (view = 0) then //'Sunni'
Result.Maghrib := MaghribSunni
else
Result.Maghrib := MaghribShia;
if CalcWay=3 then
if isRamadan then
Result.Isha := Result.Maghrib+2 else //120/60 =2
Result.Isha := Result.Maghrib+1.5; //90/60=1.5
//نصف الليل = مجموع الوقت من غروب الشمس إلى طلوع الفجر ÷ 2+وقت غروب الشمس والناتج هو منتصف الليل
MidnightSunni := Result.Sunset +(24- Result.Sunset+Result.Sunrise)/2;
MidnightShia := ( 24- Result.Sunset+ Result.Fajr)/2;
if (view = 0) then // 'Sunni'
Result.Midnight := MidnightSunni
else
Result.Midnight := MidnightShia;
Result.ThlthAkhir:= Result.Fajr-(24-Result.Maghrib + Result.Fajr)/3;
Result.Doha := Result.Sunrise+(15/60);
//********************************************
Result.Fajr:=(Frac((Result.Fajr+Smr)/24));
Result.Sunrise:=(Frac((Result.Sunrise+Smr)/24));
Result.Dhuhr:=(Frac((Result.Dhuhr+Smr)/24));
Result.Asr:=(Frac((Result.Asr+Smr)/24)) ;
Result.Maghrib:=(Frac((Result.Maghrib+Smr)/24));
Result.Isha:=(Frac((Result.Isha+Smr)/24)) ;
Result.Sunset:=(Frac((Result.Sunset+Smr)/24)) ;
Result.Midnight:=(Frac((Result.Midnight+Smr)/24));
Result.Imsak:=(Frac((Result.Imsak+Smr)/24));
Result.ThlthAkhir:=(Frac((Result.ThlthAkhir+Smr)/24));
Result.Doha:=(Frac((Result.Doha+Smr)/24));
//********************************************
End;
End.
22-03-2015, 05:28 PM
السلام عليكم
لي ملاحظات بسيطة ستزيد من مستواك البرمجي بإذن الله
في البداية حاول إختصار الكود عندما تستطيع فآخر كود وضعته يمكنك إخنتصار الكثير من الأكواد
نقطة آخرى وهي مراعة فلسفة باسكال
أول حرف كابتل من كل كلمة وكذلك الـ record المسمى PTime
عندما يراه مبرمج آخر سيضن انه Pointer للنوع Time وربما كذلك يتعارض مع متغيرات آخرى مستقبلاً
كونه اسم وارد إستعماله بكثرة .
نقطة آخرى اسماء الدوال ومعاملاتها معقدة
فكما اخبرتك حاول دائماً كتابة أكواد بسيطة .
نقطة آخرى ما رئيك لو جعلت الـ Resault لا ترجع Record كم هو الحال في الدوال المكتوبة في آخر مشاركة
وإنما تجعل الـ Resault يكون احد المعاملات من نوع var , بينما تجعل المرجعات في Resault من نوع
boolean يشير إلى نجاح الدالة من عدمه (عند الحاجه) .
إقتراح , لماذا لا تستعمل الـ OOP فهي الحل الأمثل لجعل البرنامج سهل الكتابة ووضاح وتجع الكود نضيف .
فمثلاً تضع كلاس خاص بالوقت والتعامل مع الوقت
وكلاس آخر مثلاً خاص بشهر رمضان مثلاً
وكلاس آخر يكون المسؤال عن القبلة
عندها سيسهل تطوير البرنامج وستقل الأخطاء وستكون البرمجة اكثر سهوله بعشرات المرات .
اتمنى أني افدتك , بالتوفيق
لي ملاحظات بسيطة ستزيد من مستواك البرمجي بإذن الله
في البداية حاول إختصار الكود عندما تستطيع فآخر كود وضعته يمكنك إخنتصار الكثير من الأكواد
نقطة آخرى وهي مراعة فلسفة باسكال
أول حرف كابتل من كل كلمة وكذلك الـ record المسمى PTime عندما يراه مبرمج آخر سيضن انه Pointer للنوع Time وربما كذلك يتعارض مع متغيرات آخرى مستقبلاً
كونه اسم وارد إستعماله بكثرة .
نقطة آخرى اسماء الدوال ومعاملاتها معقدة
فكما اخبرتك حاول دائماً كتابة أكواد بسيطة .نقطة آخرى ما رئيك لو جعلت الـ Resault لا ترجع Record كم هو الحال في الدوال المكتوبة في آخر مشاركة
وإنما تجعل الـ Resault يكون احد المعاملات من نوع var , بينما تجعل المرجعات في Resault من نوع
boolean يشير إلى نجاح الدالة من عدمه (عند الحاجه) .
إقتراح , لماذا لا تستعمل الـ OOP فهي الحل الأمثل لجعل البرنامج سهل الكتابة ووضاح وتجع الكود نضيف .
فمثلاً تضع كلاس خاص بالوقت والتعامل مع الوقت
وكلاس آخر مثلاً خاص بشهر رمضان مثلاً
وكلاس آخر يكون المسؤال عن القبلة
عندها سيسهل تطوير البرنامج وستقل الأخطاء وستكون البرمجة اكثر سهوله بعشرات المرات .
اتمنى أني افدتك , بالتوفيق