blockPWM

Compares a sine and a triangular signal. If sine is bigger, the output is vU and vL else.

Extends from ModelicaDEVS.Templates.DSource (DEVS source block).

Information

The PWM Block

Parameters:
as amplitude of sine signal
fs frequency of sine signal
at amplitude of triangular signal
ft frequency of triangular signal
vU upper output value
vL lower output value


Description:

The PWM block generates a pulse width modulation signal defined by the comparison between a sine signal and a triangular signal.

This block is an example demonstrating the possibility to reuse models as blocks within other models: instead of programming the PWM signal explicitly, it is actually an assembly of three other blocks: a Sine source, a Triangular source and a Comparator. The functionality of these three blocks is packed into one block (the PWM block) which can be reused as a component in other models. The interior structure of the PWM block can be found when activating the diagram-view of the PWM block.


Generated Events (QSS1/QSS2/QSS3 mode):


Output is generated each time the two signals (sine/triangular) cross each other. If the sine signal is bigger than the triangular signal, the output takes a value of vU, and vL otherwise.



Parameter setting: fs=1
a=1
at=1
ft=16
vU=1
vL=-1

Parameters

TypeNameDefaultDescription
Integermethod (from DSource)world.qssUse QSS1, QSS2 or QSS3
Realas1Amplitude of sine signal
Realfs1Frequency of sine
Realat1Amplitude of triangular signal
Realft1Frequency of triangular signal
RealvU1Upper Value of PWM signal
RealvL-1Lower Value of PWM signal

Connectors

TypeNameDefaultDescription
ModelicaDEVS.Templates.DiscreteOutPortoutPort (from DSource)

Components

TypeNameDefaultDescription
ModelicaDEVS.Miscellaneous.worldModelworld (from DSource)
TriangularTriangular1
FunctionBlocks.ComparatorComparator1
SineSine1