TwinCAT3 - Automation Interface - Display O/P on Jenkins console

TwinCAT3 - Automation Interface - Display O/P on Jenkins console

  1. Using Automation Interface I could able to build and initiate Activate Configuration in TwinCAT 3.1.4024.4.
  2. If same project under normal run and Activate Configuration, Messages and errors are displayed in the output console of VS2013.
  3. In Automation Interface, Using ErrorItems errors = dte.ToolWindows.ErrorList.ErrorItems; I could only read and display message 1 to 10.
  4. Other Messages has different format TwinCAT System (10000) or PlcTask (350):
  5. Is this will not be captured by dte.ToolWindows.ErrorList.ErrorItems; ?
  6. In the output console of VS2013 there are two options: Show output from build and Show output from twinCAT.
  7. In Automation Interface,I think, i could only read messages from build and no Messages from TwinCAT
  8. Is there any way to read TwinCAT messages Also?

VS2013 console output:

    Message 1   The application is up to date       0   0   
    Message 2   Build complete -- 0 errors, 0 warnings : ready for download!        0   0   
    Message 3   Additional code checks ...      0   0   
    Error   4   SA0033: Unused Variable 'fbSum_Test'    UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
    Error   5   SA0033: Unused Variable 'fbDegreesToRadians'    4   1   UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
    Error   6   SA0033: Unused Variable 'data'  FB_DegreesToRadians_Test.DegreesToRadians_Test1 3   1   UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
    Message 7   Additional code checks complete -- 3 errors     0   0   
    Message 8   Generate TMC information ...        0   0   
    Message 9   Import symbol information ...       0   0   
    Message 10  generate boot information...    PLC.UnitTestJenkins 0   0   UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
    Message 11  29.11.2019 09:52:58 477 ms | 'TwinCAT System' (10000): Ein Neustart des TwinCAT Systems wurde von AmsNetId: 10.73.8.239.1.1 Port 32867 angefordert.     
    Message 12  29.11.2019 09:52:58 614 ms | 'TwinCAT System' (10000): Konfiguration des COM Servers TcEventLogger wird gesichert!      
    Message 13  29.11.2019 09:52:59 440 ms | 'TwinCAT System' (10000): COM Servers TcEventLogger wird heruntergefahren!     
    Message 14  29.11.2019 09:53:01 467 ms | 'TwinCAT System' (10000): Konfiguration des COM Servers TcEventLogger wird geladen!        
    Message 15  29.11.2019 09:53:01 468 ms | 'TwinCAT System' (10000): COM Server TcEventLogger wird initialisiert!     
    Message 16  29.11.2019 09:53:01 517 ms | 'TwinCAT System' (10000): TcIo Server wurde gestartet: TcIo.       
    Message 17  29.11.2019 09:53:01 530 ms | 'TwinCAT System' (10000): TcPlc30 Server wurde gestartet: TcPlc30.     
    Message 18  29.11.2019 09:53:01 537 ms | 'TwinCAT System' (10000): TcRtsObjects Server wurde gestartet: TcRtsObjects.       
    Message 19  29.11.2019 09:53:01 543 ms | 'TwinCAT System' (10000): TcRTime Server wurde gestartet: TcRTime.     
    Message 20  29.11.2019 09:53:01 660 ms | 'License Server' (30): license validation status is Valid(3)       
    Message 21  29.11.2019 09:53:01 704 ms | 'TCRTIME' (200): Intel(R) Core(TM)-i 4'th generation detected      
    Message 22  29.11.2019 09:53:02 078 ms | 'TwinCAT System' (10000): COM Server TcEventLogger wird gestartet!     
    Error   23  29.11.2019 09:53:02 108 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbSum_Test@TwoPlusTwoEqualsFour', EXP: 4, ACT: 3, MSG: The calculation is not correct       
    Error   24  29.11.2019 09:53:02 168 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbDegreesToRadians@DegreesToRadians_Test1', EXP: 0.0, ACT: 0.01745329, MSG: The calculation is not correct      
    Error   25  29.11.2019 09:53:02 228 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbDegreesToRadians@DegreesToRadians_Test2', EXP: 1.0, ACT: 0.01745329, MSG: The calculation is not correct      
    Error   26  29.11.2019 09:53:02 388 ms | 'PlcTask' (350): | ==========TESTS FINISHED RUNNING==========      
    Error   27  29.11.2019 09:53:02 708 ms | 'PlcTask' (350): | Test suites: 2      
    Error   28  29.11.2019 09:53:03 028 ms | 'PlcTask' (350): | Tests: 4        
    Error   29  29.11.2019 09:53:03 348 ms | 'PlcTask' (350): | Successful tests: 1     
    Error   30  29.11.2019 09:53:03 668 ms | 'PlcTask' (350): | Failed tests: 3     
    Error   31  29.11.2019 09:53:03 988 ms | 'PlcTask' (350): | ======================================  

Output on the Jenkins Console: [Could read only first 10 messages]

    ActivateConfiguration Errors count: 10
    vsBuildErrorLevelLow: Description: The application is up to date
    vsBuildErrorLevelLow: Description: Build complete -- 0 errors, 0 warnings : ready for download!
    vsBuildErrorLevelLow: Description: Additional code checks ...
    vsBuildErrorLevelHigh: Description: SA0033: Unused Variable 'fbSum_Test'
    vsBuildErrorLevelHigh: Description: SA0033: Unused Variable 'fbDegreesToRadians'
    vsBuildErrorLevelHigh: Description: SA0033: Unused Variable 'data'
    vsBuildErrorLevelLow: Description: Additional code checks complete -- 3 errors
    vsBuildErrorLevelLow: Description: Generate TMC information ...
    vsBuildErrorLevelLow: Description: Import symbol information ...
    vsBuildErrorLevelLow: Description: generate boot information...
    Exit code is 1

C# Code:

//5.4.1 ITcPlcProject - Automation Interface document 
    ITcSmTreeItem plcProjectRootItem = sysMan.LookupTreeItem("TIPC^UnitTestJenkins");
    ITcPlcProject iecProjectRoot = (ITcPlcProject)plcProjectRootItem;
    iecProjectRoot.BootProjectAutostart = true;
    iecProjectRoot.GenerateBootProject(true);

    sysMan.ActivateConfiguration();
    sysMan.StartRestartTwinCAT();
    ErrorItems ActivateConfigurationErrors = dte.ToolWindows.ErrorList.ErrorItems;
    Console.WriteLine("ActivateConfiguration Errors count: " + ActivateConfigurationErrors.Count);

    for (int i = 1; i <= ActivateConfigurationErrors.Count; i++)
    {
        ErrorItem item = ActivateConfigurationErrors.Item(i);
        Console.WriteLine(item.ErrorLevel + ": " + "Description: " + item.Description);
    }

Please look in to screenshots of the outputs: Build&TwinCAToutput


I see that you are using TcUnit. The problem is that you’re not waiting for TcUnit to finish before you are collecting your ErrorItems. You are only collecting the error items after doing the ActivateConfiguration() and StartRestartTwincat() (that’s why you only get the first 10). You need to wait for TcUnit to finish.

Wrap the running of TcUnit in a while-loop, and ask TcUnit for the results. Once all results are returned (which is done when you have all prints done), you can then use your ErrorItems. So basically, collect the ErrorItems in a while-true loop (but make sure to use a sleep every second or so), and once you have all the results from TcUnit (in other words, the lines ==========TESTS FINISHED RUNNING========== and everything that follows), you can print all error items (or parse them, or do whatever you want with them).

Good luck!

TwinCAT3 – Automation Interface – Display O/P on Jenkins console , TwinCAT3 – Automation Interface – Display O/P on Jenkins console Messages and errors are displayed in the output console of VS2013. Is there a way to print to output console? (twincat3) Ask Question Asked 1 year, 11 months ago. TwinCAT3 - Automation Interface - Display O/P on Jenkins console. 1.


