سؤال :
باستخدام S7-300 PLC كيف يمكن عمل نظام تنظيم زمني للبدء والتشغيل Ramp generatorالجواب :
هذا مثال لعمل نظام تنظيم زمني لبدء التشغيل والإيقاف Ramp up/down generator
سوف تجد في الآتي دالة FC10 للقيام بالوظيفة ومعها أيضا برنامج اختبار للدالة باستعمال WinCC
وصف الوظيفة Description of functionباستعمال هذه الوظيفة ( الدالة ) فإن المطلوب هو أن تتقارب القيمة الفعلية من القيمة المطلوب الوصول إليها بمعدل زمني معين سواء عند رفع أو نزول القيمة المطلوب التشغيل عليها set value
وصف المتغيرات المستعملة Description of the parameters
Activate - BOOL - in
- the ramp function is executed
- the ACTUAL value is set to the null point (zero value(
R_max - BOOL - in
- the ACTUAL value goes to the specified maximum value
R_min – BOOL - in
- the ACTUAL value goes to the specified minimum value
R_max / R_min
Both 0 - the ACTUAL value goes to the specified null point
Both 1 - the ACTUAL value goes to the specified null point
R_OK
BOOL
in_out
The bit is set when the ACTUAL value reaches the setpoint value
Max_Value
REAL
in_out
Specified input to run up the ramp, maximum value
Null_Point
REAL
in_out
Ramp reset value, zero value
Min_Value
REAL
in_out
Specified input to run down the ramp, minimum value
Actual_Value
REAL
in_out
Output value: current ramp value, ACTUAL value
R_plus
REAL
in_out
Increment for running up the ramp
R_minus
REAL
in_out
Increment for running down the ramp (ramp return)
R_Time
DWORD
in_out
Time in milliseconds for one step, e.g. increment: 1000
time: 1000 ms.
Here the actual value is incremented by 1000 in 1 second, but only until the setpoint value is reached (e.g. R_max/R_min). This defines the degree of increase.
MEG_Time
DWORD
in_out
This is the cycle time of the CPU, which is read out of the OB1
L #OB1_PREV_CYCLE
T "OB1Cycle"
With "OB1Cycle" ( MD123 ) the FC10 is switched to MEG_Time.
The time function is not available if an incorrect cycle specification is given.
Remarks:
If R_max and R_min are identical, the function brings the ramp value Actual_Value to the initial value Null_Point.
If you enter the value 0 for the parameters R_plus, R_minus or R_Time, the function corrects to the value to 1.
If you enter a negative value for the parameters R_plus, R_minus or R_Time, the function turns it into a positive value.
Max Value, Min Value and Null Point are interchangeable. The ramp is always run to the value preset with the parameters R_max and R_min. If, for example, you have set R_max = 1 and R_min = 0, then the actual value approached the maximum value set. Null_Point can also be set to less than Min_Value or greater than Max_Value.
Special features:
If the ACTUAL value is greater than the setpoint value, the function takes the parameter R_minus as increment.
If the ACTUAL value is less than the setpoint value, the function takes the parameter R_plus as increment. This is done regardless of the settings of parameters R_max and R_minus.
So that the function remains independent of the OB1 cycle, you must interconnect the parameter MEG_Time with the local variable OB1_PREV_CYCLE. The function evaluates the parameter MEG_Time and adapts the parameters R_Time, R_Plus and R_minus accordingly.
The function can change the parameters automatically. If you wish to continue using the parameters R_Time, R_Plus and R_minus in your program, you must buffer the parameters.
Description of the networks FC10
1- Reset R_OK bit : Values are always set for the program to ensure easy programming and execution.
2- Checking the Activate bit : If the Activate bit is not set, the ACTUAL value is set to the null point and the function is terminated.
3- Check input values : The parameters R_Time, R_plus and R_minus are checked. These basic values are corrected if necessary so that the ramp function can be executed without any errors.
4- Set ramp increment : The ramp can be approached in two different increments. The function compares ACTUAL and setpoint values and loads the appropriate increment according to the evaluation.
5- Calculate time factor in increment : To ensure that the ramp does not depend on the cycle time, the time value is calculated in the increment.
6: Execute ramp function : The ACTUAL value is changed with the calculated increment, and this in the direction of the current setpoint value. Then a check is made to see whether the setpoint value has been overrun and this is corrected if necessary.
In the following PDF document you will find the STL source of the function FC10 that implements the ramp function.
FC10_1.pdf - ATTATCHED IN THE ATTATCHMENT FILE
لتحميل الملف FC10.pdf وحده اضغط هنا
The following PDF document contains a sample ramp function call. Note that you must buffer the local parameter OB1_PREV_CYCLE before the call.
ob1_1.pdf - ATTATCHED IN THE ATTATCHMENT FILE
لتحميل الملف OB1.pdf وحده اضغط هنا
The following PDF document contains the description of the symbols.
لتحميل ملف الرموز وحده اضغط هنا
Symboltable_1.pdf - ATTATCHED IN THE ATTATCHMENT FILE
The following ZIP archive contains a sample project. This project has been created with STEP7 V4.02.
ramp_1.exe - ATTATCHED IN THE ATTATCHMENT FILE
لتحميل الملف rame_1.exe وحده والذي يشتمل على البرنامج اضغط هنا
The following ZIP archive contains a sample WinCC project. This project has been created with WinCC V4.02. Copy the file onto your hard disk. Double-click the archive and extract it into a directory. The figure shown above is configured in the "Sample.pdl" file. The variables list contains an MPI connection with the parameters:
Station address 2
Slot number 2
You might have to adapt these parameters to your hardware configuration.
WInCCSample_1.exe - ATTATCHED IN THE ATTATCHMENT FILE
لتحميل برنامج الاختبار باستعمال WinCC اضغط هنا
اضغط هنا لتحميل ملف واحد يجمع كل المرفقات
IMPORTANT
The sample program is freeware. Every user can use, copy or forward this program FREE OF CHARGE. The authors and owners of this program take no responsibility whatsoever for the functionality and compatibility of this software. Use of the software is entirely at the users own risk. Since this software is free of charge, there is no warranty or claim for error correction and hotline support