Image:Delta PWM.png

Un article de Wikipédia, l'encyclopédie libre.

Ci-dessous, retrouvez page de description du fichier provenant de Commons.
Description

Principle of the delta Pulse Width Modulation (PWM)

Source

Own work, using gnuplot, python and scipy

Date

25/06/2006

Author

Cyril BUTTAY

Permission
(Reusing this image)

as licensed


[edit] Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation license, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation license".

Aragonés | العربية | Asturianu | Български | বাংলা | ইমার ঠার/বিষ্ণুপ্রিয়া মণিপুরী | Brezhoneg | Bosanski | Català | Cebuano | Česky | Dansk | Deutsch | Ελληνικά | English | Esperanto | Español | Eesti | Euskara | فارسی | Suomi | Français | Gaeilge | Galego | עברית | Hrvatski | Magyar | Bahasa Indonesia | Ido | Íslenska | Italiano | 日本語 | ქართული | ភាសាខ្មែរ | 한국어 | Kurdî / كوردی | Latina | Lëtzebuergesch | Lietuvių | Bahasa Melayu | Nnapulitano | Nederlands | ‪Norsk (nynorsk)‬ | ‪Norsk (bokmål)‬ | Occitan | Polski | Português | Română | Русский | Slovenčina | Slovenščina | Shqip | Српски / Srpski | Svenska | తెలుగు | ไทย | Türkçe | Українська | اردو | Tiếng Việt | Volapük | Yorùbá | ‪中文(中国大陆)‬ | ‪中文(台灣)‬ | +/-

Some rights reserved
Creative Commons Attribution iconCreative Commons Share Alike icon
This file is licensed under the Creative Commons Attribution ShareAlike license versions 2.5, 2.0, and 1.0

العربية | Български | Català | Česky | Dansk | Deutsch | English | Español | Euskara | فارسی | Français | עברית | Italiano | 日本語 | 한국어 | Lietuvių | Nederlands | Polski | Português | Русский | Svenska | தமிழ் | Türkçe | 中文 | 中文 | +/-

You may select the license of your choice.


This file was generated using the following python code (requires the module scipy)

#!/usr/bin/python

#this file generates data and the gnuplot file used for the delta pwm plot
# needs python, scipy and gnuplot (4.0 used)
from scipy import *

freq= 0.05      # frequency of the reference signal
step=1e-2       # calculation time step
hysteresis=0.15 # hysteresis of the delta pwm
current_increase=0.5 # rate of increase (or decrease) in the output current
current_decrease=-0.5

direction=0     # direction=0 when output current increase, 1 otherwise
current=[0]     # this is the current waveform
pwm=[0]         # This vector is the pwm signal
grid=["0"]    # this vector contains the x-values at which the pwm signal
                # changes state
file = open("data.dat","w") # the data file

for i in range(int(1/(freq*step))):
    reference=sin(i*step*freq*2*pi)
    high_limit=reference+hysteresis
    low_limit=reference-hysteresis
    if direction==0:
        if current[i]<high_limit:    #if current is increasing, but we still
                                        #are under the upper limit, carry on
            current.append(current[i]+current_increase*step)
            pwm.append(1)               
        else:                           #else change pwm state
            current.append(current[i]+current_decrease*step)
            direction=1
            grid.append("%s"%(i*step))        #stores the time value at which the 
                                        #pwm changed state  
            pwm.append(0)            
    elif direction==1:                  #if current is decreasing, but we still
                                        #are over the lower limit, carry on
        if current[i]>low_limit:
            current.append(current[i]+current_decrease*step)
            pwm.append(0)           
        else:                           #else change pwm state
            current.append(current[i]+current_increase*step)
            direction=0
            grid.append("%s"%(i*step))        #stores the time value at which the 
                                        #pwm changed state
            pwm.append(1)
    file.write('%s\t%s\t%s\t%s\t%s\t%s\n'%(i*step,pwm[i],current[i],
                                          high_limit,
                                          low_limit,
                                          reference))
file.close()                            # end of data generation

xtics=',"" '.join(grid)                       # creates a string used for the x-tics
file = open("delta.plt","w")                # generates the gnuplot file
file.write("""
# This file is used to generate a plot that explains the 
# principle of the delta pwm

# graph configuration
set terminal postscript eps enhanced "Times-Roman" 24 color solid
set encoding iso_8859_15
unset title
set line style 1 lt 3 lw 3 pt 0 ps 0
set line style 2 lt 2 lw 1 pt 0 ps 0
set line style 3 lt 8 lw 2 pt 0 ps 0
set line style 4 lt 4 lw 3 pt 0 ps 0
set border 15 lt 7 lw 4

set grid xtics ytics
set xlabel ""
set format x ""
set bmargin 0
set tmargin 0
  
set ytics ("0" 0)
set xtics (%s)  

set output "delta.eps"
set multiplot
        set ylabel "Analog signals"
        set origin 0,0.54
        set size 1,0.45
        plot [0:19][-1.2:1.2] "data.dat" using 1:6 ls 3 title 'Reference' w l,\
        '' using 1:4 w l ls 2 title 'Limits',\
        '' using 1:5 w l ls 2 title '',\
        '' using 1:3 w l ls 1 title 'Output'

        set ytics ("0" 0, "1" 1)
        set ylabel "PWM signal"
        set xlabel "Time"
        set origin 0,0.09
        plot [0:19][-0.25:1.25] 'data.dat' using 1:2 ls 4 title '' w l
unset multiplot """ %xtics)
file.close()                            # end of the gnuplot file.

This generates two files, 'data.dat' (data) and 'sigma.plt' (gnuplot source). gnuplot sigma.plt then generates a eps file, which is converted in png using imagemagick.

Historique du fichier

Cliquer sur une date et une heure pour voir le fichier tel qu’il était à ce moment-là

Date et heureDimensionsUtilisateurCommentaire
actuel25 juin 2006 à 23:371 500×1 050 (84 Kio)CyrilB ({{Information |Description=Principle of the delta Pulse Width Modulation (PWM) |Source=Own work, using gnuplot, python and scipy |Date=25/06/2006 |Author=Cyril BUTTAY |Permission=as licensed |other_versions= }})

La page ci-dessous contient cette image :