title: How to simulate a LIN Slave Node in CANoe
body: <p>I cannot find a comprehensive guide on <em>how to build a Synthetic LIN Slave in a CANoe configuration</em>, so I would like to create one here.</p>
  
  <p><strong>Scenario</strong>: an ECU acts as LIN master and communicates with <em>n</em> LIN slaves. The goal is to be able to add a synthetic slave to the CANoe simulation acting as a replacer for one of the physical slaves. Since there is <a href="https://kb.vector.com/entry/497/" rel="nofollow noreferrer">no way to dynamically activate or de-activate a LIN node</a>, our setup would be of <em>n-1</em> physical slaves and <em>1</em> synthetic slave, plus the Master. Here, Master is under test, and, in particular, we want to assess its ability to react to certain slave responses, by mocking the slave and triggering whatever frame is needed. Let's assume there will be a GUI or something for that, it is not in scope for the question.</p>
  
  <p>I am able to add a new Node to the simulation setup, assign it to the LIN network and, if active, it connects to the red line indicating the simulated bus. An LDF was created and added to the configuration and I know the linFrame ID the node should communicate.</p>
  
  <p>The node is to be simulated via CAPL script. I am stuck on the transmission part:</p>
  
  <pre><code>on ???
  {
      // This is my call: as LIN slave I should output something.
      output(myLinFrame);
  }
  </code></pre>
  
  <p>Where should I add my logic to update and transmit the message?</p>
  
  <p>The basic I tried was to key-bind it, but the output would be on the next associated slot of the LDF, plus it's key-bound.</p>
  
  <pre><code>on key 'A'
  {
      // prepare new content...
      output(myLinFrame);
  }
  </code></pre>
  
  <p>This question relates to an older question of mine regarding <a href="https://stackoverflow.com/q/59249861/2125110">LIN censorship</a>.</p>
  
  <p>Final note: I have very limited slots for CANoe licenses to test whatever code I come up with, so I need to prepare and research in advance.</p>
  
  <p>In this scenario, should I use <code>linUpdateResponse()</code>?</p>