Skip to content

Commit

Permalink
SMC - works fine! First test circuit ok
Browse files Browse the repository at this point in the history
  • Loading branch information
martinspedro committed Jan 23, 2017
1 parent c509d37 commit e17c70d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DC_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# TODO
# change params to **kwargs
# modify classes to support location of label.
#

def example_01(params, ekey, label=True):
# Parameters
V1 = vSource(params['$V_1$'], '$V_1$')
Expand Down
16 changes: 8 additions & 8 deletions ParamSchemDraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def resistanceEng(self):
appending the ohms unit and using the significant number of digits
defined when the object was created
'''
return enginnerNotation(self._resistance, resistor.__UNIT, self._digits)
return engineerNotation(self._resistance, resistor.__UNIT, self._digits)

@property
def label(self):
Expand Down Expand Up @@ -359,7 +359,7 @@ def voltageEng(self):
appending the volts unit and using the significant number of digits
defined when the object was created
'''
return enginnerNotation(self._voltage, vSource.__UNIT, self._digits)
return engineerNotation(self._voltage, vSource.__UNIT, self._digits)

@property
def label(self):
Expand Down Expand Up @@ -448,7 +448,7 @@ def currentEng(self):
appending the volts unit and using the significant number of digits
defined when the object was created
'''
return enginnerNotation(self._current, iSource.__UNIT, self._digits)
return engineerNotation(self._current, iSource.__UNIT, self._digits)

@property
def label(self):
Expand Down Expand Up @@ -486,14 +486,14 @@ def isValidISource(I):
return True
return False

def enginnerNotation(value, units="", p=3):
def engineerNotation(value, units="", p=3):
'''
Formats a number to engineering notation using p significant digits,
appending the given unit after the magnitude prefix
USAGE: enginnerNotation(value, units, p)
enginnerNotation(value, units)
enginnerNotation(value)
USAGE: engineerNotation(value, units, p)
engineerNotation(value, units)
engineerNotation(value)
ARGUMENTS:
value -> value to be formatted to enginnering notation
Expand All @@ -517,7 +517,7 @@ def enginnerNotation(value, units="", p=3):
assert p >= 1 and p <= 16

# Engineering units prefixes and offset to unitary prefix
_PREFIX = ('$p$', '$n$', '$\mu$', '$m$', "", '$K$', '$M$', '$G$')
_PREFIX = ('p', 'n', '\mu', 'm', "", 'K', 'M', 'G')
_UNIT_OFFSET = 4

# Handling negative numbers and zero
Expand Down

0 comments on commit e17c70d

Please sign in to comment.