| Standard Distortion Signal Generator(SDSG)is a kind of testing equipment which is widely used in the development,production,verification and maintenance of measuring instruments.The traditional SDSG adopts the direct analog signal synthesis method,which has low accuracy of output frequency and low coverage of frequency point.At present,most of the domestic SDSG products show parameters by digital display,while the related instruments produced abroad are expensive and the software is closed-source.Considering the current situation of SDSG in China,this paper presents a software design of SDSG with low background distortion and friendly man-machine interface,which can generate point frequency signal and distortion signal based on Direct Digital Frequency Synthesis(DDFS)technology.Among them,the waveform point data of the distortion signal is consist of the fundamental wave,the second and the third harmonics.The main contents of this paper are as follows:1)The display and control software of SDSG is designed and implemented,including a friendly man-machine interface and an accurate driver of transimitting data.The interface mainly adopts MVP and MVVM design patterns,which reduces the software program coupling and improves the code testability and reusability.The driver adopts the layered design scheme,which reduces the dependence between layers.And the driver abstracts the general bus I/O interface,which improves the compatibility of various bus protocols.At the same time,the digital synthesis of waveform data and the calculation of register values such as frequency and amplitude adjustment are also realized in the driver.2)In view of the uncertainty of the peak value of the distortion signal and the demand of the adjustment range of the distortion,this paper proposes a software optimization scheme for the digital synthesis of the distortion signal.The scheme includes the introduction of an amplitude scale factor based on the proportional relationship between the fundamental wave and the harmonic peak,and the phase difference between the fundamental wave and each harmonic —— 0 °,by theoretical derivation and simulation verification.At last,the peak value of the distortion signal can not exceed the reference voltage of the DAC,and the validity of the vertical resolution of the DAC is greatly improved.3)In order to meet the demand of low background distortion,the software needs to suppress the low order harmonics effectively.In this paper,the method of harmonic cancellation is used.Before the waveform data is sent to the DAC,the pre compensated harmonic signal is used to cancel the original harmonic,so as to effectively reduce the background distortion.The simulation results show that the low order harmonic can be controlled below-110 dB by this method.4)The implementation of the software adopts Test Driven Development(TDD),which effectively improves the code testability.This paper presents the test cases of the main logic of the software and the test results which is all passed successfully,which verify the correctness and usability of the software program.In addition,the whole machine tests of SDSG show that all parameter indices have been achieved,and the required functions have been realized. |