Table of Contents
Smooth Signal Generator
Outputs a waveform whose amplitude and frequency may be changed without causing a discontinuity in the output and may be driven by inputs to the block.
Library
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
qc_open_library('quarc_library/Sources/Signals')Description
The Smooth Signal Generator block outputs a waveform whose amplitude and frequency may be tuned online without causing a discontinuity in the output. For example, if the amplitude is changed while the model is running, this block ensures that the amplitude of the signal will not actually change until the signal crosses zero so that a smooth transition is made from the old amplitude to the new amplitude, without discontinuities. Discontinuities in a command signal, for instance, can cause unnecessary vibrations and other issues that the Smooth Signal Generator block helps to avoid. The block may optionally be configured to output the corresponding "cosine" wave (90° out of phase) as well. Sine, square, sawtooth up, sawtooth down and triangle waves are supported.
The Smooth Signal Generator block can also output vector signals. In this case, it is important to note that changes in each output element will not necessarily be synchronized with each other, in order to maintain smooth transitions in each element of the output signal.
The amplitude and frequency of the waveform may also be driven by external inputs instead of the dialog parameters. This feature is very useful for designing graphical user-interfaces. The amplitude and/or frequency from the user interface would be communicated to the diagram and then fed to a Smooth Signal Generator block.
Note that the Smooth Signal Generator block uses the absolute time when placed inside a Triggered Subsystem or other conditionally-executed subsystem for which a sample time cannot be determined. Use of absolute time can lead to inaccuracies when the model is run for a long time. It does not use absolute time when the sample time is inherited if it can determine the sample time.
Input Ports
This block only has inputs if the Source of signal parameters option is set to External (input ports)
.
amp
The amplitude to use for the output waveform. The input may be a vector, in which case the output of the block will be a vector of the same dimensions.
freq
The frequency to use for the output waveform. The input may be a vector, in which case the output of the block will be a vector of the same dimensions.
Output Ports
This block has a single output port for the waveform. It has an optional second output port for the "cosine" waveform. The second output is enabled by the Output "cosine" waveform parameter.
sin
A waveform with the given amplitude and frequency and no discontinuities when these parameters are changed online.
cos
The corresponding "cosine" waveform (90° out of phase) with the given amplitude and frequency. This output may have discontinuities since it is not possible to produce both output waveforms with no discontinuities when adjusting the amplitude.
Data Type Support
This block only outputs doubles.
Parameters and Dialog Box
Signal type
The type of waveform to generate. Sine, square, sawtooth up, sawtooth down and triangle waveforms are supported.
Source of signal parameters
Whether the amplitude and frequency should be determined by the dialog parameters or external inputs.
If External (input ports)
is selected then the block acquires two input ports for driving the amplitude and frequency,
and the Amplitude and Frequency parameters of the dialog then determine the initial amplitude and frequency only.
Amplitude
The amplitude of the waveform. This parameter may be a vector, in which case the output will be a vector of the same dimensions.
Frequency (Hz)
The frequency of the waveform in Hertz. This parameter may be a vector, in which case the output will be a vector of the same dimensions.
Initial phase (radians)
The initial phase of the waveform in radians. This parameter may be a vector, in which case the output will be a vector of the same dimensions. In general, the phase will change when the amplitude or frequency are tuned online in order to produce a smooth output signal.
Sample time
The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.
A sample time of -1 indicates that the block inherits its sample time. Since this is a source block, only inherent the sample time when it is placed in a conditionally executed subsystem, like a Triggered Subsystem, Enabled Subsystem, Function Call Subsystem or in a referenced model.
To use the fundamental sampling time of the model, set the sample time to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model.
The default sample time is set to qc_get_step_size.
Output "cosine" waveform
Check this option in order to output the "cosine" waveform (90° out of phase) as well.
Targets
Target Name |
Compatible* |
Model Referencing |
Comments |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
Last fully supported in QUARC 2018. |
|
Rapid Simulation (RSIM) Target |
Yes |
Yes |
|
S-Function Target |
No |
N/A |
Old technology. Use model referencing instead. |
Normal simulation |
Yes |
Yes |
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.