File:Delta PWM.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file (1,500 × 1,050 pixels, file size: 84 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: Principle of the delta Pulse Width Modulation (PWM).
Date
Source

Own work, using gnuplot, python and scipy

 
This plot was created with Gnuplot by n.
Author Cyril BUTTAY
Permission
(Reusing this file)
as licensed
Other versions
File:Delta PWM.svg is a vector version of this file. It should be used in place of this PNG file when not inferior.

File:Delta PWM.png → File:Delta PWM.svg

For more information, see Help:SVG.

In other languages
Alemannisch  Bahasa Indonesia  Bahasa Melayu  British English  català  čeština  dansk  Deutsch  eesti  English  español  Esperanto  euskara  français  Frysk  galego  hrvatski  Ido  italiano  lietuvių  magyar  Nederlands  norsk bokmål  norsk nynorsk  occitan  Plattdüütsch  polski  português  português do Brasil  română  Scots  sicilianu  slovenčina  slovenščina  suomi  svenska  Tiếng Việt  Türkçe  vèneto  Ελληνικά  беларуская (тарашкевіца)  български  македонски  нохчийн  русский  српски / srpski  татарча/tatarça  українська  ქართული  հայերեն  বাংলা  தமிழ்  മലയാളം  ไทย  한국어  日本語  简体中文  繁體中文  עברית  العربية  فارسی  +/−
New SVG image

Licensing

[edit]
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.
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
This licensing tag was added to this file as part of the GFDL licensing update.
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 2.5 Generic, 2.0 Generic and 1.0 Generic license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
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.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current21:37, 25 June 2006Thumbnail for version as of 21:37, 25 June 20061,500 × 1,050 (84 KB)CyrilB~commonswiki (talk | contribs){{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= }}

File usage on other wikis

The following other wikis use this file: