Providing Support for Performing Rectifier Experiments in PSLab Android
PSLab can be used to perform Half and Full Wave Rectifier Experiments. A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct current (DC), which flows in only one direction. Half wave rectifiers clip out the negative part of the input waveform. The rectified signal can be further filtered with a capacitor in order to obtain a low ripple DC voltage. Only a diode is needed to clip out the negative part of the input signal. Full wave rectifiers combine the positive halves of 180 degrees out of phase input waveforms such as those output from AC transformers with a center tap. The rectified signal can be further filtered with a capacitor in order to obtain a low ripple DC voltage. Two diodes are used to clip out the negative parts of both inputs and combine them into a single output which is always in the positive region.
In order to support Half Wave Rectifier Experiments in PSLab, we used Oscilloscope Activity. For Half Rectifier Experiment we require to generate a sine wave from W1 channel and read signals from CH1 and CH2.
To implement this we first need to inform the Oscilloscope Activity whether Half Wave Rectifier Experiment needs to be performed or not. For this, we used putExtra and getExtra methods.
Bundle extras = getIntent().getExtras(); if ("Half Rectifier".equals(extras.getString("who"))) { isHalfWaveRectifierExperiment = true; }
Then we programmatically change the layout. The side panel is made disappear and the graph and lower panel of the Oscilloscope expands horizontally.
if (isHalfWaveRectifierExperiment) { linearLayout.setVisibility(View.INVISIBLE); RelativeLayout.LayoutParams lineChartParams = (RelativeLayout.LayoutParams) mChartLayout.getLayoutParams(); lineChartParams.height = height * 5 / 6; lineChartParams.width = width; RelativeLayout.LayoutParams frameLayoutParams = (RelativeLayout.LayoutParams) frameLayout.getLayoutParams(); frameLayoutParams.height = height / 6; frameLayoutParams.width = width; }
The fragment for lower panel is replaced by the fragment designed for Half Wave Rectifier
halfwaveRectifierFragment = new HalfwaveRectifierFragment(); if (isHalfWaveRectifierExperiment) { addFragment(R.id.layout_dock_os2, halfwaveRectifierFragment, "HalfWaveFragment"); }
We get the following layout, ready to perform halfwave rectifier experiment.
For making the graph functional, capturing signals from CH1 and CH2 is required. For this, we reused CaptureTwo AsyncTask in such a way that it captures signals from CH1 and CH2 channels where CH1 is the input signal and CH2 is the output signal.
if (scienceLab.isConnected() && isHalfWaveRectifierExperiment) { captureTask2 = new CaptureTaskTwo(); captureTask2.execute("CH1"); synchronized (lock) { try { lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } }
By following the above steps we reused Oscilloscope Activity to perform Rectifier Experiments.
You must be logged in to post a comment.