<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Extended DUTs  And Var_In_Out</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/53b6ba72c7/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/53b6ba72c7/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/53b6ba72c7/</id><updated>2020-02-27T14:26:08.083000Z</updated><subtitle>Recent posts to Extended DUTs  And Var_In_Out</subtitle><entry><title>Extended DUTs  And Var_In_Out</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/53b6ba72c7/?limit=25#a552" rel="alternate"/><published>2020-02-27T14:26:08.083000Z</published><updated>2020-02-27T14:26:08.083000Z</updated><author><name>Alvxx1</name><uri>https://forge.codesys.com/u/alvxx1/</uri></author><id>https://forge.codesys.comd736467c3c478761acc839f40fb53c678dfc3d3e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I think I've answered my own question now.&lt;/p&gt;
&lt;p&gt;In the extended function block (Level_Instrument_Manager), instead of using a call "Super^", I inserted the actual function block of it's parent and gave it an instance of "Super^". This then allowed my to interconnect the Var_In_Out and set the value as "Data", which the Level data type, but Codesys appears to be casting this to it's parent type and executing correctly. I'm assuming its truncating the memory of the Data variable so it can fit, because it's inherited it can only ever be larger, truncating to the parents length would be safe.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Extended DUTs  And Var_In_Out</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/53b6ba72c7/?limit=25#f9a8" rel="alternate"/><published>2020-02-27T14:26:06.788000Z</published><updated>2020-02-27T14:26:06.788000Z</updated><author><name>Alvxx1</name><uri>https://forge.codesys.com/u/alvxx1/</uri></author><id>https://forge.codesys.com531b18cda62a3eee0ae207294073cdac245b1075</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;I am trying to get my head around the wonderful world of OOP in CODESYS. I currently have the following environment setup&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Base_Analog_Manager&lt;/strong&gt; is my parent FB and &lt;strong&gt;Level_Instrument_Manager&lt;/strong&gt; extends the &lt;strong&gt;Base_Analog_Manager&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Base_Analog_Manager&lt;/strong&gt; makes use of the DUT &lt;strong&gt;DUT_Base_Analog&lt;/strong&gt; and &lt;strong&gt;Level_Instrument_Manager&lt;/strong&gt; makes use of DUT &lt;strong&gt;DUT_Level_Instrument&lt;/strong&gt; which extends the &lt;strong&gt;DUT_Base_Analog&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ITF_Level_Instrument&lt;/strong&gt; extends &lt;strong&gt;ITF_Base_Analog&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In my &lt;strong&gt;GVL&lt;/strong&gt; I have a variable called &lt;strong&gt;IL101&lt;/strong&gt; that is of type &lt;strong&gt;DUT_Level_Instrument&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Hopefully the above makes sense.&lt;/p&gt;
&lt;p&gt;What I want to achieve is the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Place &lt;strong&gt;Level_Instrument_Manager&lt;/strong&gt; and pass data of DUT type &lt;strong&gt;DUT_Level_Instrument&lt;/strong&gt; (which should also contain &lt;strong&gt;DUT_Base_Analog&lt;/strong&gt; as it extends it)&lt;/li&gt;
&lt;li&gt;I want to pass the data as a Var_In_Out so that it can be passed from SCADA, read and written to, then passed back.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The problem that I am facing is:&lt;br/&gt;
- CODESYS throws errors and warnings when using Var_In_Out in the FB &lt;strong&gt;Base_Analog_Manager&lt;/strong&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
                ------ Build started: Application: CODESYS_Control_Win_V3_x64.Application -------&lt;br/&gt;
                Typify code...&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: Analog_Example &lt;a class="" href="../Network%201%20/%20Operand%20'%IW0'%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application&lt;/a&gt;: C0196:  Implicit conversion from unsigned Type 'WORD' to signed Type 'INT' : Possible change of sign&lt;br/&gt;
&lt;span&gt;[ERROR]&lt;/span&gt;         OOP Example: Level_Instrument_Manager &lt;a class="" href="../Network%201%20/%20Operator%20'SUPER^'%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application&lt;/a&gt;: C0039:  VAR_IN_OUT 'Data' must be assigned in call of 'Base_Analog_Manager'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_OOR &lt;a class="" href="../Line%201,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_OOR'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_OOR &lt;a class="" href="../Line%201,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_OOR'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_OOR &lt;a class="" href="../Line%202,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_OOR'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_OOR &lt;a class="" href="../Line%202,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_OOR'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_OOR &lt;a class="" href="../Line%203,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_OOR'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_OOR &lt;a class="" href="../Line%205,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_OOR'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Eval_Alarm &lt;a class="" href="../Line%204,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Eval_Alarm'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Eval_Alarm &lt;a class="" href="../Line%208,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Eval_Alarm'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Eval_Alarm &lt;a class="" href="../Line%2014,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Eval_Alarm'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Eval_Alarm &lt;a class="" href="../Line%2018,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Eval_Alarm'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Scale &lt;a class="" href="../Line%201,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Scale'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Scale &lt;a class="" href="../Line%201,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Scale'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Scale &lt;a class="" href="../Line%201,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Scale'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Scale &lt;a class="" href="../Line%201,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Scale'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Scale &lt;a class="" href="../Line%201,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Scale'&lt;br/&gt;
&lt;span&gt;[WARNING]&lt;/span&gt;       OOP Example: METH_Scale &lt;a class="" href="../Line%201,%20Column%201%20(Impl)"&gt;CODESYS_Control_Win_V3_x64: PLC Logic: Application: Base_Analog_Manager&lt;/a&gt;: C0371:  Access to VAR_IN_OUT 'Data' declared in 'Base_Analog_Manager' from external context 'METH_Scale'&lt;br/&gt;
                Compile complete -- 1 errors, 17 warnings&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;I don't understand how I can pass IL101's Data (&lt;strong&gt;DUT_Level_Instrument&lt;/strong&gt;) to the In_Out of FB &lt;strong&gt;Level_Instrument_Manager&lt;/strong&gt; when the data type is inherited from FB &lt;strong&gt;Base_Analog_Manager&lt;/strong&gt; as data type &lt;strong&gt;DUT_Base_Analog&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The above images show what I mean, would this even work?&lt;/p&gt;
&lt;p&gt;I understand method extension and how to use that, but I don't understand how In_Out's work with extended DUTs.&lt;/p&gt;
&lt;p&gt;Any guidance would be greately appreciated, I'm really struggling to work out if this is even doable.&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Bild" rel="nofollow" src="https://i.imgur.com/JZX5oUf.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Bild" rel="nofollow" src="https://i.imgur.com/CI3AMWq.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Bild" rel="nofollow" src="https://i.imgur.com/wLlrDiK.png"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>