Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LightningStalker committed May 14, 2021
1 parent feb186b commit e5d1bc1
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
24 changes: 24 additions & 0 deletions elcut.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Compile with gcc -Wall -o elcut elcut.c */

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char **argv)
{
if (argc == 4)
{
printf ("%f\n", (atof(argv[1]) - atof(argv[2])) / atof(argv[1]) * atof(argv[3]));
return (0);
}
else
{
puts ("elcut is a resonant antenna tuning aid.");
puts ("elcut finds the length to cut based on the current and desired frequency.");
puts ("output is the length of an ideal cutoff");
puts ("remember the output is theoretical and subtract from it to avoid mistuning.\n");
puts ("Usage: elcut freq_desired freq_current length_current");
puts ("Example: elcut 28.33 25.55 2516");
puts ("Output should be: 246.893046");
return (1);
}
}
58 changes: 58 additions & 0 deletions iloc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* iloc.c -- Air-core coil design program
*
* compile with: cc -Wall -o iloc iloc.c -lm
*
* Copyright (c) 2000, Eddie Kovelan and Sam Goldwasser
* Dvoracek (c)2021
*/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define u 1.2566370621219E-6 // permeability of free space

int main()
{
/*
* L = inductance in microhenries,
* DIA = diameter of coil.
* NOT = Number Of Turns
* A = area of cross section
* TS = turn spacing
* imed = intermediate temp variable
*/

long double L, DIA, A, length, TS, NOT, imed;

printf("\n \
**********************************************************\n \
* This program finds the required number of turns and *\n \
* length for an air-core inductor with specified *\n \
* inductance (uH), radius (mm), and turn spacing (mm). *\n \
* Valid for coils where diameter = length or longer. *\n \
**********************************************************\n");

printf("\nEnter inductance (uH): ");
scanf("%Lf", &L);
printf("Enter diameter of coil (mm): ");
scanf("%Lf", &DIA);
printf("Enter turn spacing (mm per turn): ");
scanf("%Lf", &TS);

/* calculation of NOT (Number Of Turns) */
// first some unit conversion
L = L / 1000000; // H --> µH
DIA = DIA / 1000; // m --> mm
TS = TS / 1000; // m --> mm

// Meet the meat
A = M_PI * powl(DIA / 2, 2);
imed = L * (1 / u) / A;
NOT = imed * TS;
length = NOT * TS * 1000;

//The coil shall be 2.138090 in length (inches) and have 4.209364 turns.
printf("\nThe coil shall be %.1Lf mm in length and have %.1Lf turns.\n\n", length, NOT);
}
24 changes: 24 additions & 0 deletions tankfreq.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Compile with gcc -Wall -o tankfreq tankfreq.c -lm */

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char **argv)
{
if (argc == 3)
{
printf ("%f\n", 1 / (3.14159265358979324 * 2 * sqrt (atof(argv[1]) /
1000000 * atof(argv[2]) / 1000000)));
return (0);
}
else
{
puts ("tankfreq is an LC tank resonance frequency calculator.");
puts ("output is frequency in Hz\n");
puts ("Usage: tankfreq microfarads microhenries");
puts ("Example: tankfreq 3.3 .86207");
puts ("Output should be: 94360.861167");
return (1);
}
}

0 comments on commit e5d1bc1

Please sign in to comment.