keil3汉字光标位置不正确

keil3相比keil2,还是有些地方好用很多了。不过默认安装后,发现中文下光标的位置不正确。

解决方法是:

编辑-配置-字体

修改字体为fixesys。

这样就没问题了。

发表在 待分类 | keil3汉字光标位置不正确已关闭评论

基本乘法电路

LM358做乘法运算的基本电路:

直流放大电路

发表在 待分类 | 基本乘法电路已关闭评论

西门子选型工具

https://mall.industry.siemens.com/spice/TSTWeb/#/Start/

在线做组态,功能强大。

西门子——博大精深!

发表在 待分类 | 西门子选型工具已关闭评论

购买了VPS

用PP买了vultr的VPS,一个月5美元,充了5美元,充值送了20,相当于5美元能用5个月了。价格还时很划算的。创建了Los Angeles节点的服务器。得到root密码和IP。

IP:108.61.217.102

选择了按照centos6 i386系统。

ssh进入先安装WDCP(centos5 有问题,安装错误)

wget http://dl.wdlinux.cn/files/lanmp_v3.tar.gz
tar zxvf lanmp_v3.tar.gz
sh lanmp.sh

等待……

安装ss
wget –no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh
chmod +x shadowsocks.sh
./shadowsocks.sh 2>&1 | tee shadowsocks.log
安装完成后:
Congratulations, shadowsocks server install completed!
Your Server IP: 108.61.217.102
Your Server Port: 8989
Your Password: ********
Your Local IP: 127.0.0.1
Your Local Port: 1080
Your Encryption Method: aes-256-cfb

from:http://blog.csdn.net/huhu0769/article/details/52723413

修改配置文件vi /etc/shadowsocks.json为:
“server”:”0.0.0.0″,
“port_password”:{
“8989”:”pass8989″,
“9001”:”pass9001″,
“9002”:”pass9002″,
“9003”:”pass9003″,
“9004”:”pass9004″
},
“local_address”:”127.0.0.1″,
“local_port”:1080,
“timeout”:300,
“method”:”aes-256-cfb”,
“fast_open”:false

windows下,客户端软件。Shadowsocks?这个版本比较老,但是不需要.net4环境。xp、win7都支持。

发表在 随手杂记 | 购买了VPS已关闭评论

日出日落太阳角度C版本


#include "config.h"
#include <stdio.h>
#include <math.h>

float code degreesToRadians = 3.1416 /180.0000;
float code radiansToDegrees = 180.0000 /3.1416;
float code degreeMinutesToDecimal = 1.0000 /60.0000;
float code degreeSecondsToDecimal = 1.0000 /3600.0000;

sbit run=P0^0;

bit input_East,input_South;
float input_Longitude,input_Latitude,input_Elevation,input_Month,input_Date,input_Year,input_TimeZone;//原始需要数据
int chu,luo;//结果
u8 chu1,chu2,luo1,luo2;//结果转为小时、分钟
//角度计算用
float solarHourAngle,GHA,UT,inputHoursAfterMidnight,timeHours,timeMinutes,altitudeAngle,preAzimuthAngle,hourAngle,inputMinutesAfterMidnight,solarMinutesAfterMidnight;
//本地函数
float NormalizeTo360 (theThing) {
return (theThing - floor (theThing / 360.0) * 360);
}
float NormalizeTo180 (theThing) {
theThing = NormalizeTo360 (theThing);
if (theThing > 180) { theThing = theThing - 360; }
return (theThing);
}
void compute (void) {
float signedLongitude,signedLatitude,meridian,longitudeMeridianDifference,correctedYear,correctedMonth; //计算用转换数据
float t,G,C,L,alpha,obliquity,declination,eotAdjustment,clockTimeToLSOTAdjustment,sunRiseSetLSoTMinutes; //计算用中间数据
if (input_Latitude == 0) { input_Latitude = 0.000000001; }
if (input_Longitude == 0) { input_Longitude = 0.000000001; }
signedLongitude = input_Longitude;
if (input_East == 1) signedLongitude *= -1; // [1] = 东, [0] = 西
signedLatitude = input_Latitude;
if (input_South == 1) signedLatitude *= -1; // [0] = 北, [1] = 南
// 修复经度 > 180 deg
if (signedLongitude > 180) {
signedLongitude = signedLongitude - 360;
}
// 修复经度< -180 deg
if (signedLongitude < -180) {
signedLongitude = signedLongitude + 360;
}
// 当地标准时间子午线
meridian = input_TimeZone * -15;
// 如果太多与时区经度不同的警报
longitudeMeridianDifference = signedLongitude - meridian;
if ((longitudeMeridianDifference > 30) || (longitudeMeridianDifference < -30)) {
//alert ("所选择的时区与所在位置差距较大!");
}
// 计算通用时间
if (input_Month > 2) {
correctedYear = input_Year;
correctedMonth = input_Month - 3;
}
else {
correctedYear = input_Year - 1;
correctedMonth = input_Month + 9;
}
t = (input_Date + floor (30.6 * correctedMonth + 0.5) + floor (365.25 * (correctedYear - 1976)) - 8707.5) / 36525.0;
G = 357.528 + 35999.05 * t;
G = NormalizeTo360 (G);
C = (1.915 * sin (G * degreesToRadians)) + (0.020 * sin (2.0 * G * degreesToRadians));
L = 280.460 + (36000.770 * t) + C;
L = NormalizeTo360 (L);
alpha = L - 2.466 * sin (2.0 * L * degreesToRadians) + 0.053 * sin (4.0 * L * degreesToRadians);
obliquity = 23.4393 - 0.013 * t;
declination = atan (tan (obliquity * degreesToRadians) * sin (alpha * degreesToRadians)) * radiansToDegrees;
eotAdjustment = (L - C - alpha) / 15.0;
clockTimeToLSOTAdjustment = ((signedLongitude - meridian) / 15.0) - eotAdjustment; // 以小时为单位
sunRiseSetLSoTMinutes = radiansToDegrees * acos ( -1.0 * (sin (signedLatitude * degreesToRadians) * sin (declination * degreesToRadians) - sin ((-0.8333 - 0.0347 * sqrt (input_Elevation)) * degreesToRadians)) / cos (signedLatitude * degreesToRadians) / cos (declination * degreesToRadians)) * 4;
//日出时间
chu=12 * 60 - sunRiseSetLSoTMinutes + (clockTimeToLSOTAdjustment * 60);
//日落时间
luo=12 * 60 + sunRiseSetLSoTMinutes + (clockTimeToLSOTAdjustment * 60);
chu1=(int)chu/60;
chu2=(int)chu%60;
luo1=(int)luo / 60;
luo2=(int)luo % 60;
//以下用于计算太阳角度
inputHoursAfterMidnight=timeHours + timeMinutes / 60.0;
inputMinutesAfterMidnight = timeHours * 60.0 + timeMinutes;
solarMinutesAfterMidnight = inputMinutesAfterMidnight - (clockTimeToLSOTAdjustment * 60.0);
if (solarMinutesAfterMidnight < 0) {
solarMinutesAfterMidnight += 24 * 60;
}
if (solarMinutesAfterMidnight >= 24 * 60) {
solarMinutesAfterMidnight -= 24 * 60;
}
UT = inputHoursAfterMidnight - input_TimeZone;
GHA = UT * 15 - 180 - C + L - alpha;
GHA = NormalizeTo360 (GHA);
solarHourAngle = GHA - signedLongitude;
solarHourAngle = NormalizeTo180 (solarHourAngle);
//小时角数据 hourAngle
hourAngle = (solarMinutesAfterMidnight - (12 * 60)) / 4;
//计算偏差数据 declination
declination = atan (tan (obliquity * degreesToRadians) * sin (alpha * degreesToRadians)) * radiansToDegrees;
//高度角计算 altitudeAngle 水平为0
altitudeAngle = radiansToDegrees * asin ((sin (signedLatitude* degreesToRadians)*sin (declination*degreesToRadians)) -(cos (signedLatitude* degreesToRadians) *cos (declination* degreesToRadians)*cos ((solarHourAngle + 180) * degreesToRadians)));
//方位角计算 preAzimuthAngle 南为0
preAzimuthAngle = radiansToDegrees * acos ((cos (declination* degreesToRadians)*((cos (signedLatitude * degreesToRadians)*tan (declination* degreesToRadians))+(sin (signedLatitude * degreesToRadians)*cos ((solarHourAngle + 180)* degreesToRadians)))) /cos (altitudeAngle * degreesToRadians))-180;
if ((preAzimuthAngle * hourAngle) < 0) {
preAzimuthAngle *= -1;
}
}
void main (void) {
//日起日落提供的参数
input_Longitude=114.41; //经度
input_East=1;//东经1,西经0
input_Latitude=36.93;//维度
input_South=0;//北纬0,南纬1
input_Year=2017;
input_Month=1;
input_Date=1;
input_TimeZone=8; //时区参数
input_Elevation=0;//海拔
//太阳角度计算用参数
timeHours=0;
timeMinutes=50;

run=1;
run=0;
compute();
run=1;
run=0;
run=1;
run=0;
run=1;
run=0;
while(1){
run=0;
compute();
run=1;
}
}

发表在 待分类 | 日出日落太阳角度C版本已关闭评论

日出日落及方位角计算html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>太阳高度角的计算-太阳高度角在线计算器-太阳方位角计算软件</title>
<body>
<script type="text/javascript">
// sunangle.js

var showedLongitudeMeridianWarning = false;
//console.log("调试");
// 检查输入功能//
function CheckInputs () {

var error = false;

var error_message = "注意!下面的输入必须予以纠正,才可以计算出太阳的角度:\n\n";

var f = document.theForm;

var inputLatitude = f.inputLatitude.value;
var inputLongitude = f.inputLongitude.value;
var inputTime = f.inputTime.value;
var inputElevation = f.inputElevation.value;

//纬度

var latitudeOkay = false;

if (inputLatitude.search ("^[0-9]+[dD][0-9]+[mM][0-9]+[sS]$") > -1) { latitudeOkay = true; }

else { if ((inputLatitude >= 0 ) && (inputLatitude <= 90)) { latitudeOkay = true; } }

if (! latitudeOkay) {

error_message = error_message + "* T纬度必须介于0到90度之间\n";

error = true;
}

// 经度

var longitudeOkay = false;

if (inputLongitude.search ("^[0-9]+[dD][0-9]+[mM][0-9]+[sS]$") > -1) { longitudeOkay = true; }

else { if ((inputLongitude >= 0 ) && (inputLongitude <= 360)) { longitudeOkay = true; } }

if (! longitudeOkay) {

error_message = error_message + "* 经度必须介于0到360度之间\n";

error = true;
}

//海拔

if ((inputElevation != '') && (inputElevation.search ("[^0-9]") > -1)) {

error_message = error_message + "* 高程仅包含数字\n";

error = true;
}

// 时间

if ((inputTime != '') && (inputTime.search ("^[0-9]+:?[0-9][0-9]$") < 0)) {

error_message = error_message + "* 时间必须是XX:XX或XXXX格式,如12点10分,填12:10或1210 \n";

error = true;
}

//警报/返回

if (error == true) { alert (error_message); }

return (! error);
}
///////////////////////////
// 主函数计算//
///////////////////////////

function compute () {

if (CheckInputs ()) {

var f = document.theForm;

//常量

var degreesToRadians = 3.1416 / 180.0000;
var radiansToDegrees = 180.0000 / 3.1416;
var degreeMinutesToDecimal = 1.0000 / 60.0000;
var degreeSecondsToDecimal = 1.0000 / 3600.0000;

// 检索输入的值

var inputLongitude = f.inputLongitude.value;
var inputEastWest = f.inputEastWest.options[f.inputEastWest.selectedIndex].text;
var inputLatitude = f.inputLatitude.value;
var inputNorthSouth = f.inputNorthSouth.options[f.inputNorthSouth.selectedIndex].text;
var inputElevation = f.inputElevation.value;
//var inputFeetMeters = f.inputFeetMeters.options[f.inputFeetMeters.selectedIndex].text;
var inputMonth = f.inputMonth.options[f.inputMonth.selectedIndex].text;
var inputDate = f.inputDate.options[f.inputDate.selectedIndex].text - 0;
var inputYear = f.inputYear.options[f.inputYear.selectedIndex].text - 0;
var inputTime = f.inputTime.value;
var inputAMPM = f.inputAMPM.options[f.inputAMPM.selectedIndex].text;
var inputTimeFormat = f.inputTimeFormat.options[f.inputTimeFormat.selectedIndex].text;
var inputTimeZone = f.inputTimeZone.options[f.inputTimeZone.selectedIndex].value - 0;
var inputZeroAzimuth = f.inputZeroAzimuth.options[f.inputZeroAzimuth.selectedIndex].value - 0;
if (inputLongitude.indexOf("d") != -1) {

degMarker = inputLongitude.indexOf("d");
minMarker = inputLongitude.indexOf("m");
secMarker = inputLongitude.indexOf("s");

longitudeDeg = inputLongitude.substr(0,degMarker) - 0;
longitudeMin = inputLongitude.substr(degMarker+1,minMarker-degMarker-1) - 0;
longitudeSec = inputLongitude.substr(minMarker+1,secMarker-minMarker-1) - 0;

inputLongitude = longitudeDeg + (longitudeMin * degreeMinutesToDecimal) + (longitudeSec * degreeSecondsToDecimal);
}
else { inputLongitude -= 0; }

if (inputLatitude.indexOf("d") != -1) {

degMarker = inputLatitude.indexOf("d");
minMarker = inputLatitude.indexOf("m");
secMarker = inputLatitude.indexOf("s");

LatitudeDeg = inputLatitude.substr(0,degMarker) - 0;
LatitudeMin = inputLatitude.substr(degMarker+1,minMarker-degMarker-1) - 0;
LatitudeSec = inputLatitude.substr(minMarker+1,secMarker-minMarker-1) - 0;

inputLatitude = LatitudeDeg + (LatitudeMin * degreeMinutesToDecimal) + (LatitudeSec * degreeSecondsToDecimal);
}
else { inputLatitude -= 0; }

//检查输入值的有效性

var validInputTime = true;

// 避免由于纬度或经度数学错误 = 0

if ((inputLatitude == 0) && (f.inputLatitude.value.length > 0)) { inputLatitude = 0.000000001; }
if ((inputLongitude == 0) && (f.inputLongitude.value.length > 0)) { inputLongitude = 0.000000001; }

//检查输入的字段都由用户填写

var timeEntered = (inputTime != "");//时间填入
var latitudeEntered = (inputLatitude != "");//经纬度填入
var longitudeEntered = (inputLongitude != "");

// 将输入的字符串转换为数字

inputLatitude = inputLatitude - 0;
inputLongitude = inputLongitude - 0;
inputElevation = inputElevation - 0;

// 确定时间格式
var clockTimeInputMode = (inputTimeFormat == "时钟时间");
var lsotInputMode = (inputTimeFormat == "太阳时");
//console.log(lsotInputMode);

//

var doableDeclination = true;
var doableEOT = true;
var doableClockTime = ((longitudeEntered || clockTimeInputMode) && timeEntered);
var doableLSOT = ((longitudeEntered || lsotInputMode) && timeEntered);
var doableHourAngle = (longitudeEntered && timeEntered);
var doableSunRiseSet = (longitudeEntered && latitudeEntered);
var doableAltitude = (longitudeEntered && timeEntered && latitudeEntered);
var doableAzimuth = (longitudeEntered && timeEntered && latitudeEntered);
// //////////// //
//计算//
// //////////// //

// 转换单位

// 经度东-西调整

if (longitudeEntered) {
var signedLongitude = inputLongitude;
if (inputEastWest == "East") signedLongitude *= -1; // [1] = 东, [0] = 西
}

// 纬度南北调整

if (latitudeEntered) {
var signedLatitude = inputLatitude;
if (inputNorthSouth == "South") signedLatitude *= -1; // [0] = 北, [1] = 南
}

// 修复经度 > 180 deg

if (signedLongitude > 180) {

signedLongitude = signedLongitude - 360;
}

// 修复经度< -180 deg

if (signedLongitude < -180) {

signedLongitude = signedLongitude + 360;
}

//设置为零的方位

zeroAzimuth = inputZeroAzimuth;

// 当地标准时间子午线

var meridian = inputTimeZone * -15;

// 如果太多与时区经度不同的警报

var longitudeMeridianDifference = signedLongitude - meridian;

if ((! showedLongitudeMeridianWarning) && ((longitudeMeridianDifference > 30) || (longitudeMeridianDifference < -30))) {

alert ("警告: 经度从选定的时区中心相差超过30度. 这可能是正确的, 或者它可能表明,其中一个输入是不正确的.\n\n请点击 '时区' 输入的详细信息.\n\n(不会再次显示这个警告.)");

showedLongitudeMeridianWarning = true;
}

// 计算时间

// 转换时间输入午后小时

if (validInputTime) {

// ...如果有必要从时间字符串删除分号

inputTime = RemoveSemicolon (inputTime);

// ...解析时间输入的字符串并得到小时和分钟

if (inputTime.length == 4) { // 如 "1234"
timeHours = inputTime.substring(0,2) - 0;
timeMinutes = inputTime.substring(2,4) - 0;
}
else { // 如 "123"
timeHours = inputTime.substring(0,1) - 0;
timeMinutes = inputTime.substring(1,3) - 0;
}

// ...调整为 AM/PM 名称

if ((inputAMPM == "AM") && (timeHours == 12)) timeHours = 0;
if (inputAMPM == "PM") { if (timeHours != 12) timeHours += 12; }

// ...计算后午夜的时钟分钟

var inputHoursAfterMidnight = timeHours + timeMinutes / 60.0;
var inputMinutesAfterMidnight = timeHours * 60.0 + timeMinutes;
}

// 计算通用时间

var UT = 0.0;

if (validInputTime) { UT = inputHoursAfterMidnight - inputTimeZone; }

var monthNum = (MonthStringToMonthNum (inputMonth)) - 0;

if (monthNum > 2) {
correctedYear = inputYear;
correctedMonth = monthNum - 3;
}
else {
correctedYear = inputYear - 1;
correctedMonth = monthNum + 9;
}

var t = ((UT / 24.0) + inputDate + Math.floor (30.6 * correctedMonth + 0.5) + Math.floor (365.25 * (correctedYear - 1976)) - 8707.5) / 36525.0;

var G = 357.528 + 35999.05 * t;
G = NormalizeTo360 (G);

var C = (1.915 * Math.sin (G * degreesToRadians)) + (0.020 * Math.sin (2.0 * G * degreesToRadians));

var L = 280.460 + (36000.770 * t) + C;
L = NormalizeTo360 (L);

var alpha = L - 2.466 * Math.sin (2.0 * L * degreesToRadians) + 0.053 * Math.sin (4.0 * L * degreesToRadians);

var GHA = UT * 15 - 180 - C + L - alpha;
GHA = NormalizeTo360 (GHA);

var obliquity = 23.4393 - 0.013 * t;

var declination = Math.atan (Math.tan (obliquity * degreesToRadians) * Math.sin (alpha * degreesToRadians)) * radiansToDegrees;

f.outputDeclination.value = FormatFloatString (declination);

var eotAdjustment = (L - C - alpha) / 15.0;

f.outputEOT.value = FormatFloatString (eotAdjustment);

if (doableLSOT || doableClockTime) {

var clockTimeToLSOTAdjustment = ((signedLongitude - meridian) / 15.0) - eotAdjustment; // 以小时为单位
}

var solarHourAngle = 0;

if (clockTimeInputMode) { solarHourAngle = GHA - signedLongitude; }

else { solarHourAngle = 15 * (inputHoursAfterMidnight - 12); }

solarHourAngle = NormalizeTo180 (solarHourAngle);

var apparentSolarTime = 0;

if (clockTimeInputMode) { apparentSolarTime = NormalizeTo24 (12 + solarHourAngle / 15.0); }

else { apparentSolarTime = inputHoursAfterMidnight; }

if (doableLSOT) {

if (clockTimeInputMode) {

solarMinutesAfterMidnight = inputMinutesAfterMidnight - (clockTimeToLSOTAdjustment * 60.0);

var whichDay = 0;

if (solarMinutesAfterMidnight < 0) {
solarMinutesAfterMidnight += 24 * 60;
whichDay = -1;
}

if (solarMinutesAfterMidnight >= 24 * 60) {
solarMinutesAfterMidnight -= 24 * 60;
whichDay = 1;
}
}

else {

solarMinutesAfterMidnight = inputMinutesAfterMidnight;

whichDay = 0;
}
//console.log(inputAMPM);
solarTime = MinutesToClockTime (solarMinutesAfterMidnight, inputAMPM);

if (whichDay == "-1") f.outputLSOT.value = solarTime + "-";
if (whichDay == "0") f.outputLSOT.value = solarTime ;
if (whichDay == "1") f.outputLSOT.value = solarTime + "+";
}

else { f.outputLSOT.value = ""; }

if (doableClockTime) {

var clockMinutesAfterMidnight = inputMinutesAfterMidnight;

if (lsotInputMode) { clockMinutesAfterMidnight = inputMinutesAfterMidnight + (clockTimeToLSOTAdjustment * 60.0); }

var whichDay = 0;

if (clockMinutesAfterMidnight < 0) {
clockMinutesAfterMidnight += 24 * 60;
whichDay = -1;
}

if (clockMinutesAfterMidnight >= 24 * 60) {
clockMinutesAfterMidnight -= 24 * 60;
whichDay = 1;
}

clockTime = MinutesToClockTime (clockMinutesAfterMidnight, inputAMPM);

if (whichDay == "-1") f.outputClockTime.value = clockTime + "-";
if (whichDay == "0") f.outputClockTime.value = clockTime ;
if (whichDay == "1") f.outputClockTime.value = clockTime + "+";
}

else { f.outputClockTime.value = ""; }

// 小时角

// 不同之间 180 和 + 180 度

if (doableHourAngle) {

var hourAngle = (solarMinutesAfterMidnight - (12 * 60)) / 4;

f.outputHourAngle.value = FormatFloatString (hourAngle);
}

else { f.outputHourAngle.value = ""; }

//地平高度角

if (doableAltitude) {

var altitudeAngle = radiansToDegrees * ArcSin (
(Math.sin (signedLatitude * degreesToRadians) *
Math.sin (declination * degreesToRadians)) -
(Math.cos (signedLatitude * degreesToRadians) *
Math.cos (declination * degreesToRadians) *
Math.cos ((solarHourAngle + 180) * degreesToRadians)));

f.outputAltitude.value = FormatFloatString (altitudeAngle);
}

else { f.outputAltitude.value = ""; }

// 方位角

if (doableAzimuth) {

var preAzimuthAngle = radiansToDegrees * ArcCos (
(Math.cos (declination * degreesToRadians) *
((Math.cos (signedLatitude * degreesToRadians) *
Math.tan (declination * degreesToRadians)) +
(Math.sin (signedLatitude * degreesToRadians) *
Math.cos ((solarHourAngle + 180) * degreesToRadians)))) /
Math.cos (altitudeAngle * degreesToRadians));

azimuthAngle = preAzimuthAngle + (zeroAzimuth - 180.0);

// 方位角的正确标志
if (zeroAzimuth == 0) {

azimuthAngle = ChangeSign (azimuthAngle, "same", hourAngle);
}

//北零方位

else {

azimuthAngle = ChangeSign (azimuthAngle, "opposite", hourAngle);
}

f.outputAzimuth.value = FormatFloatString (azimuthAngle);
}

else { f.outputAzimuth.value = ""; }

// 时钟时间的日出与日落

if (doableSunRiseSet) {
var sunRiseSetLSoTMinutes = radiansToDegrees * ArcCos ( -1.0 *
(Math.sin (signedLatitude * degreesToRadians) *
Math.sin (declination * degreesToRadians) -
Math.sin ((-0.8333 - 0.0347 * Math.sqrt (inputElevation)) * degreesToRadians)) /
Math.cos (signedLatitude * degreesToRadians) /
Math.cos (declination * degreesToRadians)) * 4;
//日出时间
f.outputSunrise.value = MinutesToClockTime ((12 * 60 - sunRiseSetLSoTMinutes + (clockTimeToLSOTAdjustment * 60)), inputAMPM);
//日落时间
f.outputSunset.value = MinutesToClockTime ((12 * 60 + sunRiseSetLSoTMinutes + (clockTimeToLSOTAdjustment * 60)), inputAMPM);
}
else {
f.outputSunrise.value = "";
f.outputSunset.value = "";
}
}

// 零出形式输出,是否输入了无效

else {

var f = document.theForm;

f.outputAltitude.value = '';
f.outputAzimuth.value = '';
f.outputDeclination.value = '';
f.outputEOT.value = '';
f.outputClockTime.value = '';
f.outputSunrise.value = '';
f.outputSunset.value = '';
f.outputLSOT.value = '';
f.outputHourAngle.value = '';
}

}
// 其他功能

