Questions tagged [structured-text]

Structured text is one of the five languages supported by the IEC 61131-3 standard, designed for programmable logic controllers (PLCs).

From Wikipedia: Structured text is one of the five languages supported by the IEC 61131-3 standard, designed for programmable logic controllers (PLCs). It is a high level language that is block structured and syntactically resembles Pascal, on which it is based. All of the languages share IEC61131 Common Elements.

78 questions
0
votes
2 answers

How to pass variable type as an argument to an function in IEC61131-3 structured text (TwinCAT3)?

This is what I would like to have (this is a constructor for FB object): METHOD FB_init : BOOL VAR_INPUT bInitRetains : BOOL; bInCopyCode : BOOL; //My variables: typeOfVariable : TYPE; // This obviously doesn't…
Jakub Szlaur
  • 1,190
  • 3
  • 20
0
votes
1 answer

How to link CSS element in TwinCat 3 HMI, to parameter

I used status indicator web component in my HMI HTMLhost in twincat. I created HTMLhost and added to script these lines:
0
votes
1 answer

Change a value from A to B in a certain time

I want it to take a certain time for a value to change between value A to value B. It works this way, but I am limited by a BYTE (255) which makes the scale bad if I want to use larger numbers. And I cant figure out how. I therefore want help to…
cha28
  • 21
  • 5
0
votes
1 answer

How to find a length and used elements in array structured text

Array_Length_u8:=SIZEOF(SkippedElements_au8)/ SIZEOF(SkippedElements_au8[0]); I am using this formula to find the array length but its doesn't execute and always showing 256 as result
jeram .j
  • 1
  • 1
0
votes
1 answer

Version Control with Structured Text files (*.ST, *.POE,*.bak)

I would like to do version control with my structured text project (I use infoteam openpcs) for industrial applications. The problem is that each time I modify an *.ST file, I get changes also in *.POE and *.bak corresponding files. Is there any…
bardulia
  • 25
  • 10
0
votes
2 answers

Concatenate variable

I need to concatenate a string and an integer and a string into a variable - in this case an input. The inputs are named as following: DI_Section1_Valve AT %I*: BOOL; DI_Section2_Valve AT %I*: BOOL; DI_Section3_Valve AT %I*: BOOL; Now, I want to…
Thoft
  • 3
  • 2
0
votes
3 answers

TwinCAT Systemtime-Timestruct to milliseconds since epoch

I need to convert the timestruct I get from Beckhoffs function block "FB_LocalSystemTime" to milliseconds since epoch to receive the local computer time in milliseconds. Unfortunately I can't find a function to convert this timestruct. Any help is…
timosmd
  • 149
  • 7
0
votes
2 answers

How to dynamically create fb instances during runtime on a plc?

I'm new to PLC programming and we need to create a library for a project. We need dynamically created function block instances during the runtime. There is a concept described on the codesys…
Jkirchho
  • 3
  • 1
0
votes
1 answer

C style function in structured text?

Our company has bought our first of many Beckhoff PLCs and I am currently developing a state machine. What I typically do in C is using a switch case in which every case calls a function, the state function of that particular state. This state…
0
votes
1 answer

Generation of triples from text for KG

I am trying to process documented text and extract triples data from the text to build a graph. I have used the stanford nlp module for generating triples, it gives good results. I want to generate domain specific triples and process the text data.…
Aravind
  • 1
  • 2
0
votes
1 answer

Initialize a Function Block using __NEW that has explicitly defined the FB_init method

Suppose I have a function block (A) that has defined the FB_init method, for example: {attribute 'enable_dynamic_creation'} FUNCTION_BLOCK A METHOD FB_init : BOOL VAR_INPUT bInitRetains : BOOL; bInCopyCode : BOOL; parameter:…
0
votes
3 answers

TwinCAT : Getting a file (FB_FileGets)

I am developing a code to get a text file in twincat. I am using the block functions: FB_FileOpen FB_FileGets FB_FileClose I build on the example on the website…
hachete14
  • 3
  • 1
0
votes
0 answers

Why am I getting an accumulator extension warning after all of my math?

I am writing a program that checks the temperature of the materials required to mix concrete. It then will execute a formula to determine what the water temperature needs to be to reach the desired concrete temperature. I have all of the correct…
Jackson148
  • 115
  • 1
  • 8
0
votes
1 answer

TwinCAT CoE: Write to SDO

I'm pretty new to the EtherCAT/CANopen universe and trying to implement a custom slave. The slave is passing conformance test so far and want to write to one of my Slave Data Objects, the slave is attached to a CX5120, which is found by the XAE and…
DK999
  • 13
  • 3
0
votes
1 answer

How to log LREAL values to file?

I'm new to PLC programming and I'm trying to keep track of an LREAL variable in some existing structured-text code. I'm using Omron's CX-Programmer with a simulated CJ2M. My first instinct was to log all changes in value to SD card, using…
Andrew Paul
  • 152
  • 8