<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Set device to simulation mode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8cd0412d34/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8cd0412d34/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/8cd0412d34/</id><updated>2020-02-27T14:54:47.663000Z</updated><subtitle>Recent posts to Set device to simulation mode</subtitle><entry><title>Set device to simulation mode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8cd0412d34/?limit=25#a147" rel="alternate"/><published>2020-02-27T14:54:47.663000Z</published><updated>2020-02-27T14:54:47.663000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.com2cbdbd6c772ae7ed62bd386e0eb13052c6c5e2bd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Shabroz.Gill.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Shabroz.Gill hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
I cant find a way to set the device, which my active application belongs to, in simulation mode. How do I get the reference to the interface IScriptDeviceObject for it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Search for the device object by using find() and use the method set_simulation_mode() for setting the simulation mode.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;proj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;primary&lt;/span&gt;
&lt;span class="k"&gt;found&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;proj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"Device"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;found&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;"No or too many devices with the name 'Device' found"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;dev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;found&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_simulation_mode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_simulation_mode&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="k"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;"Simulation not active"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Set device to simulation mode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8cd0412d34/?limit=25#9b1d" rel="alternate"/><published>2020-02-27T14:54:46.066000Z</published><updated>2020-02-27T14:54:46.066000Z</updated><author><name>Shabroz.Gill</name><uri>https://forge.codesys.com/u/shabroz-gill/</uri></author><id>https://forge.codesys.coma9839c0eed79b825c8f1e7c47a878a26fbea21a4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I cant find a way to set the device, which my active application belongs to, in simulation mode. How do I get the reference to the interface IScriptDeviceObject for it.&lt;/p&gt;
&lt;p&gt;Any help is appreciated.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>