function ChangeSign (input, mode, basis) {

if (mode == "same") {

if ((input * basis) < 0) {

input *= -1;
}
}

else {

if ((input * basis) > 0) {

input *= -1;
}
}

return input;
}
function NoEnter () {

return !(window.event && window.event.keyCode == 13);
}

function ArcSin (theThing) {

return (Math.asin (theThing));
}

function ArcCos (theThing) {

return (Math.acos (theThing));
}
function MinutesToClockTime (totalMinutes, amPM) {

var theHours = Math.floor (totalMinutes / 60);

var theMinutes = Math.floor (totalMinutes % 60);

if (theMinutes < 10) theMinutes = "0" + theMinutes;

if (amPM == "24 hr") {
if (theHours < 10) theHours = "0" + theHours;
returnString = theHours + "" + theMinutes;
}

else {
if (theHours < 12) {
if (theHours == 0) theHours = 12;
returnString = theHours + ":" + theMinutes + "AM";
}
else {
if (theHours == 12) theHours = 24;
returnString = (theHours - 12) + ":" + theMinutes + "PM"
}
}

return (returnString);
}
function NormalizeTo360 (theThing) {

return (theThing - Math.floor (theThing / 360.0) * 360);
}
function NormalizeTo180 (theThing) {

theThing = NormalizeTo360 (theThing);

if (theThing > 180) { theThing = theThing - 360; }

return (theThing);
}
function NormalizeTo24 (theThing) {

return (theThing - Math.floor (theThing / 24.0) * 24);
}
function MonthStringToDays (whichMonth) {

if (whichMonth == "1") return (0);
if (whichMonth == "2") return (31);
if (whichMonth == "3") return (59);
if (whichMonth == "4") return (90);
if (whichMonth == "5") return (120);
if (whichMonth == "6") return (151);
if (whichMonth == "7") return (181);
if (whichMonth == "8") return (212);
if (whichMonth == "9") return (243);
if (whichMonth == "10") return (273);
if (whichMonth == "11") return (304);
if (whichMonth == "12") return (334);

return ("Zeke the Solar Cat");
}
function MonthStringToMonthNum (whichMonth) {

if (whichMonth == "1") return (1);
if (whichMonth == "2") return (2);
if (whichMonth == "3") return (3);
if (whichMonth == "4") return (4);
if (whichMonth == "5") return (5);
if (whichMonth == "6") return (6);
if (whichMonth == "7") return (7);
if (whichMonth == "8") return (8);
if (whichMonth == "9") return (9);
if (whichMonth == "10") return (10);
if (whichMonth == "11") return (11);
if (whichMonth == "12") return (12);

return ("Zeke the Solar Cat");
}

function RemoveSemicolon (inputString) {

if (inputString.substring (1,2) == ":") {
return (inputString.substring(0,1) + inputString.substring(2,4));
}

if (inputString.substring (2,3) == ":") {
return (inputString.substring(0,2) + inputString.substring(3,5));
}

return (inputString);
}

function FormatFloatString (theInput) {

var negativeNumber = false;
if (theInput < 0) {
negativeNumber = true;
theInput *= -1;
}

integerPortion = Math.floor (theInput);
decimalPortion = Math.round (theInput * 100) % 100;

//添加 7/17/99/17/99 纠正 0.999 被舍入为 0.000 十进制转换中的问题 ︰
if ((decimalPortion == 0) && ((theInput - integerPortion) > 0.5)) {
integerPortion += 1;
}

if (integerPortion < 10) integerPortionString = " " + integerPortion;
else integerPortionString = "" + integerPortion;

if (decimalPortion < 10) decimalPortionString = "0" + decimalPortion; // 如果需要,添加前导零
else decimalPortionString = "" + decimalPortion;

if (negativeNumber == true) return ("-" + integerPortionString + "." + decimalPortionString);
else return (" " + integerPortionString + "." + decimalPortionString);
}
</script>
</p><p><b>太阳高度角在线计算器 </b><font color="#f4fdff">公式软件</font></p>
<table class="nopad" width="438">
<tbody>
<tr valign="top">
<td>
<table class="contentpaneopen" width="60%" height="548">
<tbody>
<tr>
<td height="390" valign="top" width="446">
<form action="javascript:compute();" name="theForm">
<table border="1" cellpadding="2" width="430">
<!-- ------ --><!-- INPUTS --><!-- ------ -->
<tbody>
<tr>
<td class="tableHeaderBar" bgcolor="#d7ffff" colspan="5">
<p align="center"> East东 West西 North北 South南</p>
</td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" valign="middle" width="56" align="right"><span class="dataLabel"><font size="2">经度</font></span></td>
<td bgcolor="#d7ffff" valign="middle" width="51" align="left"><input maxlength="10" size="6" onkeypress="return NoEnter()" name="inputLongitude" type="text" value="114.4"><font size="2"> </font></td>
<td bgcolor="#d7ffff" valign="middle" width="61" align="left"><select name="inputEastWest">
<option selected="selected">East</option>
<option>West</option>
</select><font size="2"> </font></td>
<td bgcolor="#d7ffff" width="84" align="right"><span class="dataLabel"><font size="2">选择时间制式</font></span></td>
<td align="left"><input maxlength="5" size="5" onkeypress="return NoEnter()" name="inputTime" value="12:00" type="text"> <select name="inputAMPM">
<option>AM</option>
<option>PM</option>
<option selected="selected">24 hr</option>
</select></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><span class="dataLabel"><font size="2">纬度</font></span></td>
<td bgcolor="#d7ffff" width="51" align="left"><input maxlength="10" size="6" onkeypress="return NoEnter()" name="inputLatitude" value="36.9" type="text"><font size="2"> </font></td>
<td bgcolor="#d7ffff" width="61" align="left"><select name="inputNorthSouth">
<option selected="selected">North</option>
<option>South</option>
</select><font size="2"> </font></td>
<td bgcolor="#d7ffff" width="84" align="right"><span class="dataLabel"><font size="2">选择时区 </font></span></td>
<td bgcolor="#d7ffff" width="134" align="left"><select size="1" name="inputTimeZone">
<option value="0">Z (GMT)</option>
<option value="1">A (GMT + 1:00)</option>
<option value="2">B (GMT + 2:00)</option>
<option value="3">C (GMT + 3:00)</option>
<option value="3.5">C*(GMT + 3:30)</option>
<option value="4">D (GMT + 4:00)</option>
<option value="4.5">D* (GMT + 4:30)</option>
<option value="5">E (GMT + 5:00)</option>
<option value="5.5">E* (GMT + 5:30)</option>
<option value="6">F (GMT + 6:00)</option>
<option value="6.5">F* (GMT + 6:30)</option>
<option value="7">G (GMT + 7:00)</option>
<option value="8" selected="selected">H (GMT + 8:00)</option>
<option value="9">I (GMT + 9:00)</option>
<option value="9.5">I* (GMT + 9:30)</option>
<option value="10">K (GMT + 10:00)</option>
<option value="10.5">K* (GMT + 10:30)</option>
<option value="11">L (GMT + 11:00)</option>
<option value="11.5">L* (GMT + 11:30)</option>
<option value="12">M (GMT + 12:00)</option>
<option value="13">M* (GMT + 13:00)</option>
<option value="-1">N (GMT - 1:00)</option>
<option value="-2">O (GMT - 2:00)</option>
<option value="-3">P (GMT - 3:00)</option>
<option value="-3.5">P* (GMT - 3:30)</option>
<option value="-4">Q (GMT - 4:00)</option>
<option value="-5">R (GMT - 5:00)</option>
<option value="-6">S (GMT - 6:00)</option>
<option value="-7">T (GMT - 7:00)</option>
<option value="-8">U (GMT - 8:00)</option>
<option value="-8.5">U* (GMT - 8:30)</option>
<option value="-9">V (GMT - 9:00)</option>
<option value="-9.5">V* (GMT - 9:30)</option>
<option value="-10">W (GMT - 10:00)</option>
<option value="-11">X (GMT - 11:00)</option>
<option value="-12">Y (GMT - 12:00)</option>
</select></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><font color="#ff9933" size="2"><span class="dataLabel">选择日期</span></font></td>
<td bgcolor="#d7ffff" width="120" colspan="2" align="left"><font color="#ff9933"><select name="inputMonth">
<option selected="selected">1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select><font size="2">月&nbsp;</font><select name="inputDate">
<option selected="selected">1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select><font size="2">日</font></font><font size="2"> </font></td>
<td bgcolor="#d7ffff" width="84" align="right"><span class="dataLabel"><font size="2">选择基准时间 </font></span></td>
<td bgcolor="#d7ffff" width="134" align="left"><select size="1" name="inputTimeFormat">
<option>时钟时间</option>
<option selected="selected">太阳时</option>
</select></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><font size="2"> </font></td>
<td bgcolor="#d7ffff" width="120" colspan="2" align="left"><font color="#ff9933"><select name="inputYear">
<option>2015</option>
<option>2016</option>
<option selected="selected">2017</option>
<option>2018</option>
<option>2019</option>
</select></font><font color="#ff9933" size="2">年</font></td>
<td bgcolor="#d7ffff" width="84" align="right"><span class="dataLabel"><font size="2"> </font></span></td>
<td bgcolor="#d7ffff" width="134" align="left"></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><span class="dataLabel"><font size="2">海拔</font></span></td>
<td bgcolor="#d7ffff" width="120" colspan="2" align="left"><input maxlength="5" size="5" onkeypress="return NoEnter()" name="inputElevation" type="text"><font size="2"> </font>米</td>
<td bgcolor="#d7ffff" width="84" align="right"><span class="dataLabel"><font size="2">零方位角</font></span></td>
<td bgcolor="#d7ffff" width="134" align="left"><select size="1" name="inputZeroAzimuth">
<option value="0" selected="selected">南</option>
<option value="180">北</option>
</select></td>
</tr>
<!-- --------- --><!-- CALCULATE --><!-- --------- -->
<tr>
<td bgcolor="#d7ffff" width="184" colspan="3" align="center"><input class="calculateButton" type="submit" onclick="return CheckInputs();" style="background-color: #ff9933" value=" 计算 "></td>
<td bgcolor="#d7ffff" width="226" colspan="2" align="center">
<p align="center"><b></b></p>
</td>
</tr>
<!-- ------- --><!-- OUTPUTS --><!-- ------- -->
<tr>
<td class="tableHeaderBar" bgcolor="#d7ffff" colspan="5"><span class="tableHeaderText"><font size="2">输出结果:</font></span></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><span class="dataLabel"><font size="2">太阳高度角 </font></span></td>
<td bgcolor="#d7ffff" width="120" colspan="2" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputAltitude" type="text"></td>
<td bgcolor="#d7ffff" width="84" align="right"><font color="#ff9933" size="2"><span class="dataLabel">偏差</span></font></td>
<td bgcolor="#d7ffff" width="134" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputDeclination" type="text"></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><span class="dataLabel"><font size="2">太阳方位角 </font></span></td>
<td bgcolor="#d7ffff" width="120" colspan="2" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputAzimuth" type="text"></td>
<td bgcolor="#d7ffff" width="84" align="right"><font color="#ff9933" size="2"><span class="dataLabel">时差</span></font></td>
<td bgcolor="#d7ffff" width="134" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputEOT" type="text"></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><span class="dataLabel"><font size="2">时钟时间</font></span></td>
<td bgcolor="#d7ffff" width="120" colspan="2" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputClockTime" type="text"></td>
<td bgcolor="#d7ffff" width="84" align="right"><span class="dataLabel"><font size="2">日出时间</font></span></td>
<td bgcolor="#d7ffff" width="134" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputSunrise" type="text"></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><span class="dataLabel"><font size="2">太阳时 </font></span></td>
<td bgcolor="#d7ffff" width="120" colspan="2" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputLSOT" type="text"></td>
<td bgcolor="#d7ffff" width="84" align="right"><span class="dataLabel"><font size="2">日落时间</font></span></td>
<td bgcolor="#d7ffff" width="134" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputSunset" type="text"></td>
</tr>
<tr valign="middle">
<td bgcolor="#d7ffff" width="56" align="right"><span class="dataLabel"><font size="2">时角 </font></span></td>
<td bgcolor="#d7ffff" width="120" colspan="2" align="left"><input maxlength="10" size="10" onkeypress="return NoEnter()" name="outputHourAngle" type="text"></td>
<td bgcolor="#d7ffff" width="84" align="right"> </td>
<td bgcolor="#d7ffff" width="134" align="left">20170202修改</td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body></html>

发表在 待分类 | 日出日落及方位角计算html已关闭评论

日出日落计算


#include "config.h"
#include <stdio.h>
#include <math.h>

float code degreesToRadians = 3.1416 /180.0000;
float code radiansToDegrees = 180.0000 /3.1416;
float code degreeMinutesToDecimal = 1.0000 /60.0000;
float code degreeSecondsToDecimal = 1.0000 /3600.0000;

bit input_East,input_South;
float input_Longitude,input_Latitude,input_Elevation,input_Month,input_Date,input_Year,input_TimeZone;//原始需要数据
int chu,luo;//结果
u8 chu1,chu2,luo1,luo2;//结果转为小时、分钟

float NormalizeTo360 (theThing) {
return (theThing - floor (theThing / 360.0) * 360);
}
void compute (void) {
float signedLongitude,signedLatitude,meridian,longitudeMeridianDifference,correctedYear,correctedMonth; //计算用转换数据
float t,G,C,L,alpha,obliquity,declination,eotAdjustment,clockTimeToLSOTAdjustment,sunRiseSetLSoTMinutes; //计算用中间数据
if (input_Latitude == 0) { input_Latitude = 0.000000001; }
if (input_Longitude == 0) { input_Longitude = 0.000000001; }
signedLongitude = input_Longitude;
if (input_East == 1) signedLongitude *= -1; // [1] = 东, [0] = 西
signedLatitude = input_Latitude;
if (input_South == 1) signedLatitude *= -1; // [0] = 北, [1] = 南
// 修复经度 > 180 deg
if (signedLongitude > 180) {
signedLongitude = signedLongitude - 360;
}
// 修复经度< -180 deg
if (signedLongitude < -180) {
signedLongitude = signedLongitude + 360;
}
// 当地标准时间子午线
meridian = input_TimeZone * -15;
// 如果太多与时区经度不同的警报
longitudeMeridianDifference = signedLongitude - meridian;
if ((longitudeMeridianDifference > 30) || (longitudeMeridianDifference < -30)) {
//alert ("所选择的时区与所在位置差距较大!");
}
// 计算通用时间
if (input_Month > 2) {
correctedYear = input_Year;
correctedMonth = input_Month - 3;
}
else {
correctedYear = input_Year - 1;
correctedMonth = input_Month + 9;
}
t = (input_Date + floor (30.6 * correctedMonth + 0.5) + floor (365.25 * (correctedYear - 1976)) - 8707.5) / 36525.0;
G = 357.528 + 35999.05 * t;
G = NormalizeTo360 (G);
C = (1.915 * sin (G * degreesToRadians)) + (0.020 * sin (2.0 * G * degreesToRadians));
L = 280.460 + (36000.770 * t) + C;
L = NormalizeTo360 (L);
alpha = L - 2.466 * sin (2.0 * L * degreesToRadians) + 0.053 * sin (4.0 * L * degreesToRadians);
obliquity = 23.4393 - 0.013 * t;
declination = atan (tan (obliquity * degreesToRadians) * sin (alpha * degreesToRadians)) * radiansToDegrees;
eotAdjustment = (L - C - alpha) / 15.0;
clockTimeToLSOTAdjustment = ((signedLongitude - meridian) / 15.0) - eotAdjustment; // 以小时为单位
sunRiseSetLSoTMinutes = radiansToDegrees * acos ( -1.0 * (sin (signedLatitude * degreesToRadians) * sin (declination * degreesToRadians) - sin ((-0.8333 - 0.0347 * sqrt (input_Elevation)) * degreesToRadians)) / cos (signedLatitude * degreesToRadians) / cos (declination * degreesToRadians)) * 4;
//日出时间
chu=12 * 60 - sunRiseSetLSoTMinutes + (clockTimeToLSOTAdjustment * 60);
//日落时间
luo=12 * 60 + sunRiseSetLSoTMinutes + (clockTimeToLSOTAdjustment * 60);
chu1=(int)chu/60;
chu2=(int)chu%60;
luo1=(int)luo / 60;
luo2=(int)luo % 60;
}
void main (void) {
//提供的参数
input_Longitude=114.41; //经度
input_East=1;//东经1,西经0
input_Latitude=36.93;//维度
input_South=0;//北纬0,南纬1
input_Year=2017;
input_Month=2;
input_Date=2;
input_TimeZone=8;
while(1){
compute();
}
}

