Wednesday, March 29, 2017

Blade 200 S parts


Tonight, I took apart one of my Blade 200 S remote control helicopter.


Blade 200 S Remote Control Helicopter Parts


With this exercise, I learned an important lesson... don't take apart remote control helicopters unless you absolutely have to... they are very challenging to put back together.



Gliesians.com offers free lifetime membership to first 1,000 users

Gliesians.com will no longer be free to use... unless you are among the first 1,000 registered users.

The first 1,000 users of gliesians.com will have free lifetime membership to all of the sites utilities.

The site offers free utilities on genealogy, rotorcraft and much more.  New utilities and features are constantly added by a small team of committed developers.

If you haven't check the site out yet, please do so, you may find a utility or two that you find quite handy. :)



Monday, March 27, 2017

Convert WGS_1984 MSL to absolute altitude (AGL)

Here's the latest open source code coming out of the effort I've been supporting... the code converts WGS_1984 MSL to absolute altitude (AGL).  You can find the code on GitHub under the eleveation2agl project.
Determining AGL (elevation2agl.py)...

Example Inputs...
 WGS_1984 location                              : -74.5659708,39.4505594
 Provided reference elevation (WGS_1984 MSL)    : 1660 feet above MSL

Ground level calculations...
  NAD_1983 location (used w/ ground level query): -74.56596924794374,39.45055141406901
  Gathered ground level altitude                : 59.73 feet above MSL

AGL Calculations...
  Absolute altitude - above ground level (AGL)  : 1600.27 feet 

Here's a quicklook at the latest code/script at the time of this writing...

#!/usr/local/bin/python3
#
# Purpose: Converts WGS_1984 MSL to absolute altitude (AGL)
#
# Example usage:
#    python elevation2agl.py
#
# References:
# view-source:http://tagis.dep.wv.gov/convert/
# http://tagis.dep.wv.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer/project
# https://developers.arcgis.com/javascript/3/jsapi/geometryservice-amd.html
# Projected Coordinate Systems https://developers.arcgis.com/javascript/3/jshelp/pcs.html
#
# https://tasks.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer/
# https://tasks.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer/project?inSR=4326&outSR=104223&geometries=%7B%22geometryType%22%3A%22esriGeometryPoint%22%2C%22geometries%22%3A%5B%7B%22x%22%3A-117%2C%22y%22%3A34%7D%5D%7D&transformation=&transformForward=true&f=json
# Input Spatial Reference:    4326 (GCS_WGS_1984)
# Output Spatial Reference: 104223 (GCS_NAD_1983_CORS96)
# Geometries: {"geometryType":"esriGeometryPoint","geometries":[{"x":-117,"y":34}]}
#
# "Without digging into the details, the datum realizations (such as 104223 vs. 4269) are not mathematically identical,
# but for almost any real-world purpose they are so close it doesn't matter. What does matter is that the grid point
# spacing of the 1/3 arc-second data is about 10 meters, and this relatively low resolution elevation interpolation
# -- and other uncertainties inherent in the capture of these data -- overcomes the differences in the datum math models
# by at least two to three orders of magnitude.  See FAQ https://www2.usgs.gov/faq/categories/9865/3624 for more
# discussion on elevation accuracy of the EPQS"..."If you are attempting to improve the positional accuracy of the data,
# then yes, this conversion is unnecessary. Changes in positions will be small relative to the point spacing, and change
# in actual overall accuracy will be insignificant. But it doesn't do any harm, either, and sometimes conversions like
# this are desirable for other reasons...achieving consistency in metadata, or making data friendlier to particular
# software processes, for example." -- USGS TNM Service Desk
#
# ########################################################################################################################
__author__  = ["Robert James Liguori (HAI/Gliesian", "Lana Manovych (ATAC)"]
__script__  = "elevation2Agl.py"
__version__ = "0.1.10 03-27-17"
__since__   = "0.1.0  02-10-16"
__status__  = "Deployment"

import requests
import json

#######################
# USER INPUT (WGS 1984)
######################
referenceElevation = 1660
msg84_lon = str(-74.5659708)
msg84_lat = str(39.4505594)

