Beispiel #1
0
def RCLowPassFilterDetail(request):
    o_Form = RCLowPassForm()
    a_Results = -1
    if request.method == 'POST':
        o_Form = RCLowPassForm(request.POST)
        if o_Form.is_valid():
            o_RCLowPassFilter = RCLowPass(
                s_Resistance=o_Form["s_ResistorValue"].value(),
                s_Capacitance=o_Form["s_CapacitorValue"].value())
            a_Results = [
                o_RCLowPassFilter.f_Resistance,
                o_RCLowPassFilter.f_Capacitance,
                o_RCLowPassFilter.f_CutoffFrequency,
                o_RCLowPassFilter.f_TimeConstant,
                o_RCLowPassFilter.f_DampingCoefficient,
                o_RCLowPassFilter.f_ResonantFrequency,
                o_RCLowPassFilter.s_TransferFunction
            ]

    ctx = {"o_Form": o_Form, "a_Results": a_Results}

    return render(request, "filterdesigner/RCLowPassFilterDetail.html", ctx)
Beispiel #2
0
 def test_correct_transfer_function(self):
     o_TestFilter    = RCLowPass(s_Resistance="440k", s_Capacitance="312n")
     s_Expected      = "7.3/(s+7.3)"
     self.assertEqual(o_TestFilter.s_TransferFunction, s_Expected)
     
Beispiel #3
0
 def test_correct_resonant_frequency(self):
     o_TestFilter    = RCLowPass(s_Resistance="691.5G", s_Capacitance="14")
     f_Expected      = Number(s_Input="0.103p").f_Value
     self.assertEqual(o_TestFilter.f_ResonantFrequency, f_Expected)
Beispiel #4
0
 def test_correct_damping_coefficient(self):
     o_TestFilter    = RCLowPass(s_Resistance="691.5G", s_Capacitance="14")
     f_Expected      = Number(s_Input="0.103p").f_Value
     self.assertEqual(o_TestFilter.f_DampingCoefficient, f_Expected)
Beispiel #5
0
 def test_correct_time_constant(self):
     o_TestFilter    = RCLowPass(s_Resistance="56M", s_Capacitance="15n")
     f_Expected      = 0.84
     self.assertEqual(o_TestFilter.f_TimeConstant, f_Expected)
Beispiel #6
0
 def test_correct_cutoff_frequency(self):
     o_TestFilter    = RCLowPass(s_Resistance="433", s_Capacitance="42.9u")
     f_Expected      = 8.57
     self.assertEqual(o_TestFilter.f_CutoffFrequency, f_Expected)
Beispiel #7
0
 def test_correct_construciton_capacitance(self):
     o_TestFilter    = RCLowPass(s_Resistance="435M", s_Capacitance='1.5m')
     f_Expected      = 0.0015
     self.assertEqual(o_TestFilter.f_Capacitance, f_Expected)
Beispiel #8
0
 def test_correct_construciton_resistance(self):
     o_TestFilter    = RCLowPass(s_Resistance="310.3k", s_Capacitance="34.6u")
     f_Expected      = 310300
     self.assertEqual(o_TestFilter.f_Resistance, f_Expected)