<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Simulasi Archives - Colekmes</title>
	<atom:link href="https://colekmes.com/tag/simulasi/feed/" rel="self" type="application/rss+xml" />
	<link>https://colekmes.com/tag/simulasi/</link>
	<description>Catatan Engineer Cupu</description>
	<lastBuildDate>Tue, 18 Feb 2020 11:40:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.13</generator>

<image>
	<url>https://colekmes.com/wp-content/uploads/2019/08/cropped-ColekmesLogo-32x32.png</url>
	<title>Simulasi Archives - Colekmes</title>
	<link>https://colekmes.com/tag/simulasi/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Simulasi Motor BLDC dengan Python</title>
		<link>https://colekmes.com/2020/02/simulasi-motor-bldc-dengan-python/</link>
					<comments>https://colekmes.com/2020/02/simulasi-motor-bldc-dengan-python/?noamp=mobile#comments</comments>
		
		<dc:creator><![CDATA[colekmes]]></dc:creator>
		<pubDate>Tue, 18 Feb 2020 11:40:01 +0000</pubDate>
				<category><![CDATA[Kontroler Motor dan Inverter]]></category>
		<category><![CDATA[Motor Listrik]]></category>
		<category><![CDATA[Perangkat Elektrik]]></category>
		<category><![CDATA[Post]]></category>
		<category><![CDATA[BLDC Motor]]></category>
		<category><![CDATA[Mobil Listrik]]></category>
		<category><![CDATA[Motor Controller]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Simulasi]]></category>
		<guid isPermaLink="false">https://colekmes.com/?p=684</guid>

					<description><![CDATA[<p>Dengan mengetahui karakteristik dari Motor BLDC, kita dapat membuat simulasinya dengan variabel-variabel yang kita inginkan. Hal ini sangat berguna untuk mengetahui respon dari BLDC motor jika mengubah beberapa variabel tanpa&#8230;</p>
<p>The post <a href="https://colekmes.com/2020/02/simulasi-motor-bldc-dengan-python/">Simulasi Motor BLDC dengan Python</a> appeared first on <a href="https://colekmes.com">Colekmes</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Dengan mengetahui karakteristik dari Motor BLDC, kita dapat membuat simulasinya dengan variabel-variabel yang kita inginkan. Hal ini sangat berguna untuk mengetahui respon dari BLDC motor jika mengubah beberapa variabel tanpa perlu melakukan <em>trial and error</em> pada perangkat kerasnya. Oleh karena itu, penulis mencoba malakukan simulasi Motor BLDC dengan Python.</p>



<p>Kalau belum mengetahui apa itu motor BLDC, bisa membaca terlebih dahulu artikelnya <a href="https://colekmes.com/2020/01/bldc-motor-dan-kontrolernya/">disini</a>. Kemudian untuk mengetahui lebih dalam, tentang Motor BLDC beserta kontrollernya bisa mengakses pada tulisan Stefan Baldursson <a href="https://drive.google.com/open?id=1IKmORXTh0EvGE7kNiDUUCfM-mIgw0F4X">disini</a>. Simulasi dengan Python menjadi pilihan karena <em>cukup</em> mudah digunakan dan banyak referensinya.</p>



<p>Simulasi ini dapat diakses pada <a href="https://github.com/zharfanw/open-bldc-pysim">repository ini</a>. Program tersebut merupakan hasil forked dari repo sebelumnya(dituliskan pada README repository) yang menggunakan Python 2.6, kemudian diupgrade sedikit pada repository ini dengan menggunakan Python3 (Penulis menggunakan Python 3.6). Selain itu simulasi juga memerlukan package numpy, dan scipy yang telah telah terpasang. Untuk cara memasangnya bisa dilihat <a href="https://www.scipy.org/install.html">disini</a>. </p>



<p>Untuk melakukan simulasi bisa clone atau download <a href="https://github.com/zharfanw/open-bldc-pysim">reponya</a>.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell line-numbers">git clone https://github.com/zharfanw/open-bldc-pysim
</code></pre>



<p>Selanjutnya, jalan program sim_1.py</p>



<pre title="sim_1.py" class="wp-block-code" style="overflow-y:scroll;max-height:400px;"><code lang="python" class="language-python line-numbers">#
# Open-BLDC pysim - Open BrushLess DC Motor Controller python simulator
# Copyright (C) 2011 by Antoine Drouin &lt;poinix@gmail.com>
# Copyright (C) 2011 by Piotr Esden-Tempski &lt;piotr@esden.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see &lt;http://www.gnu.org/licenses/>.
#

import matplotlib
# matplotlib.use('MacOSX')
# matplotlib.use('GTKCairo')
import numpy as np
import pylab as pl
import matplotlib.pyplot as plt
from scipy import integrate
from scipy.signal import decimate

import misc_utils as mu
import dyn_model  as dm
import control    as ctl
import my_io      as mio
import my_plot    as mp



def display_state_and_command(time, X, U):

    titles_state = ['$\\theta$', '$\omega$', '$i_u$', '$i_v$', '$i_w$']
    titles_cmd = ['$u_l$', '$u_h$', '$v_l$', '$v_h$', '$w_l$', '$w_h$']
    for i in range(0, 2):
        plt.subplot(6, 2, 2*i+1)
        plt.plot(time,mu.deg_of_rad(X[:,i]), 'r', linewidth=3.0)
        plt.title(titles_state[i])
    for i in range(2, dm.sv_size):
        plt.subplot(6, 2, 2*i+1)
        plt.plot(time, X[:,i], 'r', linewidth=3.0)
        plt.title(titles_state[i])
    for i in range(0, 6):
        plt.subplot(6, 2, 2*i+2)
        plt.plot(time, U[:,i], 'r', linewidth=3.0)
        plt.title(titles_cmd[i])

def print_simulation_progress(count, steps):
        sim_perc_last = ((count-1)*100) / steps
        sim_perc = (count*100) / steps
        if (sim_perc_last != sim_perc):
            print ("{}%".format(sim_perc))

def drop_it(a, factor):
	new = []
	for n, x in enumerate(a):
		if ((n % factor) == 0):
			new.append(x)
	return np.array(new)

def compress(a, factor):
	return drop_it(a, factor)
	#return decimate(a, 8, n=8, axis=0)

def main():
#    t_psim, Y_psim =  mio.read_csv('bldc_startup_psim_1us_resolution.csv')
#    mp.plot_output(t_psim, Y_psim, '.')

    freq_sim = 1e6                              # simulation frequency
    compress_factor = 3
    time = pl.arange(0.0, 0.1, 1/freq_sim) # create time slice vector
    X = np.zeros((time.size, dm.sv_size))       # allocate state vector
    Xdebug = np.zeros((time.size, dm.dv_size))  # allocate debug data vector
    Y = np.zeros((time.size, dm.ov_size))       # allocate output vector
    U = np.zeros((time.size, dm.iv_size))       # allocate input vector
    X0 = [0, mu.rad_of_deg(0.1), 0, 0, 0]       #
    X[0,:] = X0
    W = [0, 1]
    for i in range(1,time.size):

        if i==1:
            Uim2 = np.zeros(dm.iv_size)
        else:
            Uim2 = U[i-2,:]

        Y[i-1,:] = dm.output(X[i-1,:], Uim2)                  # get the output for the last step
        U[i-1,:] = ctl.run(0, Y[i-1,:], time[i-1])            # run the controller for the last step
        tmp = integrate.odeint(dm.dyn, X[i-1,:], [time[i-1], time[i]], args=(U[i-1,:], W)) # integrate
        X[i,:] = tmp[1,:] # copy integration output to the current step
        X[i, dm.sv_theta] = mu.norm_angle( X[i, dm.sv_theta]) # normalize the angle in the state
        tmp, Xdebug[i,:] = dm.dyn_debug(X[i-1,:], time[i-1], U[i-1,:], W) # get debug data
        print_simulation_progress(i, time.size)

    Y[-1,:] = Y[-2,:]
    U[-1,:] = U[-2,:]

    if compress_factor > 1:
        time = compress(time, compress_factor)
        Y = compress(Y, compress_factor)
        X = compress(X, compress_factor)
        U = compress(U, compress_factor)
        Xdebug = compress(Xdebug, compress_factor)

    mp.plot_output(time, Y, '-')
#    pl.show()
    plt.figure(figsize=(10.24, 5.12))
    display_state_and_command(time, X, U)

    plt.figure(figsize=(10.24, 5.12))
    mp.plot_debug(time, Xdebug)

    pl.show()

if __name__ == "__main__":
    main()</code></pre>



<p>dan hasilnya adalah sebagai berikut</p>


<div id="pl-gb684-6accb8e9c1831"  class="panel-layout" ><div id="pg-gb684-6accb8e9c1831-0"  class="panel-grid panel-no-style" ><div id="pgc-gb684-6accb8e9c1831-0-0"  class="panel-grid-cell" ><div id="panel-gb684-6accb8e9c1831-0-0-0" class="so-panel widget widget_sow-slider panel-first-child panel-last-child" data-index="0" ><div
			
			class="so-widget-sow-slider so-widget-sow-slider-default-89935f566f6f-684"
			
		>				<div class="sow-slider-base" style="display: none" tabindex="0">
					<ul
					class="sow-slider-images"
					data-settings="{&quot;pagination&quot;:true,&quot;speed&quot;:800,&quot;timeout&quot;:8000,&quot;paused&quot;:false,&quot;pause_on_hover&quot;:false,&quot;swipe&quot;:true,&quot;nav_always_show_desktop&quot;:&quot;&quot;,&quot;nav_always_show_mobile&quot;:&quot;&quot;,&quot;breakpoint&quot;:&quot;780px&quot;,&quot;unmute&quot;:false,&quot;anchor&quot;:null}"
										data-anchor-id=""
				>		<li class="sow-slider-image  sow-slider-image-cover" style="visibility: visible;;background-image: url(https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_1.png)" >
						<img fetchpriority="high" decoding="async" width="1024" height="512" src="https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_1.png" class="sow-slider-background-image" alt="" style="" srcset="https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_1.png 1024w, https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_1-300x150.png 300w, https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_1-768x384.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" />		</li>
				<li class="sow-slider-image  sow-slider-image-cover" style="visibility: hidden;" data-background="url(https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_2.png)" >
						<img decoding="async" width="650" height="643" src="https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_2.png" class="sow-slider-background-image" alt="" style="" srcset="https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_2.png 650w, https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_2-300x297.png 300w" sizes="(max-width: 650px) 100vw, 650px" />		</li>
				<li class="sow-slider-image  sow-slider-image-cover" style="visibility: hidden;" data-background="url(https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_3.png)" >
						<img decoding="async" width="640" height="480" src="https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_3.png" class="sow-slider-background-image" alt="" style="" srcset="https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_3.png 640w, https://colekmes.com/wp-content/uploads/2020/02/GambarSimulasi_3-300x225.png 300w" sizes="(max-width: 640px) 100vw, 640px" />		</li>
		</ul>				<ol class="sow-slider-pagination">
											<li><a href="#" data-goto="0" aria-label="display slide 1"></a></li>
											<li><a href="#" data-goto="1" aria-label="display slide 2"></a></li>
											<li><a href="#" data-goto="2" aria-label="display slide 3"></a></li>
									</ol>

				<div class="sow-slide-nav sow-slide-nav-next">
					<a href="#" data-goto="next" aria-label="next slide" data-action="next">
						<em class="sow-sld-icon-thick-right"></em>
					</a>
				</div>

				<div class="sow-slide-nav sow-slide-nav-prev">
					<a href="#" data-goto="previous" aria-label="previous slide" data-action="prev">
						<em class="sow-sld-icon-thick-left"></em>
					</a>
				</div>
				</div></div></div></div></div></div>


<p>Dengan adanya simulasi ini, semoga dapat bermanfaat.</p>
<p>The post <a href="https://colekmes.com/2020/02/simulasi-motor-bldc-dengan-python/">Simulasi Motor BLDC dengan Python</a> appeared first on <a href="https://colekmes.com">Colekmes</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://colekmes.com/2020/02/simulasi-motor-bldc-dengan-python/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Object Caching 0/285 objects using Memcache
Page Caching using Disk: Enhanced 
Database Caching using Redis

Served from: colekmes.com @ 2026-10-12 17:39:37 by W3 Total Cache
-->