#######################################################################################
# Convert from WGS84 to North American Datum 1983 (NAD83) using arcgis geometry service
# (REF: https://nationalmap.gov/epqs/)
#######################################################################################
INPUT_DATUM  = "GCS_WGS_1984:4326"
TARGET_DATUM = "GCS_NAD_1983_CORS96:104223"
payload = {'inSR': INPUT_DATUM.split(":")[1],
                          'outSR': TARGET_DATUM.split(":")[1],
                          'geometries': json.dumps({'geometryType': 'esriGeometryPoint', 'geometries': [{'x':msg84_lon,'y': msg84_lat }]}),
                          'transformation': '',
                          'transformForward': 'true',
                          'f': 'json'}
r = requests.put('https://tasks.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer/project',
                  params=payload)
data = json.loads (r.text)

for rows in data["geometries"]:
    nad83_lon = str(rows['x'])
    nad83_lat = str(rows['y'])

###############
# DETERMINE AGL
###############

# Ground level altitude/elevation above mean sea level
# e.g. http://nationalmap.gov/epqs/pqs.php?x=-74.5659708&y=39.4505594&units=Feet&output=xml
line = requests.get('http://nationalmap.gov/epqs/pqs.php?x=' + nad83_lon + '&y=' + nad83_lat + '&units=Feet&output=xml')
if line == -1000000:
    exit ("service unable to find data at the requested point")
groundLevelAltitude = (str(line.content).split('Elevation>'))[1].split('<')[0]

# Rotorcraft's absolute altitude above ground level (AGL)
absoluteAltitude = referenceElevation - float(groundLevelAltitude)

###################
# PRINT CALCULATION
###################
print("\nDetermining AGL (elevation2agl.py)...")

print("\nExample Inputs...")
print(" WGS_1984 location                              : " + msg84_lon +"," + msg84_lat)
print(" Provided reference elevation (WGS_1984 MSL)    : " + str(referenceElevation) + " feet above MSL")

print("\nGround level calculations...")
print("  NAD_1983 location (used w/ ground level query): " + nad83_lon +"," + nad83_lat)
print("  Gathered ground level altitude                : " + str(groundLevelAltitude) + " feet above MSL")

print("\nAGL Calculations...")
print("  Absolute altitude - above ground level (AGL)  : " + str(absoluteAltitude) + " feet above ground")

Sunday, March 26, 2017

#oreodunksweepstakes with the Oreo Cookie Copter

Just entered the Oreo Dunk Sweepstakes with the Oreo Cookie Copter.



Determining the DRY AIR GAS CONSTANT

Based on samplings of the earths atmosphere, the primary gases are the following:


  • Nitrogen - 78%
  • Oxygen - 21 %
  • Argon - .9 %
  • Carbon Dioxide .04 %




But that's not it, there are several trace elements in air that include neon, helium, methane, krypton, hydrogen, xenon, nitrous oxide, ozone, iodine, carbon monoxide and ammonia.

Each of the gases listed above have a moleculor mass as shown in the following Java code:

private static final double H2_MOLECULAR_MASS = 2.01588; // kg/kmol
private static final double HE_MOLECULAR_MASS = 4.002602; // kg/kmol
private static final double N2_MOLECULAR_MASS = 28.0134; // kg/kmol 
private static final double O2_MOLECULAR_MASS = 31.9988; // kg/kmol
private static final double NE_MOLECULAR_MASS = 20.1797; // kg/kmol
private static final double AR_MOLECULAR_MASS = 39.948; // kg/kmol
private static final double KR_MOLECULAR_MASS = 83.798; // kg/kmol
private static final double I2_MOLECULAR_MASS = 253.80894; // kg/kmol
private static final double XE_MOLECULAR_MASS = 131.293; // kg/kmol
private static final double CO2_MOLECULAR_MASS = 44.0095; // kg/kmol
private static final double CH4_MOLECULAR_MASS = 16.04246; // kg/kmol
private static final double N2O_MOLECULAR_MASS = 44.0128; // kg/kmol
private static final double OE_MOLECULAR_MASS = 47.9982; // kg/kmol
private static final double CO_MOLECULAR_MASS = 28.0101; // kg/kmol
private static final double NH3_MOLECULAR_MASS = 17.03052; // kg/kmol


