Compare commits

..

No commits in common. "d6ad53abe2915b5a291b497e9f7fa30a6e121117" and "211a11a2f9b5298a33c7771d3a4ee36ac679201f" have entirely different histories.

3 changed files with 1 additions and 107 deletions

View file

@ -41,12 +41,6 @@ There are also a few VSCodium extensions that will be needed.
My preferred way to manage this tool for multiple projects is using [git](https://git-scm.com/downloads). I will typically clone the entire repo and then work from there.
# Commandline tool
A commandline interface (CLI) is in progress for the purpose of calling individual functions as they are needed during the work day. Over time all functions will be added there, but the re-write for the tables from SQL to arrays needs to be finished first.
For now, ``tools.py`` is there to be used and added to as time allows.
# Limitations
Currently the tools use the CEC, in most cases this will match the NEC, but something we are working on is updating that so we can select from which code version should be used for the calculation.

View file

@ -21,7 +21,7 @@ def va(voltage, current,phases=3):
va = (math.sqrt(3) * voltage * current)
elif phases == 1:
va = voltage * current
vs = voltage * current
else:
print("Phases needs to be 1 or 3 for now.")

100
tools.py
View file

@ -1,100 +0,0 @@
'''
JMK Engineering Inc. Python Library for design and such.
by: Jeff MacKinnon
email: jeff@jmkengineering.com
Commandline tools for JEPL functions
'''
import argparse
import jepl.jepl as jmk
#
# functions for the functions
#
# General
def va(args):
x = [1,3,None]
if args.phases in x:
if args.phases == None:
phases = 3
else:
phases = args.phases
result = jmk.va(args.voltage, args.current, phases=phases)
print ( str(round(result,2))+ "VA")
else:
print(args.phases)
# Solar
def temp_adj_Voc(args):
if args.beta == None:
beta = -0.5
else:
beta = args.beta
if args.stctemp == None:
stctemp = 25
else:
stctemp = args.stctemp
result = jmk.temp_adj_Voc(args.voc, args.temperature, beta, stctemp)
print(str(round(result,2))+"V")
#
# Parse the options
#
try:
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(
title="tools", help="Commandline Functions"
)
#
# This section is for the jepl_general functions
#
# Calcuating VA
va_parser = subparsers.add_parser("va", help="calculate VA (S)")
va_parser.add_argument("voltage", type=float,help="Voltage of the circuit")
va_parser.add_argument("current", type=float,help="Current of the circuit.")
va_parser.add_argument("-p","--phases", type=int,help="Phases of the circuit. It should be either 1 or 3, and we will assume 3 if it is not used.")
va_parser.set_defaults(func=va)
#
# Solar Tools
#
tempvoc = subparsers.add_parser("tempVoc", help="Calculate the temperature adjusted Voc of a PV panel.")
tempvoc.add_argument("voc", type=float,help="Open circuit voltage of the panel.")
tempvoc.add_argument("temperature", type=float, help="Temperature the panel will be at.")
tempvoc.add_argument("-b", "--beta", type=float, help="Panel Beta value, if none is added -0.5 will be used.")
tempvoc.add_argument("-t", "--stctemp", type=float, help="The STC temp. If none is added 25C will be used.")
tempvoc.set_defaults(func=temp_adj_Voc)
# This runs the function that was selected with the arguments in the command.
args = parser.parse_args()
args.func(args)
except argparse.ArgumentError as e:
#log.error("Error parsing arguments")
raise e
#else:
# print(f"Something clever")