<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Where to set parameters of a device in a function block?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a052954b32/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a052954b32/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/a052954b32/</id><updated>2022-03-30T11:48:51.596000Z</updated><subtitle>Recent posts to Where to set parameters of a device in a function block?</subtitle><entry><title>Where to set parameters of a device in a function block?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a052954b32/?limit=25#eff8" rel="alternate"/><published>2022-03-30T11:48:51.596000Z</published><updated>2022-03-30T11:48:51.596000Z</updated><author><name>fajean</name><uri>https://forge.codesys.com/u/fajean/</uri></author><id>https://forge.codesys.com7807f0ee9ab52cce052978c6e031c44616930ed4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;FB_Init is itself a method, you can call fbControllerOne's FB_Init from within FB_TemperatureController's own FB_Init and supply it with the appropriate values along with the additional standard arguments FB_Init has but are not visible in variable declarations.  Please note that this means fbControllerOne's FB_Init would be called twice, but due to the order of execution, your "manual" call would be performed last.&lt;/p&gt;
&lt;p&gt;You could also, as you hint to, create a method to set the limits and call that method from FB_TemperatureController's FB_Init.  You could chose to call it from the application that uses the function block too, if limits are application-specific.&lt;/p&gt;
&lt;p&gt;In that latter case, i.e. if FB_TemperatureController itself needs to be configurable for each application, it could receive the settings as arguments to FB_Init (which would be relayed to fbControllerOne using its FB_Init or a method) or be initialized through a method in FB_TemperatureController that in turn calls a method on fbControllerOne.&lt;/p&gt;
&lt;p&gt;You could certainly come up with other initialization strategies.  Which design is best is going to be dependent on your intended uses, the structure of your existing code, etc.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Where to set parameters of a device in a function block?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a052954b32/?limit=25#0c08" rel="alternate"/><published>2022-03-30T07:20:37.457000Z</published><updated>2022-03-30T07:20:37.457000Z</updated><author><name>flaviom</name><uri>https://forge.codesys.com/u/flaviom/</uri></author><id>https://forge.codesys.come43a63b7cedd9aa109d949e112aadf491e08b073</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;I'm currently developing a functionblock for a simple temperature sensor. The functionblock has the possibility to be used for different sensor types and therefore has internal minimum and maximum variables that need to be set when the FB is used. &lt;/p&gt;
&lt;p&gt;I've tried the solution with &lt;strong&gt;&lt;em&gt;FB_Init&lt;/em&gt;&lt;/strong&gt; which works fine until I use &lt;strong&gt;&lt;em&gt;FB_TemperatureSensor&lt;/em&gt;&lt;/strong&gt; in another FB. E.g.: The &lt;strong&gt;&lt;em&gt;FB_TemperatureSensor&lt;/em&gt;&lt;/strong&gt; is used within &lt;strong&gt;&lt;em&gt;FB_TemperatureController&lt;/em&gt;&lt;/strong&gt; to provide the controller with actual values. &lt;br/&gt;
I create two instances of &lt;strong&gt;&lt;em&gt;FB_TemperatureController&lt;/em&gt;&lt;/strong&gt;: &lt;strong&gt;&lt;em&gt;fbControllerOne&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;fbControllerTwo&lt;/em&gt;&lt;/strong&gt; both instances use different temperature sensors. The &lt;strong&gt;&lt;em&gt;FB_Init&lt;/em&gt;&lt;/strong&gt; method doesn't allow me to individually set &lt;strong&gt;&lt;em&gt;fbControllerOne&lt;/em&gt;&lt;/strong&gt;'s temperature sensor maximum limit, as the &lt;strong&gt;&lt;em&gt;FB_Init&lt;/em&gt;&lt;/strong&gt; values are already set in the creation of FB_TemperatureController.&lt;/p&gt;
&lt;p&gt;Should I create a settings method which sets all the min and max values?&lt;/p&gt;
&lt;p&gt;I'd be thankful for any advice :)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>