structured text programming

Join Date
Mar 2015
Location
bandung
Posts
11
hi, i think this is my first time to use structure text program in OMRON. i use it for make fuzzy logic to control voltage induction generator. but, to make the member function of fuzzy logic is difficult. do you ever make structure text for make the application in fuzzy logic or in omron PLC. please help me to finish my final project.thank you
 
Last edited:
start with only 3 like low,mid,high
your inputvalue is member of only 2 classes
make the input to percent.
so 50 % is mid 1, low 0 and high 0
now draw a line from 0%,1 to 50%,0 that is membership of low
a line from 0%,0 to 50%,1 and down to 100%,0 this is mid.
make yourself the high one
now for program.
every member has three parts, one going up, one staying up, and one going down
to keep it simple :
membership low: y=(in-xlow)/(xhigh-xlow)*(yhigh-ylow)+ylow.
this is a function with 5 inputs and 1 value
this will give you three membership values
example 40% value gives low 0.2 andmid 0.8 high 0
now make same for other inputs.
now you need to make the knots.
this is the if rules, but it is a calculation
show wwhat you made and i will give you the rest
 
oh, i have 9 rules and this is the member function.
The parameter used to define membership function of dirtiness
less,medium and high are [0 0 4],[1 5 9] and [6 10 10]. Similarly
Membership function for quantity low,average and large are [ 0 0
4],[1 5 9], and [6 10 10]. Membership Function for washing time less, medium and
high are [0 0 20],[10 25 40] and [35 50 50].

so if i make this fuzzy logic in matlab application is easy. but, in my final project, i must define this membership function in structure text implemented to OMRON. so, can you help me to make the structure text program?

because, when i make the IF-THEN rule in structure text program, the OMRON can define what i mean.
the example:
1.if(dirtiness is less) and (quantity is low) then (washing time
is less).
i make it in structure text like:
IF((dirtiness<= less) AND (quantity<=low)) THEN
WashingTime:= less ;
END_IF;
"and 0 error when i compile this program"

but, in this case i can't define the membership of the value. like dirtiness less [0 0 4]. the OMRON can't known the expression of "[".

i wait for your answer. because i think you can help me to finish my final project. thank you
 
Last edited:
I have attached a export file in codesys, and the real program for a wago.
watch the sequence how i did it.
like fuzzy knots and defuzzy.
it works with an array to find out the bounds and values of each member.
the If lines in labview need a function or FB in omron, as it is not an IF statement but a real calculation.
The IF stands for : when the value of the members is greater then 0 the fuzzyout should be calculated.
I did it with 5 members and 7 members, however 3 is fine
so you will get 9 rules that is correct, Now please keep in mind to have the feeling (engineersvalue) in to a standard 100%
the mebership goes from 0 to 1
so rewrite the rules in matlab and send it over i will have a look at it.
 
oh, so i must make the program in matlab?
and by the way, the program have you made, where i can make that program to know how the program run?
matlab? cx-programmer ?
and, can we have more conversation but not in this area?
i'm sorry ask you more about this program. but, i really need it. it is because my final project. thank you for your assist. and i only make the program in cx-programmer. if i have done it, i hope you can correct it. thank you so much.
 
No you can make it in cx programmer.
i made you a pdf file of the programs.
Now you can see how the Structured text is
I documented it for 5 memebers, please keep it to 3 so you will get 9 knots as you described.

if any questions please put them here, as others can learn from it.
i put on the subscription
 
thank you, i will learn about it. and if i have a problem i will ask you again.and i will send you the program i have done and you can correct it.thank you.
 
good day mr. shooter, i have already make the program in fuzzy. and i feel complicated to make defuzzy. for make the member function, fuzzy and implication, i can do that in the cx-programmer but for make in defuzzy i feel complicated.
can you see my program and help me to solve defuzzy? this is my program and i make it in cxp form.
how i can attach my file?
 
good day mr. shooter, i have already make the program in fuzzy. and i feel complicated to make defuzzy. for make the member function, fuzzy and implication, i can do that in the cx-programmer but for make in defuzzy i feel complicated.
can you see my program and help me to solve defuzzy? this is my program and i make it in cxp form.
 
Sorry can not see your program, as i do not have cx-one.
However you can download codesys from .com and see how i did the defuzzyfication.
You can make it a lot simpler, by just finding the minimum value (without the zeros) and then find the median of all of them. That will give you an output signal.
Read a little theory on it .and see how matlab is doing this.
 
can you please make a PDF file,that is readable for me.
and you want to learn , so i just give you some handles do not expect to do your homework.
 
thanks mark,
i did read it.
osman you will need to understand the fuzzy basics first before you write any program.
First explain fuzzyfying
You will need to calculate the membership of the input to a member:
in the matlab they work with triangles(i know other forms are possible)
less is 1 at 0% and 0 at 50% of dirty.
if dirt is 40% of full scale the dirtlessmember for dirty is 0.2
dirtmedium= 0.8
dirthigh is 0



same for quantity
quantitylow
quantityaverage
quantityhigh
lets suppose you have 75% of fullquantity.
so quantitylow =0
quantityaverage = 0.5
quantitylarge=0.5

now for rules:
you will have 9 rules as explained before.
if dirtmedium and quantitylarge then cleantime =2 hour
here we have as example 0.8 and 0.5
the result resultrule1:= min(dirtmedium,quantitylarge)(because we are AND)
you will see numbers for each rule between 0 and 1
result is a cleantime 2 hr. for 0.5 value
resultrule2: if dirthigh and quantitylarge cleantime is 3 hr.
min(dirthigh,quantitylarge)= 0.2 at 3 hr.
average of all lines is weighted so 0.5*2+0.2*3+all other rules=1.6 hr cleantime for example.
please send your matlab (if you send the example i will stop any help as this means you saw something but you dont understand fuzzy at all.
 

Similar Topics

Hello everyone: I have been able to read and write data via canopen interface through ADS read and write functional blocks in Twincat PLC...
Replies
9
Views
4,283
Good day to all, I'm a proficient PLC Programmer in the Ladder format. Just recently I'm studying the Structured Text Programming and it's nature...
Replies
12
Views
20,808
This question is addressed to those who have ample experience with both LL and ST. I know only ladder logic. I find that many a time it takes...
Replies
32
Views
26,996
Hi all, I am trying to the GX IEC Developer and are trying the ST programming mode. But how do you make a Pulse --|P|-- ?? Does any of you have...
Replies
12
Views
12,537
Hi, I have been working with PLC systems for the past five years, up to now all of my programs have been written in ladder logic. Now I have...
Replies
3
Views
6,416
Back
Top Bottom