Sign in to follow this  
Followers 0
Guest siemensPLC

SCL Array of Struct?

4 posts in this topic

Is it possible to make an array of a self defined struct in Siemens SCL? I made the struct in a DB. The struct contains some history data of my installation... I want to define an array of 50 containing this struct. Ex: Values - Struct Limit - REAL Max - INT Time - DT END_STRUCT History ARRAY[1..50] OF Values I know that it is possible in C++, but is it also possible in LAD/STL/FBD or SCL? Regards

Share this post


Link to post
Share on other sites
I dont know SCL, but in s7-manager you can do UDT-structs and use them in DBs as in C++. Key-Word is UDT. :*-( Edited by Seppo Alanen

Share this post


Link to post
Share on other sites
UDTs can be defined in SCL as well.

Share this post


Link to post
Share on other sites
Yes it is possible in Siemens SCL? You made the struct in a DB. The struct contains your data this is your DB example DB10 Before you create UDT example 10 (Create new Source.File) Source1.File // Make Your UDT10 Type UDT10 Structur Limit : REAL; // Limit of your Device Max : INT; // Max Value Time : S5Time; // data Time for your use End_Structur // Make Your UDT11 Type UDT11 Structur Device: INT; // Number of Device Param: Array[1..50] of UDT10; // Structur of your Parameters End_Structur // Make Your DB10 Data_Block DB10 UDT11 Begin Source2.File FUNCTION_BLOCK FCB10 Title = 'Test' // Test for this Example // // Version : '1.0' Author : 'HenonR' Name : Test Family : Examp VAR_INPUT Point1: INT; // Pointer 1st Element Point2: INT; // Pointer 2nd Element Block: UDT11; // data Block (Inser DB10) Param: INT; // Number of Parameter Device: INT; // Number of Device Limit: REAL; // Limit Value END_VAR VAR_OUTPUT MAX: REAL; // Max value END_VAR BEGIN MAX := Block.Param[Point1].Max; Block.Device := Device; Block.Param[10].Limit := Limit; END_FUNCTION_BLOCK This is a Example for Insert Input (Block) you use an other FC or FB in SCL, because in KOP,FUP,AWL is very Hard. FUNCTION FC11: REAL BEGIN FB10,DB20 ( Point1:= 1 ,Point2:= 2 ,Block:= DB10 ,Param:= 3 ,Device:= 1 ,Limit := 0.768 , MD100 := MAX); FC11 := MAX; // RETURN Value of Function FC11 OK := True; END_FUNCTION

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0