Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
1389f003
Commit
1389f003
authored
Aug 02, 2012
by
Mike Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace '$' variable identifier to '{ variable }'
parent
0cfba56d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
0 deletions
+148
-0
cms/djangoapps/capaconverter/__init__.py
+8
-0
cms/djangoapps/capaconverter/problems/CSDamplifier.xml
+140
-0
No files found.
cms/djangoapps/capaconverter/__init__.py
View file @
1389f003
...
@@ -106,18 +106,21 @@ class CapaXMLConverter(object):
...
@@ -106,18 +106,21 @@ class CapaXMLConverter(object):
{
{
'src'
:
'answer'
,
'src'
:
'answer'
,
'dest'
:
'answer'
,
'dest'
:
'answer'
,
'wrapper'
:
self
.
replace_dollar_sign
,
}
}
],
],
'stringresponse'
:
[
'stringresponse'
:
[
{
{
'src'
:
'answer'
,
'src'
:
'answer'
,
'dest'
:
'answer'
,
'dest'
:
'answer'
,
'wrapper'
:
self
.
replace_dollar_sign
,
},
},
],
],
'schematicresponse'
:
[
'schematicresponse'
:
[
{
{
'src'
:
'answer'
,
'src'
:
'answer'
,
'dest'
:
'answer'
,
'dest'
:
'answer'
,
'wrapper'
:
self
.
replace_dollar_sign
,
}
}
],
],
'responseparam'
:
[
'responseparam'
:
[
...
@@ -135,6 +138,11 @@ class CapaXMLConverter(object):
...
@@ -135,6 +138,11 @@ class CapaXMLConverter(object):
}
}
super
(
CapaXMLConverter
,
self
)
.
__init__
()
super
(
CapaXMLConverter
,
self
)
.
__init__
()
def
replace_dollar_sign
(
self
,
text
):
if
text
.
startswith
(
"$"
):
return
"{"
+
text
[
1
:]
+
"}"
return
text
def
build_from_element
(
self
,
element
):
def
build_from_element
(
self
,
element
):
return
self
.
copy_attribute
(
element
,
{
'type'
:
self
.
type_map
[
element
.
tag
],
'_tag_'
:
element
.
tag
})
return
self
.
copy_attribute
(
element
,
{
'type'
:
self
.
type_map
[
element
.
tag
],
'_tag_'
:
element
.
tag
})
...
...
cms/djangoapps/capaconverter/problems/CSDamplifier.xml
0 → 100644
View file @
1389f003
<problem>
<script
type=
"loncapa/python"
>
#VDD = 50.0
#VDD = 150.0
VDD = float(random.randrange(50, 150, 5))
#RL = 82.0
#RL = 120.0
RL = random.choice([82.0, 100.0, 120.0])
RS = 22.0
VI = 6.5
VT=2.0
K=2.0
DELTA = math.sqrt(1+2*K*RS*(VI-VT))
ID = (1+K*RS*(VI-VT)-DELTA)/(K*RS*RS)
VO = VDD - RL*ID
Vup = VDD - VO
vim = 1.0
vi = 0.001*vim
dvodvi = (RL*(1-DELTA))/(RS*DELTA)
vo = dvodvi * vi
vom = 1000.0*vo
dvodvis = "-((d-1)/d)*(RL/RS)"
limitgain = "-RL/RS"
</script>
<startouttext/>
The figure shows a circuit for a voltage amplifier. You will notice
that it is just a slight modification of the Source Follower we have
been studying: we added a resistor in the drain circuit and took our
output from the drain rather than the source.
<center>
<img
src=
"/static/images/circuits/common-source-degeneration.gif"
/>
</center>
Assume that the power supply voltage \(V_{DD} = $VDD\)V, and the
resistances \(R_S=$RS\Omega\) and \(R_L=$RL\Omega\).
Also assume that \(K=$K\)A/V\(^2\) and \(V_T=$VT\)V.
<endouttext/>
<startouttext/>
<br/><br/>
If the bias input voltage \(V_I
<
V_T\) what is the output bias voltage
\(V_O\), in Volts?
<br/>
\(V_O\) =
<endouttext/>
<numericalresponse
answer=
"$VDD"
>
<responseparam
type=
"tolerance"
default=
"5%"
name=
"tol"
description=
"Numerical Tolerance"
/>
<textline/>
</numericalresponse>
<startouttext/>
<br/><br/>
In the rest of this problem assume the input bias voltage \(V_I = $VI\)
<endouttext/>
<startouttext/>
<br/>
What is the bias current \(I_D\), in Amperes?
<br/>
\(I_D\) =
<endouttext/>
<numericalresponse
answer=
"$ID"
>
<responseparam
type=
"tolerance"
default=
"5%"
name=
"tol"
description=
"Numerical Tolerance"
/>
<textline/>
</numericalresponse>
<startouttext/>
<br/>
What is the output bias voltage \(V_O\), in Volts?
<br/>
\(V_O\) =
<endouttext/>
<numericalresponse
answer=
"$VO"
>
<responseparam
type=
"tolerance"
default=
"5%"
name=
"tol"
description=
"Numerical Tolerance"
/>
<textline/>
</numericalresponse>
<startouttext/>
<br/><br/>
Now, let's consider the incremental behavior of this circuit for the
bias conditions you have determined.
<endouttext/>
<startouttext/>
<br/>
What is the small-signal gain of this amplifier \(\frac{v_o}{v_i}\)?
<br/>
\(\frac{v_o}{v_i}\) =
<endouttext/>
<numericalresponse
answer=
"$dvodvi"
>
<responseparam
type=
"tolerance"
default=
"5%"
name=
"tol"
description=
"Numerical Tolerance"
/>
<textline/>
</numericalresponse>
<startouttext/>
<br/>
Now let's do some algebra. To make things a bit easier let's define
<br/><br/>
\(d = \sqrt(1 + 2 K R_s (V_{IN} - V_T))\)
<br/><br/>
In the space provided below write an algebraic expression for the
small-signal gain \(\frac{v_o}{v_i}\) in terms of \(R_L\), \(R_S\),
and \(d\). (Be careful, algebraic expressions can be case sensitive!)
<endouttext/>
<formularesponse
type=
"cs"
samples=
"RL,RS,d@1,1,1:3,3,3#10"
answer=
"$dvodvis"
>
<responseparam
description=
"Numerical Tolerance"
type=
"tolerance"
default=
"0.00001"
name=
"tol"
/>
<textline
size=
"40"
/>
</formularesponse>
<startouttext/>
<br/>
Now, suppose we imagine a transistor with very large \(K\). Of
course, we cannot really make it infinite, but we can consider the
limit as \(K\rightarrow\infty\). What is the small-signal gain in
that limit? Write an algebraic expression here.
<endouttext/>
<formularesponse
type=
"cs"
samples=
"RL,RS,d@1,1,1:3,3#10"
answer=
"$limitgain"
>
<responseparam
description=
"Numerical Tolerance"
type=
"tolerance"
default=
"0.00001"
name=
"tol"
/>
<textline
size=
"40"
/>
</formularesponse>
<startouttext/>
<br/>
You should have gotten a very cool answer here! Think about this carefully.
<endouttext/>
</problem>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment