### Verify Git Installation Version Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/ListOfSoftwareForBoxProgramming.md This command is used in either Command Prompt or Windows PowerShell to output the installed version of Git. It serves as a quick check to ensure Git is correctly installed and accessible for version control operations. ```Git git --version ``` -------------------------------- ### Verifying Git Installation Version Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/SomeGitTools.md This command is used to check if Git is correctly installed on your system and to display its current version. It's a common first step to confirm your Git environment setup. ```Git CLI C:\Users\firstname.surname>git --version git version 2.42.0.windows.1 ``` -------------------------------- ### Check Java Installation Version Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/CreateUMLwithExamples.md Verify the installed Java Development Kit (JDK) version using the command prompt. This is a prerequisite for PlantUML to function correctly. ```Shell >java -version Should return java version "1.8.0_261" Java(TM) SE Runtime Environment (build 1.8.0_261-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode) ``` -------------------------------- ### Cloning a Git Repository from URL Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/SomeGitTools.md This command is used to create a local copy of a remote Git repository from a given URL. It's the primary way to get a project onto your local machine for the first time. ```Git CLI C:\Users\******Tempo Git Editor> git clone https://github.com/hei-synd-autb/autb-docs.git ``` -------------------------------- ### Mermaid State Diagram: Sequential Process with Error Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/Sandbox.md This Mermaid state diagram visualizes a process flow that moves through several sequential steps (MoveOne, MoveTwo) and includes a dedicated error state (ErrorStop) before reaching a final Stopped state. It starts from an Idle state and can terminate from the Stopped state. ```Mermaid stateDiagram-v2 [*] --> Idle Idle --> MoveOne MoveOne --> MoveOneCheckDone MoveOneCheckDone --> MoveTwo MoveTwo --> MoveTwoCheckDone MoveTwoCheckDone --> ErrorStop ErrorStop --> Stopped Stopped --> [*] ``` -------------------------------- ### Generate a PlantUML State Diagram Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/CreateUMLwithExamples.md Example of a PlantUML state diagram, representing states and transitions. This diagram is intended to mirror the states defined in code, such as a CASE..OF structure with ENUMs. ```PlantUML @startuml [*] --> Clearing Clearing --> Resetting Clearing : Clearing_SC := TRUE Resetting --> [*] Resetting : Resetting_SC := TRUE Clearing -> Stopping Stopping --> [*] @enduml ``` -------------------------------- ### Enable Type Function Block Parameters (MC_Power Example) Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_07_Robust_Programming_With_State_Machine/README_DE.md Details the input and output parameters for an 'Enable' type function block, exemplified by MC_Power. This type of block is continuously called as long as the Enable input is true, and its outputs (InOperation/Status) indicate its active state. ```APIDOC Inputs: Axis: Type: AXIS_REF Description: Axis data structure that unambiguously addresses an axis in the system. Enable: Type: BOOL Description: Value range: FALSE, TRUE. Default value: FALSE. The input Enable starts or terminates execution of a function block. --> FALSE: Execution of the function block is terminated. The outputs Valid, Busy, and Error are set to FALSE. --> TRUE: The function block is being executed. The function block continues executing as long as the input Enable is set to TRUE. Outputs: Status: Type: BOOL Description: Value range: FALSE, TRUE. Default value: FALSE. --> FALSE: Power stage is disabled. --> TRUE: Power stage is enabled. Error: Type: BOOL Description: Value range: FALSE, TRUE. Default value: FALSE. --> FALSE: Function block is being executed, no error has been detected during execution. -->TRUE: An error has been detected in the execution of the function block. ErrorID: Type: ET_Result Description: This enumeration provides diagnostics information. ``` -------------------------------- ### UML Class Diagram for FB_UnitDrinkPreparation (Class-level) Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Revision/2025_S4_Examen_1.md This Mermaid diagram illustrates the composition of Function Blocks for the "FB_UnitDrinkPreparation" installation at a class level. It shows "FB_UnitDrinkPreparation" composed of various "FB_EM_Product", "FB_EM_Temperature", "FB_EM_Agitator", and "FB_EM_BottleFeeding" modules, which in turn are composed of generic control modules like "FB_CM_XV", "FB_CM_PT", "FB_CM_SIC", and "FB_CM_M". ```mermaid classDiagram FB_UnitDrinkPreparation *-- FB_EM_Product_1 FB_UnitDrinkPreparation *-- FB_EM_Product_2 FB_UnitDrinkPreparation *-- FB_EM_Temperature FB_UnitDrinkPreparation *-- FB_EM_Agitator FB_UnitDrinkPreparation *-- FB_EM_BottleFeeding FB_EM_Product_1 *-- FB_CM_XV FB_EM_Product_2 *-- FB_CM_XV FB_EM_Temperature *-- FB_CM_XV FB_EM_Temperature *-- FB_CM_PT FB_EM_Agitator *-- FB_CM_SIC FB_EM_BottleFeeding *-- FB_CM_M FB_EM_BottleFeeding *-- FB_CM_XV ``` -------------------------------- ### Generate a PlantUML Activity Diagram Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/CreateUMLwithExamples.md Example of a PlantUML activity diagram, illustrating a sequence of actions and decision points. This type of diagram is useful for design specifications and communicating processes to non-coding stakeholders. ```PlantUML @startuml start :Init Axis; :Move Axis **Up**; repeat :Axis Sychronized; repeat while (Still synchronized?) is (yes) ->no; : Emergency Stop; stop @enduml ``` -------------------------------- ### Execute Type Function Block Parameters (MC_Reset Example) Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_07_Robust_Programming_With_State_Machine/README_DE.md Details the input and output parameters for an 'Execute' type function block, exemplified by MC_Reset. This type of block is activated by a rising edge on the Execute input. ```APIDOC Inputs: Execute: Type: BOOL Description: The command is executed with a rising edge. Axis: Type: AXIS_REF Description: Axis data structure that unambiguously addresses an axis in the system. Outputs: Done: Type: BOOL Description: TRUE, if the reset was executed successfully. Busy: Type: BOOL Description: TRUE, as long as the function block is called with Enable = TRUE. Error: Type: BOOL Description: TRUE, if an error occurs. ErrorID: Type: UDINT Description: If the error output is set, this parameter supplies the error number. ``` -------------------------------- ### IECST Program: Retrieve Current Task Cycle Time Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Program_Organisation_Unit/POU_Ubungen.md This IECST program, PLC_PRG, demonstrates how to obtain the cycle time of the task in which it is running, measured in microseconds. It utilizes functions from the SysTask library, specifically SysTaskGetCurrent to get the task handle and SysTaskGetInterval to retrieve the interval. This functionality requires the SysTask library to be installed. ```iecst PROGRAM PLC_PRG VAR // task handle hTask : SysTask.RTS_IEC_HANDLE; // intervall in micro seconds udiInterval_us : UDINT; END_VAR // **** Implementation *** // get handle of current task SysTaskGetCurrent(ADR(hTask)); // get task interval SysTaskGetInterval(hTask, udiInterval_us); ``` -------------------------------- ### IECST Program: Orchestrate Data Processing Function Blocks Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Program_Organisation_Unit/POU_Ubungen.md This IECST program, PRG_IN_OUT, demonstrates how to instantiate and call multiple data processing function blocks, specifically FB_GetMaxValue, FB_GetMinValue, and FB_GetRMSValue. It initializes an ioDataStructure_typ with sample values and uses a single ExecuteAll boolean to trigger all three function blocks simultaneously, showcasing their integration. ```iecst PROGRAM PRG_IN_OUT VAR ExecuteAll : BOOL; ioData : ioDataStructure_typ := (listOfValues := [-3, 4, 7, 9, -5, -2, -15, 6, -3, 21]); fbGetMaxValue : FB_GetMaxValue; fbGetMinValue : FB_GetMinValue; fbGetRMSValue : FB_GetRMSValue; END_VAR //------------------------------------------------------- // Code //------------------------------------------------------- fbGetMaxValue(Execute := ExecuteAll, data := ioData); fbGetMinValue(Execute := ExecuteAll, data := ioData); fbGetRMSValue(Execute := ExecuteAll, data := ioData); ``` -------------------------------- ### IEC 61131-3 Structured Text Encapsulated in XML for PLC Logic Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/ListOfSoftwareForBoxProgramming.md This code snippet illustrates how IEC 61131-3 Structured Text (ST) logic is embedded within an XML structure, a common practice in PLC engineering projects. The example demonstrates a basic state machine using a CASE statement, handling an 'idle' state and conditional logic based on a 'bTest' boolean. ```XML ``` -------------------------------- ### Implement IECST State Machine with CSV Write Steps Enum Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This IECST code demonstrates a basic state machine using a `CASE` statement. It utilizes the `EN_CSV_WriteSteps` enumeration to define and manage different states of a CSV writing process. Each `CASE` branch corresponds to a specific step, allowing for structured control flow based on the current state. ```iecst VAR stateCsv : EN_CSV_WriteSteps; END_VAR CASE stateCsv OF EN_CSV_WriteSteps.WAIT_RISING_EDGE: ; EN_CSV_WriteSteps.GENERATE_FILENAME: ; EN_CSV_WriteSteps.OPEN_SOURCE_FILE: ; EN_CSV_WriteSteps.WAIT_OPEN_NOT_BUSY: ; EN_CSV_WriteSteps.CONVERT_ONE_CSV_RECORD: ; EN_CSV_WriteSteps.WRITE_RECORD_TO_FILE: ; EN_CSV_WriteSteps.WAIT_UNTIL_WRITE_NOT_BUSY: ; EN_CSV_WriteSteps.CLOSE_SOURCE_FILE: ; EN_CSV_WriteSteps.WAIT_UNTIL_CLOSE_NOT_BUSY: ; EN_CSV_WriteSteps.ERROR_OR_READY_STEP: ; END_CASE ``` -------------------------------- ### IECST: Example of Dangerous Function Block Call with Missing Pointer Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/VAR_IN_OUT_BAD_AI_CODE.md Illustrates a critical programming error where the `FB_PumpOnOffControl` function block is called without passing the required `pPump` pointer. This code would be accepted by the compiler but would likely lead to a program crash due to dereferencing an uninitialized or invalid pointer. ```iecst // Getting a pointer to the structure myPump := ADR(myPump); // Calling the function with the pointer fbPumpOnOffControl(Enable := myCondition); ``` -------------------------------- ### Matlab Script: Verify IECST Data Calculation Results Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Program_Organisation_Unit/POU_Ubungen.md This Matlab script serves as a verification tool for the calculations performed by the IECST data processing function blocks (max, min, RMS). It uses the same sample listOfValues as the IECST PRG_IN_OUT program to independently compute and display the expected maximum, minimum, and RMS values, allowing for cross-validation. ```matlab listOfValues = [-3, 4, 7, 9, -5, -2, -15, 6, -3, 21] max(listOfValues) % = 21 min(listOfValues) % = -15 rms(listOfValues) % = 9.4604 ``` -------------------------------- ### IECST Code: Implement a Square Wave Generator Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Program_Organisation_Unit/POU_Ubungen.md This IECST code provides two variants for implementing a square wave generator. When Enable is TRUE, a Signal output is toggled based on an internal counter diCount, creating a square wave. The Signal is TRUE when diCount is greater than 5 (for counts 6-9) and FALSE otherwise, with the counter resetting after 9. ```iecst // Solution exercice Square generator IF NOT Enable THEN Signal := FALSE; diCount := 0; ELSE IF diCount > 9 THEN diCount := 0; END_IF diCount := diCount + 1; IF (diCount > 5) THEN Signal := TRUE; ELSE Signal := FALSE; END_IF END_IF ``` ```iecst IF NOT Enable THEN diCount := 0; ELSE IF diCount > 9 THEN diCount := 0; END_IF diCount := diCount + 1; END_IF Signal := (diCount > 5) AND Enable; ``` -------------------------------- ### Creating a Basic Markdown File Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/SomeGitTools.md This snippet demonstrates how to create a new Markdown file, open it with Visual Studio Code, and add basic Markdown syntax for titles and lists. It's a foundational step for documenting projects. ```Markdown # Titre 1 asdfahf ## Titre 2 sadfsadf ### Titre 3 asdfhhhsd 1. Puce 1 2. Puce 2 Mon premier document est prĂȘt... ``` -------------------------------- ### Create a Basic PlantUML Diagram Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/CreateUMLwithExamples.md Demonstrates how to create a simple 'Hello World' diagram using PlantUML syntax. This snippet shows a basic actor-to-actor message flow. ```PlantUML @startuml TestDiagram User->World : Hello UML! @enduml ``` -------------------------------- ### UML Class Diagram for FB_UnitDrinkPreparation (Instance-level) Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Revision/2025_S4_Examen_1.md This Mermaid diagram provides a more detailed, instance-level view of the "FB_UnitDrinkPreparation" composition. It specifies individual instances of control modules (e.g., "fbCM_XV_11", "fbCM_PT_32") that compose the higher-level "fbEM" modules, offering a clearer representation of the actual objects in the system. ```mermaid classDiagram fbUnitDrinkPreparation *-- fbEM_Product_1 fbUnitDrinkPreparation *-- fbEM_Product_2 fbUnitDrinkPreparation *-- fbEM_Temperature fbUnitDrinkPreparation *-- fbEM_Agitator fbUnitDrinkPreparation *-- fbEM_BottleFeeding fbEM_Product_1 *-- fbCM_XV_11 fbEM_Product_1 *-- fbCM_XV_12 fbEM_Product_2 *-- fbCM_XV_21 fbEM_Product_2 *-- fbCM_XV_22 fbEM_Product_2 *-- fbCM_XV_23 fbEM_Temperature *-- fbCM_XV_31 fbEM_Temperature *-- fbCM_PT_32 fbEM_Agitator *-- fbCM_SIC_41 fbEM_BottleFeeding *-- fbCM_M_51 fbEM_BottleFeeding *-- fbCM_XV_52 ``` -------------------------------- ### Motion Control Function Block Parameter Reference Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_10_Motion_Control_With_PLCopen/Sandbox.md This API documentation details the input (VAR_INPUT) and output (VAR_OUTPUT) parameters for a generic motion control function block. It specifies the name, data type, and a brief description for each parameter, essential for understanding its functionality and integration. ```APIDOC VAR_INPUT: Execute: Type: BOOL Description: Rising edge starts the processing Position: Type: LREAL Description: Target position Velocity: Type: LREAL Description: Maximum velocity Acceleration: Type: LREAL Description: Acceleration Deceleration: Type: LREAL Description: Deceleration Jerk: Type: LREAL Description: Maximum jerk BufferMode: Type: MC_BUFFER_MO Description: Buffered or direct command execution Axis: Type: AXIS_REF Description: Axis to be controlled VAR_OUTPUT: Done: Type: BOOL Description: The axis was reset InBuffer: Type: BOOL Description: The command is in the buffer, but it is not executed Active: Type: BOOL Description: The function block is active CommandAborted: Type: BOOL Description: The command was aborted during the execution Error: Type: BOOL Description: An error occurred ErrorID: Type: ERROR_CODE Description: Error classification ErrorIdent: Type: ERROR_STRUCT Description: Error Diagnostics ``` -------------------------------- ### Define IECST Structure for Second Encoder Data Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This IECST snippet defines a `STRUCT` named `ST_SecondEncoder`. It encapsulates common properties for a second encoder, such as actual position, velocity, and a boolean flag indicating if the axis is stopped. This structure serves as a base for more complex axis information. ```iecst TYPE ST_SecondEncoder STRUCT ActualPosition : REAL; ActualVelocity : REAL := 0; bAxisStopped : BOOL; END_STRUCT END_TYPE ``` -------------------------------- ### Complete State Machine for Move Two Positions with Halt Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_10_Motion_Control_With_PLCopen/Sandbox.md This Mermaid state diagram illustrates the operational flow of a motion control system, detailing states such as Idle, Power Off/On, Motion Initialization, Movement, Gripper operations, and various error and stopping conditions. It shows transitions based on system status and command execution. ```Mermaid --- title: Complete State Machine for Move Two Positions with Halt --- stateDiagram-v2 [*] --> Idle Idle --> isPowerOff : mcReadStatus is Disabled isPowerOff --> WaitPowerOn : Power.Enable = TRUE WaitPowerOn --> isPowerOn : mcReadStatus is Standstill isPowerOn --> InitMotion : mcMoveAbsolute.Execute = TRUE InitMotion --> InitMotionDone : mcMoveAbsolute.Done = TRUE InitMotionDone --> MoveDown : mcMoveAbsolute.Execute = TRUE MoveDown --> MoveDownDone : mcMoveAbsolute.Done = TRUE MoveDownDone --> CloseGripper : Pick CloseGripper --> GripperClosed : Picked GripperClosed --> InitMotion : mcMoveAbsolute.Execute = TRUE isPowerOff --> ErrorStop : error WaitPowerOn --> ErrorStop : error isPowerOn --> ErrorStop : error InitMotion --> ErrorStop : error InitMotion --> Stopping : stop Stopping --> isPowerOn : mcReadStatus is Standstil ErrorStop --> isPowerOn : reset ``` -------------------------------- ### Adding a File to Git Staging Area Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/SomeGitTools.md This command shows how to stage a newly created or modified file, 'MyFirstDocumentation.md', for the next commit. Staging is a crucial step before committing changes to the local repository. ```Git CLI C:\Users\firstname.surname\Documents\GIT_QuickStart\quickstartgitlabautomation>git add MyFirstDocumentation.md ``` -------------------------------- ### Changing Directory in Command Line Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/SomeGitTools.md This command demonstrates how to navigate to a specific directory in the command prompt. It's essential for moving into the correct folder before executing Git commands or other file operations. ```CLI C:\Users\firstname.surname>cd "******Tempo Git Editor" ``` -------------------------------- ### Instantiate IECST Variables for Extended Axis Control Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This IECST snippet declares variables for an extended axis control scenario. It instantiates a function block `FB_StopAxisTwoEncoder` and a structure `stAxisTwoEncoder` of type `ST_AxisTwoEncoder`. These variables are prepared for use in a program that manages a two-encoder axis, likely involving stopping procedures. ```iecst VAR fbStopAxisTwoEncoder : FB_StopAxis; stAxisTwoEncoder : ST_AxisTwoEncoder; END_VAR ``` -------------------------------- ### PlantUML State Diagram for PackML Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/CreateUMLwithExamples.md This PlantUML code generates a comprehensive state diagram representing the PackML standard. It defines various states, including main states like Aborted, Not_Abort, and Not_Stop, and transitions between them, illustrating the typical machine control flow and operational modes. ```PlantUML @startuml State PackML{ State Aborted #LightGreen State Aborting #LightYellow state Not_Abort { state Clearing #LightGreen state Stopping #LightGreen state Stopped #LightYellow state Not_Stop { state Resetting #LightGreen state Idle #LightYellow State Starting #LightGreen State Execute #SkyBlue State Completing #LightGreen State Complete #LightYellow State Suspending #LightGreen State Suspended #LightYellow State Unsuspending #LightGreen State Holding #LightGreen State Held #LightYellow State Unholding #LightGreen } } } Aborting --> Aborted : SC Aborted --> Clearing : Clear Not_Abort --> Aborting : Abort Not_Stop --> Stopping : Stop Clearing --> Stopped : SC Stopping --> Stopped : SC Stopped --> Resetting : Reset Resetting --> Idle : SC Idle --> Starting : Start Starting --> Execute : SC Execute --> Completing : SC Completing --> Complete : SC Complete --> Resetting : Reset Execute --> Suspending : Suspend Suspending --> Suspended : SC Suspended --> Unsuspending : Un-Suspend Unsuspending --> Execute : SC Execute --> Holding : Hold Holding --> Held : SC Held --> Unholding : Un-Hold Unholding --> Execute : SC @enduml ``` -------------------------------- ### Define IECST Union for Modbus Endianness Conversion Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This IECST snippet defines a `UNION` named `U_SolveModbus`. This union allows the same memory location to be interpreted as either an array of bytes (`myBytes`) or a DINT (`diMyResult`). This is a common pattern for handling endianness conversion when reading multi-byte values from a Modbus frame. ```iecst TYPE U_SolveModbus : UNION myBytes : ARRAY[1..GVL_Modbus.TYPE_SIZE_IN_BYTE] OF BYTE; diMyResult : DINT; END_UNION END_TYPE ``` -------------------------------- ### Check PC IP Configuration on Windows Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/ListOfSoftwareForBoxProgramming.md This command is executed in the Windows Command Prompt to display the current TCP/IP network configuration, including IP addresses, subnet masks, and default gateways. It is essential for verifying network settings when connecting to an automation box. ```Command Prompt C:\Users\firstname.surname>ipconfig ``` -------------------------------- ### Define IECST Extended Structure for Two-Encoder Axis Info Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This IECST snippet defines a `STRUCT` named `ST_AxisTwoEncoder` that `EXTENDS` an assumed `ST_AxisInfo` structure. It incorporates the `ST_SecondEncoder` structure as a member, demonstrating inheritance and composition. This allows for building more specialized data types by adding functionality to existing ones. ```iecst TYPE ST_AxisTwoEncoder EXTENDS ST_AxisInfo : STRUCT stSecondEncoder : ST_SecondEncoder; END_STRUCT END_TYPE ``` -------------------------------- ### Define IECST Global Constants for Modbus Frame Processing Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This snippet defines global constants in IECST within a `VAR_GLOBAL CONSTANT` block, likely for a Modbus communication application. These constants, such as `MB_FRAME_SIZE`, `NUMBER_OF_INT32`, and `TYPE_SIZE_IN_BYTE`, provide fixed values essential for consistent Modbus frame parsing and data manipulation. ```iecst VAR_GLOBAL CONSTANT MB_FRAME_SIZE : INT := 12; NUMBER_OF_INT32 : INT := 3; TYPE_SIZE_IN_BYTE : INT := 4; END_VAR ``` -------------------------------- ### IECST Function Block: Calculate Minimum Value Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Program_Organisation_Unit/POU_Ubungen.md This IECST function block, FB_GetMinValue, determines the smallest value within a list of numbers provided in ioDataStructure_typ. It is activated by a rising edge on the Execute input and signals completion via the Done output. The block iterates through the listOfValues to find and store the minimum. ```iecst FUNCTION_BLOCK FB_GetMinValue VAR_INPUT Execute : BOOL; END_VAR VAR_IN_OUT data : ioDataStructure_typ; END_VAR VAR_OUTPUT Done : BOOL; END_VAR VAR rTrig : R_TRIG; iLoop : DINT; END_VAR //------------------------------------------------------- // Code //------------------------------------------------------- rTrig(CLK := Execute); IF rTrig.Q THEN data.minValue := data.listOfValues[1]; FOR iLoop := 2 TO 10 DO IF data.listOfValues[iLoop] < data.minValue THEN data.minValue := data.listOfValues[iLoop]; END_IF END_FOR Done := TRUE; END_IF; IF NOT Execute THEN Done := FALSE; END_IF ``` -------------------------------- ### Center SVG Diagram using HTML Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/CreateUMLwithExamples.md Illustrates how to embed and center an SVG image using HTML tags, including a caption. This provides more control over image placement compared to Markdown. ```HTML

Publish your image with html to center it

Publish your image with html to center it !

``` -------------------------------- ### Define IECST Enum for CSV Write Steps Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This snippet defines an enumeration `EN_CSV_WriteSteps` in IECST. It lists various states involved in a CSV file writing process, assigning unique unsigned integer values to each step. This enum is typically used to manage the state transitions within a state machine. ```iecst TYPE EN_CSV_WriteSteps : ( WAIT_RISING_EDGE := 0, GENERATE_FILENAME := 21, OPEN_SOURCE_FILE := 1, WAIT_OPEN_NOT_BUSY := 2, CONVERT_ONE_CSV_RECORD := 3, WRITE_RECORD_TO_FILE := 4, WAIT_UNTIL_WRITE_NOT_BUSY := 5, CLOSE_SOURCE_FILE := 10, WAIT_UNTIL_CLOSE_NOT_BUSY := 11, ERROR_OR_READY_STEP := 100 ) UDINT := WAIT_RISING_EDGE; END_TYPE ``` -------------------------------- ### Define IECST Structure for Modbus Data Aggregation Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This IECST snippet defines a `STRUCT` named `ST_SolveModbus`. It aggregates an array of `U_SolveModbus` unions and specific DINT variables for total energy values. This structure is designed to hold parsed Modbus register data, making it easier to access and manage related energy measurements. ```iecst TYPE ST_SolveModbus : STRUCT arMyRegisters : ARRAY[1..GVL_Modbus.NUMBER_OF_INT32] OF U_SolveModbus; TotalActiveEnergy_Wh : DINT; TotalReactiveEnergy_VARh : DINT; TotalApparentEnergy_VAh : DINT; END_STRUCT END_TYPE ``` -------------------------------- ### Define EM_PrepareProduct_2_typ Structure (IECST) Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_03_Interface/MOD_03_Exercice Solution_Losung.md Defines a structure type for the second product preparation module, containing three instances of XV_Valve_typ components. ```iecst TYPE EM_PrepareProduct_2_typ STRUCT xvValve_21 : XV_Valve_typ; xvValve_22 : XV_Valve_typ; xvValve_23 : XV_Valve_typ; END_STRUCT; END_TYPE ``` -------------------------------- ### IECST Function Block: Calculate RMS Value Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Program_Organisation_Unit/POU_Ubungen.md The FB_GetRMSValue IECST function block computes the Root Mean Square (RMS) value from a list of numbers contained in ioDataStructure_typ. Triggered by a rising edge on Execute, it calculates the sum of squares, then the mean, and finally the square root to determine the RMS. The Done output indicates completion. ```iecst FUNCTION_BLOCK FB_GetRMSValue VAR_INPUT Execute : BOOL; END_VAR VAR_IN_OUT data : ioDataStructure_typ; END_VAR VAR_OUTPUT Done : BOOL; END_VAR VAR rTrig : R_TRIG; iLoop : DINT; iSquareSum : REAL; END_VAR //------------------------------------------------------- // Code //------------------------------------------------------- rTrig(CLK := Execute); IF rTrig.Q THEN iSquareSum := 0; FOR iLoop := 1 TO 10 DO iSquareSum := iSquareSum + (data.listOfValues[iLoop] * data.listOfValues[iLoop]); END_FOR data.meanRmsValue := SQRT(iSquareSum / 10); Done := TRUE; END_IF; IF NOT Execute THEN Done := FALSE; END_IF ``` -------------------------------- ### IECST State Machine and Output Logic for 7-Segment Display Driver Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_07_Robust_Programming_With_State_Machine/Mod07_Exercices.md This snippet implements the core logic of the FB_SevenDigitDriverExecute function block. It includes a state machine (CASE statement) to manage the display's behavior (IDLE, INIT, INOP_ZERO to THREE, ERROR states), a rising edge trigger for the Execute input, a timer for initialization, and boolean logic to control the individual segments (Sa-Sg) based on the current state, effectively displaying digits 0-3 cyclically. ```iecst // // Used to get rising edge of Execute for counter // Note that as an exception, FB Trigger called before FSM // trigEx(CLK := Execute); CASE stateDigit OF E_SevenDigitDriver.STATE_IDLE: IF Execute THEN stateDigit := E_SevenDigitDriver.STATE_INIT; END_IF E_SevenDigitDriver.STATE_INIT: IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF Execute AND tonToInOp.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ZERO; END_IF E_SevenDigitDriver.STATE_INOP_ZERO: IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF Init THEN stateDigit := E_SevenDigitDriver.STATE_INIT; END_IF IF trigEx.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ONE; END_IF E_SevenDigitDriver.STATE_INOP_ONE: IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF Init THEN stateDigit := E_SevenDigitDriver.STATE_INIT; END_IF IF trigEx.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_TWO; END_IF E_SevenDigitDriver.STATE_INOP_TWO: IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF Init THEN stateDigit := E_SevenDigitDriver.STATE_INIT; END_IF IF trigEx.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_THREE; END_IF E_SevenDigitDriver.STATE_INOP_THREE: IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF Init THEN stateDigit := E_SevenDigitDriver.STATE_INIT; END_IF IF trigEx.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ZERO; END_IF E_SevenDigitDriver.STATE_ERROR: IF NOT Execute THEN stateDigit := E_SevenDigitDriver.STATE_IDLE; END_IF END_CASE // Timer Init to InOp tonToInOp(IN := (stateDigit = E_SevenDigitDriver.STATE_INIT), PT := T#1S); // Set outputs, there are many possibilities. Sa := (stateDigit = E_SevenDigitDriver.STATE_INOP_ZERO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_TWO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_THREE); Sb := (stateDigit = E_SevenDigitDriver.STATE_INOP_ZERO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_ONE) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_TWO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_THREE); Sc := (stateDigit = E_SevenDigitDriver.STATE_INOP_ZERO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_ONE) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_THREE); Sd := (stateDigit = E_SevenDigitDriver.STATE_INOP_ZERO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_TWO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_THREE); Se := (stateDigit = E_SevenDigitDriver.STATE_INOP_ZERO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_TWO); Sf := (stateDigit = E_SevenDigitDriver.STATE_INOP_ZERO); Sg := (stateDigit = E_SevenDigitDriver.STATE_INOP_TWO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_THREE); InOperation := (stateDigit = E_SevenDigitDriver.STATE_INOP_ZERO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_ONE) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_TWO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_THREE); Active := (stateDigit = E_SevenDigitDriver.STATE_INIT) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_ZERO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_ONE) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_TWO) OR (stateDigit = E_SevenDigitDriver.STATE_INOP_THREE); Error := stateDigit = E_SevenDigitDriver.STATE_ERROR; ``` -------------------------------- ### Implement FB_SevenDigitDriverEnable Function Block Logic in IECST Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_07_Robust_Programming_With_State_Machine/Mod07_Exercices.md This IECST code implements the state machine logic for the `FB_SevenDigitDriverEnable` function block. It uses a `CASE` statement to manage transitions between states defined in `E_SevenDigitDriver` based on input conditions like `Enable`, `Vcc`, `Msb`, and `Lsb`, and the state of an internal timer (`tonToInOp`). The logic handles initialization, transitions between display states (0-3), and error conditions. ```iecst CASE stateDigit OF E_SevenDigitDriver.STATE_IDLE: IF Enable THEN stateDigit := E_SevenDigitDriver.STATE_INIT; END_IF E_SevenDigitDriver.STATE_INIT: IF NOT Enable THEN stateDigit := E_SevenDigitDriver.STATE_IDLE; END_IF IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF NOT Msb AND NOT Lsb AND tonToInOp.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ZERO; END_IF IF NOT Msb AND Lsb AND tonToInOp.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ONE; END_IF IF Msb AND NOT Lsb AND tonToInOp.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_TWO; END_IF IF Msb AND Lsb AND tonToInOp.Q THEN stateDigit := E_SevenDigitDriver.STATE_INOP_THREE; END_IF E_SevenDigitDriver.STATE_INOP_ZERO: IF NOT Enable THEN stateDigit := E_SevenDigitDriver.STATE_IDLE; END_IF IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF NOT Msb AND Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ONE; END_IF IF Msb AND NOT Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_TWO; END_IF IF Msb AND Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_THREE; END_IF E_SevenDigitDriver.STATE_INOP_ONE: IF NOT Enable THEN stateDigit := E_SevenDigitDriver.STATE_IDLE; END_IF IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF NOT Msb AND NOT Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ZERO; END_IF IF Msb AND NOT Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_TWO; END_IF IF Msb AND Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_THREE; END_IF E_SevenDigitDriver.STATE_INOP_TWO: IF NOT Enable THEN stateDigit := E_SevenDigitDriver.STATE_IDLE; END_IF IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF NOT Msb AND NOT Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ZERO; END_IF IF NOT Msb AND Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ONE; END_IF IF Msb AND Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_THREE; END_IF E_SevenDigitDriver.STATE_INOP_THREE: IF NOT Enable THEN stateDigit := E_SevenDigitDriver.STATE_IDLE; END_IF IF NOT Vcc THEN stateDigit := E_SevenDigitDriver.STATE_ERROR; END_IF IF NOT Msb AND NOT Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ZERO; END_IF IF NOT Msb AND Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_ONE; END_IF IF Msb AND NOT Lsb THEN stateDigit := E_SevenDigitDriver.STATE_INOP_TWO; END_IF E_SevenDigitDriver.STATE_ERROR: IF NOT Enable THEN stateDigit := E_SevenDigitDriver.STATE_IDLE; END_IF END_CASE // Timer Init to InOp tonToInOp(IN := (stateDigit = E_SevenDigitDriver.STATE_INIT), PT := T#1S); // Set outputs, there are many possibilities. ``` -------------------------------- ### Committing Changes to Git Repository Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/SomeGitTools.md After staging files, this command commits the changes to the local Git repository with a descriptive message. The '-m' flag allows for a concise commit message directly in the command. ```Git CLI >git commit -m "Version de base" ``` -------------------------------- ### Define EM_PrepareProduct_1_typ Structure (IECST) Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_03_Interface/MOD_03_Exercice Solution_Losung.md Defines a structure type for the first product preparation module, encapsulating two instances of XV_Valve_typ components. ```iecst TYPE EM_PrepareProduct_1_typ STRUCT xvValve_11 : XV_Valve_typ; xvValve_12 : XV_Valve_typ; END_STRUCT; END_TYPE ``` -------------------------------- ### Mermaid: ISA-88 Class Diagram for Pick & Place Equipment Module Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Revision/2024_S4_Examen_1.md Represents the ISA-88 Equipment Module structure for a Pick & Place system using a Mermaid class diagram. It shows `EM_PickAndPlace` as the main equipment module, composed of `CM_Gripper`, `CM_Axis_X`, and `CM_Axis_Z` as control modules. ```mermaid classDiagram class EM_PickAndPlace { } EM_PickAndPlace -- CM_Gripper EM_PickAndPlace -- CM_Axis_X EM_PickAndPlace -- CM_Axis_Z ``` -------------------------------- ### Call IECST Function Block with VAR_IN_OUT Extended Structure Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This IECST snippet demonstrates calling a function block `FB_StopAxisTwoEncoder` and passing an instance of the extended structure `stAxisTwoEncoder` to its `ioAxisInfo` parameter. The `VAR_IN_OUT` keyword implies that the function block can both read from and write to the passed structure, enabling efficient data manipulation without copying large data sets. ```iecst (* With ST_AxisTwoEncoder *) fbStopAxisTwoEncoder(ioAxisInfo := stAxisTwoEncoder); ``` -------------------------------- ### Pushing Local Changes to Remote Git Repository Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_LAB/SomeGitTools.md This command uploads all committed changes from the local repository to the configured remote repository (e.g., GitLab). It synchronizes your local work with the shared remote version. ```Git CLI >git push ``` -------------------------------- ### Process Modbus Frame Data with IECST Endianness Conversion Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_04_Data_Structure/README.md This IECST program demonstrates how to process a raw Modbus frame, extract 32-bit integer values, and handle endianness. It iterates through the frame, populating a structured variable (`stResult`) by byte-swapping values into a union, then assigns the converted DINTs to specific energy fields. This logic is crucial for correctly interpreting Modbus data from devices that use a different byte order. ```iecst VAR modBusFrame : ARRAY[1..GVL_Modbus.MB_FRAME_SIZE] OF BYTE := [0, 8, 143, 237, 0, 41, 3, 189, 255, 254, 21, 231]; stResult : ST_SolveModbus; // Number of INT (32 bits - 4 bytes) in the frame int32Loop : INT; // Number of Byte in INT iRegInt32 : INT; iCheck : INT; iCheckLoop : INT; END_VAT // Only used to check if the program runs (not needed for algorithms iCheck := iCheck + 1; iCheckLoop := 0; // Dispatch registers from Frame to Struct FOR int32Loop := 1 TO GVL_Modbus.NUMBER_OF_INT32 BY 1 DO FOR iRegInt32 := 1 TO GVL_Modbus.TYPE_SIZE_IN_BYTE BY 1 DO // Next line is not usefull, write it to help debug if needed iCheckLoop := (int32Loop-1) * GVL_Modbus.TYPE_SIZE_IN_BYTE + iRegInt32; stResult.arMyRegisters[int32Loop].myBytes[(GVL_Modbus.TYPE_SIZE_IN_BYTE+1)-iRegInt32] := modBusFrame[(int32Loop-1) * GVL_Modbus.TYPE_SIZE_IN_BYTE + iRegInt32]; END_FOR END_FOR // Total active energy, should be 561133 stResult.TotalActiveEnergy_Wh := stResult.arMyRegisters[1].diMyResult; // Total reactive energy, should be 2687933 stResult.TotalReactiveEnergy_VARh := stResult.arMyRegisters[2].diMyResult; // Total apparent energy, sould be -125465 stResult.TotalApparentEnergy_VAh := stResult.arMyRegisters[3].diMyResult; ``` -------------------------------- ### Function Block Execute Done Base State Machine Diagram Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_07_Robust_Programming_With_State_Machine/README_DE.md Visual representation of the state transitions for a function block's internal state machine, including states like Idle, Init, InOp, Done, and Error, and the triggers for transitions. ```mermaid --- title: Function Block Execute Done Base (Partial) --- stateDiagram-v2 [*] --> Idle Idle --> Init : Execute Up Done --> Idle : Execute Down Init --> InOp Init --> Error : SetError InOp --> Error : SetError Error --> Idle : Execute Down InOp --> Done ``` -------------------------------- ### Mermaid: State Diagram for E_State Enum Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_06_Revision/2024_S4_Examen_1.md Visual representation of the state machine described by the `E_State` Enum, showing transitions between states like `Aborted`, `Clearing`, `Stopping`, `Stopped`, `Resetting`, `Execute`, and `Aborting`. Includes an `E_stop` transition to `Aborting` from multiple states. ```mermaid stateDiagram-v2 [*] --> Aborted Aborted --> Clearing Stopping --> Stopped Stopped --> Resetting Resetting --> Execute Execute --> Stopping Clearing --> Aborting : E_stop Stopped --> Aborting : E_stop Execute --> Aborting : E_stop Resetting --> Aborting : E_stop Aborting --> Aborted ``` -------------------------------- ### Call Seven-Segment Driver Enable Function Block in Structured Text Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_07_Robust_Programming_With_State_Machine/Mod07_Exercices_DE.md This snippet declares an instance of the 'FB_SevenDigitDriverEnable' function block and then calls it. This function block is responsible for enabling or controlling the seven-segment display driver. The code has been tested in simulation with ctrlX Works. ```Structured Text VAR fbSevenDigitDriverEnable : FB_SevenDigitDriverEnable; END_VAR // Call FB fbSevenDigitDriverEnable(); ``` -------------------------------- ### Compare PROFINET RT and IRT Features Source: https://github.com/hei-synd-autb/autb-docs/blob/main/AutB_MOD_11_Synchronized_Motion_With_Real_Time_Ethernet/Sandbox.md This section highlights the key differences between PROFINET Real-Time (RT) and Isochronous Real-Time (IRT) communication. It focuses on critical aspects such as cycle time, jitter, hardware requirements, and typical applications, aiding in the selection of the appropriate PROFINET variant for specific industrial automation needs. ```APIDOC PROFINET RT vs. PROFINET IRT Differences: Feature | PROFINET RT | PROFINET IRT ----------------------|------------------------------|------------------------------ Cycle Time | Milliseconds | Microseconds Jitter | Low | Near-zero Hardware | Standard Ethernet | Specialized Ethernet Applications | General automation | High-speed motion control ```