Thank you @Jakob Your suggestion helped to solve this issue. After restart, 10 seconds of wait and after each read, 5 seconds of sleep.

    sysMan.ActivateConfiguration();
    sysMan.StartRestartTwinCAT();
    System.Threading.Thread.Sleep(10000);    

    ErrorItems ACErrors = dte.ToolWindows.ErrorList.ErrorItems;
    ErrorItem ACErrorsItems;
    int j = 1;
    do
    {
        System.Threading.Thread.Sleep(5000);
        ACErrorsItems = ACErrors.Item(j);
        j++;
        if (ACErrorsItems.ErrorLevel != vsBuildErrorLevel.vsBuildErrorLevelLow)
        {
            Console.WriteLine("Description: " + ACErrorsItems.Description);
        }
    } while (!ACErrorsItems.Description.Contains("| 'PlcTask' (350): | ================"));    

Integration to Jenkins/build automation server � Issue #7 � tcunit , In the sphere of continous integration and con /twincat3-automation-interface- display-o-p-on-jenkins-console/59161528#59161528� TwinCAT 3 has been fully integrated into Visual Studio to provide users with a standardized and most flexible editor to create and manage TwinCAT projects. To create and/or access a TwinCAT configuration, the combined use of Visual Studio and TwinCAT Automation Interface is possible.


Independent of the VS ErrorList, another way to access the output window, e. g. to catch the build information:

// access output window in VS
EnvDTE.OutputWindow outWin = ((DTE2)dte).ToolWindows.OutputWindow;
try
{
    // get specific output window of the collection
    EnvDTE.OutputWindowPane Buildpane = outWin.OutputWindowPanes.Item("Build");
    // get text document of the selected pane
    EnvDTE.TextDocument BuildtextDoc = Buildpane.TextDocument;
    // select all text in the output window
    EnvDTE.EditPoint BuildeditPoint = BuildtextDoc.StartPoint.CreateEditPoint();
    string Buildtext = BuildeditPoint.GetText(BuildtextDoc.EndPoint);
    Console.WriteLine(Buildtext);
}
catch (Exception e)
{
    MessageBox.Show(e.Message);
}

CI/CD with TwinCAT – part four – AllTwinCAT, With the TwinCAT3 integrated development environment being What is important to know is that the TwinCAT automation interface is a Everything that we print to the console (using Console. static void DisplayHelp(OptionSet p) { Each of these outcomes are displayed in Jenkins with a different� In the sphere of continous integration and continous delivery there needs to be a more automated way to run the tests. One solution/suggestion is to write a program/script that automatically runs the tests on the build-server using a combination of the Microsoft Visual Studio development tools environment plus the TwinCAT automation interface.


Integration to Jenkins/build automation server - TcUnit, In large projects this is usually not optimal, as the amount of source code can be /twincat3-automation-interface-display-o-p-on-jenkins-console/59161528#� The TwinCAT software system turns almost any PC-based system into a real-time control with multiple PLC, NC, CNC and/or robotics runtime systems. TwinCAT 3 is the systematic further development of TwinCAT 2, with which the world of automation technology is being redefined. more


twincat, I'm trying to get the local AmsNetId of my TwinCat PLC system. The Code is running on the TwinCAT3 - Automation Interface - Display O/P on Jenkins console. The Automation Interface in TwinCAT 3 automation software enables the remote control of the TwinCAT engineering system and the automatic generation of programs and configurations. Depending on the degree of automation, manual processing of control projects and the associated errors can be reduced or avoided.


SiteMap, The automation of a TwinCAT configuration is available through so-called Visual Studio Automation Model and extend Visual Studio with TwinCAT3 features. Sample 1: Adding of Additional Tasks and Variables; TwinCAT Start / Stop: C++: SysManSamples.exe (Self extracting) Visual Studio 2008 project: Sample 2: OpenConfiguration and CloseConfiguration, Scan Devices, Scan Boxes, Scan Terminals, Adding EtherCAT Devices, Import/Export: C#: SysManSamples.zip: Visual Studio 2010 project (.NET 2.0)