Determining the Dry Air Gas Constant


Since we have the volume ratio and molecular mass of each gas component of air, we can multiple them together to get the molecular mass in the air for each gas.  And then with the total value, we can divide it into the universal gas constant (8314.32) to get the dry air gas constant.  The following air sample is from professor Shakhashiri chemical of the week newsletter and the table format is from the Engineering Toolbox's article on molecular mass.



Components
in Dry Air
Volume Ratio
compared to Dry Air
Molecular Mass -
M(kg/kmol)
Molecular
Mass in Air
nitrogen (N2) .7808 28.0134 21.87286272
oxygen (O2) .2095 31.9988 6.7037486
argon (AR) .0093 39.948 0.37151639999999997
carbon dioxide
(CO2)
.00033 44.0095 0.014523135000000001
neon (NE) .000018 20.1797 3.6323460000000003E-4
helium (HE) .0000052 4.002602 2.0813530400000002E-5
methane (CH4) .000002 16.04246 3.2084919999999996E-5
krypton (KR) .0000011 83.798 9.217780000000001E-5
hydrogen (H2) .0000005 2.01588 1.00794E-6
xenon (XE) .000000087 131.293 1.1422491E-5
nitrous oxide (N2) .0000005 44.0128 2.20064E-5
ozone (OE) .00000001 47.9982 4.79982E-7
iodine (I2) 0 253.80894 0.0
carbon monoxide
(CO) 
0 28.0101 0.0
ammonia (NH3) 0 16.04246 0.0
Total: 28.963194082663403


Now in three java statements... let's get the dry air gas constant!!!


private static final double UNIVERSAL_GAS_CONSTANT = 8314.32;  

private static final double MOLECULAR_WEIGHT_OF_DRY_AIR = 28.963194082663403

private static final double DRY_AIR_GAS_CONSTANT = (UNIVERSAL_GAS_CONSTANT / MOLECULAR_WEIGHT_OF_DRY_AIR);  

==> DRY_AIR_GAS_CONSTANT NOW EQUALS: 287.065

=====================================================
=====================================================
=====================================================

Want to try it yourself?  Use the following Java code taken from JAirDensity:

/*
 * JAirDensity 
 * Copyright (C) 2017 Robert James Liguori
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.gliesian.jairdensity;

//Reference: http://www.engineeringtoolbox.com/molecular-mass-air-d_679.html
public class DryAir {

    // ATOMIC MASSES http://www.convertunits.com/molarmass/
    private static final double H2_MOLECULAR_MASS = 2.01588; // 1
    private static final double HE_MOLECULAR_MASS = 4.002602; // 2
    private static final double N2_MOLECULAR_MASS = 28.0134; // 7 
    private static final double O2_MOLECULAR_MASS = 31.9988; //8
    private static final double NE_MOLECULAR_MASS = 20.1797; // 10
    private static final double AR_MOLECULAR_MASS = 39.948; // 18
    private static final double KR_MOLECULAR_MASS = 83.798; // 36
    private static final double I2_MOLECULAR_MASS = 253.80894; // 53
    private static final double XE_MOLECULAR_MASS = 131.293; // 54
    private static final double CO2_MOLECULAR_MASS = 44.0095;
    private static final double CH4_MOLECULAR_MASS = 16.04246;
    private static final double N2O_MOLECULAR_MASS = 44.0128;
    private static final double OE_MOLECULAR_MASS = 47.9982;
    private static final double CO_MOLECULAR_MASS = 28.0101;
    private static final double NH3_MOLECULAR_MASS = 17.03052;

    /// PPM * 
    // three major constituents of air
    private double nitrogen = 0; // N2
    private double oxygen = 0;   // O2
    private double argon = 0;    // Ar

    // Water vapor accounts for roughly 0.25% of the atmosphere by mass
    // Trace gases
    private double carbonDioxide = 0;  //CO2
    private double neon = 0;  // Ne 
    private double helium = 0; // He
    private double methane = 0; // CH4

    // Very Trace Gases
    private double krypton = 0; // Kr
    private double hydrogen = 0; // H2
    private double xenon = 0; // Xe
    private double nitrousOxide = 0;   // N2O
    private double ozone = 0;   // Oe
    private double iodine = 0;   // I2
    private double ammonia = 0;   // CO
    private double carbonMonoxide = 0;   // NH3

    public DryAir() {
        // Default Dataset
        this.useChemWiscEduDryAirDataset();
        //this.useThoughtCoDataset();
        //this.useWikipediaDryAirDataset();
    }

    // Allow user to setup there own air
    public DryAir(double nitrogenM, double oxygenM, double argonM, double carbonDioxideM, double neonM, double heliumM, double methaneM, double kryptonM, double hydrogenM, double xenonM, double nitrousOxideM, double ozoneM, double iodineM, double carbonMonoxideM, double ammoniaM) {

        /// PPM * 
        // three major constituents of air
        this.nitrogen = nitrogenM * N2_MOLECULAR_MASS; // N2
        this.oxygen = oxygenM * O2_MOLECULAR_MASS;   // O2
        this.argon = argonM * AR_MOLECULAR_MASS;  // Ar

        // Water vapor accounts for roughly 0.25% of the atmosphere by mass
        // Trace gases
        this.carbonDioxide = carbonDioxideM * CO2_MOLECULAR_MASS;  //CO2
        this.neon = neonM * NE_MOLECULAR_MASS;  // Ne 
        this.helium = heliumM * HE_MOLECULAR_MASS; // He
        this.methane = methaneM * CH4_MOLECULAR_MASS; // CH4

        // Very Trace Gases
        this.krypton = kryptonM * KR_MOLECULAR_MASS; // Kr
        this.hydrogen = hydrogenM * H2_MOLECULAR_MASS; // H2
        this.xenon = xenonM * XE_MOLECULAR_MASS; // Xe
        this.nitrousOxide = nitrousOxideM * N2O_MOLECULAR_MASS;   // H2
        this.ozone = ozoneM * OE_MOLECULAR_MASS;   // Oe
        this.iodine = iodineM * I2_MOLECULAR_MASS;   // I2
        this.carbonMonoxide = carbonMonoxideM * CO_MOLECULAR_MASS;   // CO
        this.ammonia = ammoniaM * NH3_MOLECULAR_MASS;   // NH3

    }

    // https://en.wikipedia.org/wiki/Atmosphere_of_Earth
    public void useWikipediaDryAirDataset() {
        /// PPM * 
        // three major constituents of air
        this.nitrogen = .780840 * N2_MOLECULAR_MASS; // N2
        this.oxygen = .209460 * O2_MOLECULAR_MASS;   // O2
        this.argon = .009340 * AR_MOLECULAR_MASS;  // Ar

        // Water vapor accounts for roughly 0.25% of the atmosphere by mass
        // Trace gases
        this.carbonDioxide = .00040000 * CO2_MOLECULAR_MASS;  //CO2
        this.neon = .00001818 * NE_MOLECULAR_MASS;  // Ne 
        this.helium = .00000524 * HE_MOLECULAR_MASS; // He
        this.methane = .00000179 * CH4_MOLECULAR_MASS; // CH4

        // Very Trace Gases
        this.krypton = 0 * KR_MOLECULAR_MASS; // Kr
        this.hydrogen = 0 * H2_MOLECULAR_MASS; // H2
        this.xenon = 0 * XE_MOLECULAR_MASS; // Xe
        this.nitrousOxide = 0 * N2O_MOLECULAR_MASS;   // H2
        this.ozone = 0 * OE_MOLECULAR_MASS;   // Oe
        this.iodine = 0 * I2_MOLECULAR_MASS;   //I2
        this.carbonMonoxide = 0.0 * CO_MOLECULAR_MASS;   // CO
        this.ammonia = 0.0 * NH3_MOLECULAR_MASS;   // NH3
    }

    // http://scifun.chem.wisc.edu/CHEMWEEK/PDF/airgas.pdf
    private void useChemWiscEduDryAirDataset() {
        this.nitrogen = .7808 * N2_MOLECULAR_MASS; // N2
        this.oxygen = .2095 * O2_MOLECULAR_MASS;   // O2
        this.argon = .0093 * AR_MOLECULAR_MASS;  // Ar

        this.carbonDioxide = .00033 * CO2_MOLECULAR_MASS;  //CO2
        this.neon = .000018 * NE_MOLECULAR_MASS;  // Ne 
        this.helium = .0000052 * HE_MOLECULAR_MASS; // He
        this.methane = .000002 * CH4_MOLECULAR_MASS; // CH4

        this.krypton = .0000011 * KR_MOLECULAR_MASS; // Kr
        this.hydrogen = .0000005 * H2_MOLECULAR_MASS; // H2
        this.xenon = .000000087 * XE_MOLECULAR_MASS; // Xe
        this.nitrousOxide = .0000005 * N2O_MOLECULAR_MASS;   // H2
        this.ozone = .00000001 * OE_MOLECULAR_MASS;   // Oe
        this.iodine = 0 * I2_MOLECULAR_MASS;   // I2
        this.carbonMonoxide = 0.0 * CO_MOLECULAR_MASS;   // CO
        this.ammonia = 0.0 * NH3_MOLECULAR_MASS;   // NH3
    }

    //https://www.thoughtco.com/chemical-composition-of-air-604288
    private void useThoughtCoDataset() {
        this.nitrogen = .78084 * N2_MOLECULAR_MASS; // N2
        this.oxygen = .209476 * O2_MOLECULAR_MASS;   // O2
        this.argon = .00934 * AR_MOLECULAR_MASS;  // Ar

        this.carbonDioxide = .00014 * CO2_MOLECULAR_MASS;  //CO2
        this.neon = .00001818 * NE_MOLECULAR_MASS;  // Ne 
        this.helium = .00000524 * HE_MOLECULAR_MASS; // He
        this.methane = .000002 * CH4_MOLECULAR_MASS; // CH4

        this.krypton = .00000114 * KR_MOLECULAR_MASS; // Kr
        this.hydrogen = .0000005 * H2_MOLECULAR_MASS; // H2
        this.xenon = .000000087 * XE_MOLECULAR_MASS; // Xe
        this.nitrousOxide = .00000002 * N2O_MOLECULAR_MASS;   // H2
        this.ozone = .00000007 * OE_MOLECULAR_MASS;   // Oe
        this.iodine = .00000001 * I2_MOLECULAR_MASS;    // I2
        this.carbonMonoxide = 0.0 * CO_MOLECULAR_MASS;   // CO
        this.ammonia = 0.0 * NH3_MOLECULAR_MASS;   // NH3
    }

    /**
     * @return the ammonia
     */
    public double getAmmonia() {
        return ammonia;
    }

    /**
     * @param aAmmonia the ammonia to set
     */
    public void setAmmonia(double aAmmonia) {
        ammonia = aAmmonia;
    }

    /**
     * @return the carbonMonoxide
     */
    public double getCarbonMonoxide() {
        return carbonMonoxide;
    }

    /**
     * @param aCarbonMonoxide the carbonMonoxide to set
     */
    public void setCarbonMonoxide(double aCarbonMonoxide) {
        carbonMonoxide = aCarbonMonoxide;
    }

    /**
     * @return the iodine
     */
    public double getIodine() {
        return iodine;
    }

    /**
     * @param aIodine the iodine to set
     */
    public void setIodine(double aIodine) {
        iodine = aIodine;
    }

    /**
     * @return the nitrogen
     */
    public double getNitrogen() {
        return nitrogen;
    }

    /**
     * @param aNitrogen the nitrogen to set
     */
    public void setNitrogen(double aNitrogen) {
        nitrogen = aNitrogen;
    }

    /**
     * @return the oxygen
     */
    public double getOxygen() {
        return oxygen;
    }

    /**
     * @param aOxygen the oxygen to set
     */
    public void setOxygen(double aOxygen) {
        oxygen = aOxygen;
    }

    /**
     * @return the argon
     */
    public double getArgon() {
        return argon;
    }

    /**
     * @param aArgon the argon to set
     */
    public void setArgon(double aArgon) {
        argon = aArgon;
    }

    /**
     * @return the carbonDioxide
     */
    public double getCarbonDioxide() {
        return carbonDioxide;
    }

    /**
     * @param aCarbonDioxide the carbonDioxide to set
     */
    public void setCarbonDioxide(double aCarbonDioxide) {
        carbonDioxide = aCarbonDioxide;
    }

    /**
     * @return the neon
     */
    public double getNeon() {
        return neon;
    }

    /**
     * @param aNeon the neon to set
     */
    public void setNeon(double aNeon) {
        neon = aNeon;
    }

    /**
     * @return the helium
     */
    public double getHelium() {
        return helium;
    }

    /**
     * @param aHelium the helium to set
     */
    public void setHelium(double aHelium) {
        helium = aHelium;
    }

    /**
     * @return the methane
     */
    public double getMethane() {
        return methane;
    }

    /**
     * @param aMethane the methane to set
     */
    public void setMethane(double aMethane) {
        methane = aMethane;
    }

    /**
     * @return the krypton
     */
    public double getKrypton() {
        return krypton;
    }

    /**
     * @param aKrypton the krypton to set
     */
    public void setKrypton(double aKrypton) {
        krypton = aKrypton;
    }

    /**
     * @return the hydrogen
     */
    public double getHydrogen() {
        return hydrogen;
    }

    /**
     * @param aHydrogen the hydrogen to set
     */
    public void setHydrogen(double aHydrogen) {
        hydrogen = aHydrogen;
    }

    /**
     * @return the xenon
     */
    public double getXenon() {
        return xenon;
    }

    /**
     * @param aXenon the xenon to set
     */
    public void setXenon(double aXenon) {
        xenon = aXenon;
    }

    /**
     * @return the nitrousOxide
     */
    public double getNitrousOxide() {
        return nitrousOxide;
    }

    /**
     * @param aNitrousOxide the nitrousOxide to set
     */
    public void setNitrousOxide(double aNitrousOxide) {
        nitrousOxide = aNitrousOxide;
    }

    /**
     * @return the ozone
     */
    public double getOzone() {
        return ozone;
    }

    /**
     * @param aOzone the ozone to set
     */
    public void setOzone(double aOzone) {
        ozone = aOzone;
    }

    public String toString() {

        return "\nMolecular Mass in Air: " + getMoleculeMassInAir()
                + "\n  nitrogen       " + getNitrogen()
                + "\n  oxygen         " + getOxygen()
                + "\n  argon          " + getArgon()
                + "\n  carbonDioxide  " + getCarbonDioxide()
                + "\n  neon           " + getNeon()
                + "\n  helium         " + getHelium()
                + "\n  methane        " + getMethane()
                + "\n  krypton        " + getKrypton()
                + "\n  hydrogen       " + getHydrogen()
                + "\n  xenon          " + getXenon()
                + "\n  nitrousOxide   " + getNitrousOxide()
                + "\n  ozone          " + getOzone()
                + "\n  iodine         " + getIodine()
                + "\n  carbonMonoxide " + getCarbonMonoxide()
                + "\n  ammonia        " + getAmmonia();
    }

    public double getMoleculeMassInAir() {

        return getOxygen()
                + getNitrogen()
                + getCarbonDioxide()
                + getHydrogen()
                + getArgon()
                + getNeon()
                + getHelium()
                + getKrypton()
                + getMethane()
                + getNitrousOxide()
                + getXenon()
                + getOzone()
                + getIodine();
    }

    public static void main(String[] args) {

        DryAir da = new DryAir();

        da.useWikipediaDryAirDataset();
        System.out.println(da);

        da.useChemWiscEduDryAirDataset();
        System.out.println(da);

        da.useThoughtCoDataset();
        System.out.println(da);

    }

}



Blade 200 S parts

Tonight, I took apart one of my Blade 200 S remote control helicopter. Blade 200 S Remote Control Helicopter Parts With this exerc...