发表在 待分类 | 日出日落计算已关闭评论

Proteus 8 汉化包

这个是中文版的教程和汉化包。非常好用的开发软件。

把proteus_zh_CN.qm复制到
32位系统:C:\Program Files\Labcenter Electronics\Proteus 8 Professional\Translations
64位系统:C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\Translations
这个文件夹下,再重新打开Proteus软件。

中文语言包

VSM帮助文档

Proteus教程

Proteus元件封装详解

对于protuse的PCB很多厂商不支持,可以导出CAM350的格式,这是都支持的格式。

CAM350-9.5.1-ha

发表在 待分类 | Proteus 8 汉化包已关闭评论

iperf网络吞吐量测试

iperf是一个优秀的测试网络性能的软件。windows下有了iPerfGui+后可以通过GUI来操作,省的记指令了。非常好用。

GUI需要.net环境。

iPerfGui+网络吞吐量测试

发表在 待分类 | iperf网络吞吐量测试已关闭评论

潘多拉固件

http://www.openwrt.org.cn/无法访问,要潘多拉固件下载地址更新为
http://downloads.pandorabox.com.cn/pandorabox/YouKu_YK1/firmware/stable/
准备安装freeswitch,在openwrt的官网,mt7620的地址为:

最新版应该是:https://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7620/packages/

但里边没找到freeswitch

同样是ramips,在1209里找到了freeswitch。

https://downloads.openwrt.org/attitude_adjustment/12.09/ramips/rt305x/packages/

mt7620a的地址

https://openwrt.proxy.ustclug.org/barrier_breaker/14.07/ramips/mt7620a/

如果源的地址速度慢可以用镜像

https://openwrt.proxy.ustclug.org/

关于mt7620a与mt7620的区别:

mt7620包括mt7620a与mt7620N,mt7620a可以双频,但N属于阉割版,只能用2.4G。固件里mt7620的没有说明a还是n,一般就可以用于a。

1209里有freeswitch,1407里开始有mt7620a,最新1505版本有mt7620/

但是因为使用的是潘多拉,这个潘多拉是基于哪个版本的openwrt目前还不清楚。

潘多拉网站给的ipk地址

http://downloads.pandorabox.com.cn/pandorabox/ralink/mt7620/packages/

 

发表在 待分类 | 潘多拉固件已关闭评论