ST practice ideas.

Here is SOPDT simulator written in SCL.
I hope you'll find it useful.
Best regards,
Pandiani
 
Using ANY for the element as well gives you the option of using the same block to process int/dint/real arrays.

So how do you pass a function to a function? In C you can pass a pointer to a function that does the compare and another function that does the swap. It seems that in SCL there is no way to do this except to hard code the compare and swap or pass a UDT type number that can be used as a index into a select statement.

In C++, Java and Basic now the concept of interfaces makes it easy to write the qsort once and use it over and over again.

Pandiani, where is the SCL code?
 
I thought I had attached it, but now I realize that .SCL is not a valid file extension. It was rejected and I didn't check it. Here's .txt file that contains the code.
Sorry....
 
So how do you pass a function to a function? In C you can pass a pointer to a function that does the compare and another function that does the swap. It seems that in SCL there is no way to do this except to hard code the compare and swap or pass a UDT type number that can be used as a index into a select statement.

In C++, Java and Basic now the concept of interfaces makes it easy to write the qsort once and use it over and over again.

In s7 there is no such thing as pointer to function in C. In CoDeSys v3 they have added some OOP things to plc programming, they even have the pointer to function, but that is not usable in plc program. I think it has its use with some system functions. Dont really know, just read some help on it.

Thanks for the code pandiani.
 
In s7 there is no such thing as pointer to function in C.
I know. I was just pointing that out to the rest of the forum.
The problem I have is that the PLC Open guys present their **** as a standard when everyone knows there are more Rockwell and Siemens PLCs out there than Codesys/PLC Open platforms and yet they can't do what was done in the 1970's in C and unix. Codesys/PLC open is a huge step backwards if they can do what C does.

In CoDeSys v3 they have added some OOP things to plc programming, they even have the pointer to function, but that is not usable in plc program.
[/quote[
So Codesys 3 doesn't follow the standard exactly does it? It kind of ruins the defintion of the standard or maybe the standard is flawed.
I say the standard is flawed still people persist in wanting a flawed standard that isn't really standard.
 
qsort and stuff

Here is the quicksort. Its dynamic so that it takes array of int,dint,real(tested) byte and char (untested, dunno where to use char tough). if you find any bugs, please inform. Also suggestions on how to improve would be nice.

I first wrote recursive quicksort in c++, then removed the recursion. That way i could first concentrate on partition logic, then on how to use stack to remove recursion and on when to push to stack and pop from stack. Also to be honest, debugging with Visual Studio is much easier. Overloading is very nice too. Hope Siemens will really work on improving the scl editor and debugging features.

I improved usage interface compared to my selection sort to take array and one element from array (as adviced by ld) to get array lenght and element datawidth. Function itself could be improved atleast by sorting small partitions with insertion sort or similar.

Next on the filter. I think I'll look first on simulating analog butterworth filter (need to find out how it is made and component values calculated) so I can better relate the digital version.

Peter if you have code for the filter in C i will gladly accept it, i believe it would help a Lot.

If I feel like o_O, I might do Peters sequencer first added with JesperMPs good ideas.

On pandianis predictor, I dont yet know what variable is doing what:confused:. Need to look at it later.

Thank you.
 
HMI, WinCC Flexible rollin list

I have been thinkin that state machine. And I have one problem I cant get my head around. If I have hmi, lets say siemens TP177B and use obviously WinCC Flex. How could I easily get to show state message texts. The problem seems to be that "lesser" panels like it, do not support scripts, so I cant use MOD in calculating tagindex. So I cant just easily use DB with array of strings and index trough it. I already found out that I cannot even make:

Code:
TYPE Event
STRUCT
      Text : STRING[50];
      TimeOf : TIME;
END_STRUCT
END_TYPE

As i cannot do tag that has array of types. Only last element is good for tag. So i need to have time inserted in string and use array of strings.

Any ideas on easy(efficient) way of vizualising messages?
 

Similar Topics

Compactlogix controller, program has 28 conveyors that use TON's to start the conveyors. The TT sounds a warning horn during start and the DN...
Replies
10
Views
524
Out of interest, I'd like some thoughts on what would be considered best practice with regards to a 2-position turntable control scheme (see...
Replies
17
Views
1,174
I'm looking for some starter kits but there aren't so many on the market, so I'm thinking about buying individual components for my needs. I just...
Replies
15
Views
2,490
I'm building a S7-300 rack to work on my Siemens Classic Step 7 programming skills. I've worked now and then with Siemens hardware, usually...
Replies
19
Views
6,529
Hello everyone, I am looking to get a job as a junior automation engineer. I know the basics of PLC programming with Rockwell and Siemens PLCs...
Replies
4
Views
1,793
Back
Top Bottom