You are on page 1of 62

‫گام‌های‌پیکربندی‌یک‌چارت‌‪CFC‬‬

‫چارت‌‪CFC‬‬
‫ایجاد‌چارت‌‪CFC‬‬
‫کار‌با‌ویرایشگر‌‪CFC‬‬
‫پنجره‌کاتالوگ‬
‫فانکشن‌بالک‌های‌از‌قبل‌آماده‌شده‬
‫نوع‌فانکشن‌بالک‬
‫درج‌یک‌فانکشن‌بالک‌به‌یک‌‪CFC‬‬
‫مشخصات‌یک‌فانکشن‌بالک‬
‫پایه‌های‌ورودی‌‪‌/‬خروجی‌بالک‬
‫اتصال‌ورودی‪/‬خروجی‌های‌بالک‬
‫اتصال‌متنی‬
‫کتابخانه‌پروژه‬
‫بروز‌آوری‌فانکشن‌بالک‌های‌یک‌چارت‬
‫فانکشن‌بالک‌های‌نوع‌‪Multi Instance‬‬
‫بالک‌های‌‪OB‬‬
‫اجرای‌فانکشن‌بالک‌ها‌‪Run Sequence‬‬
‫گروه‌اجرایی‌‪Runtime Group‬‬
‫بهینه‌سازی‌اجرای‌بالک‌ها‬
‫کامپایل‌و‌دانلود‌چارت‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫‪ CFC‬برگرفته‌از‌سه‌کلمه‪ Continuous Function Chart‬می‌باشد‪‌.‬که‌مهمترین‌ابزار‌برنامه‌نویسی‪ PCS7‬به‌‬ ‫چکیده‬
‫شمار‌می‌رود‪‌.‬این‌ابزار‌همان‌طور‌که‌از‌اسمش‌پیداست‌برای‌پیاده‌سازی‌الجیک‌کنترل‌پیوسته‌به‌‬
‫کار‌می‌رود‌‪‌.‬ابزار‌دیگر‌برنامه‌نویسی‌در‌ ‪ ،PCS7‬چارت‌های‌ ‪ SFC‬نام‌دارد‌که‌برای‌کنترل‌ترتیبی‌‬
‫(‪‌)Sequential‬می‌باشد‪.‬‬
‫در‌این‌فصل‌با‌مواری‌مانند‌نحوه‌کار‌با‌ویرایشگر‌‪ ،CFC‬مفاهیم‌پایه‌فانکشن‌بالک‪‌.‬نحوه‌درج‌‬
‫فانکشن‌بالک‌ها‌در‌چارت‌های‌ ‪ CFC‬و‌کامپایل‌و‌دانلود‌آنها‌به‌ ‪ CPU‬آشنا‌شده‌و‌در‌نهایت‌با‌نحوه‌‬
‫تست‌بالک‌ها‌در‌زمان ‪ Runtime‬کار‌خواهیم‌کرد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫کنترل عملیات یک فرآیند به سه صورت کلی پیوسه‪ ،‬ترتیبی و ترکیبی از این دو می‌تواند انجام‬ ‫کنترل فرآیند‬
‫شود‪ .‬بیشتر عملیات یک پلنت فرآیندی توسط فرآیندهای پیوسته توصیف می‌شود‪ .‬این موضوع با‬
‫ایجاد چارت‌های ‪ CFC‬در ویرایشگر ‪ CFC‬سیستم ‪ PCS7‬محقق می‌شود‪.‬‬
‫برنامه کنترل به زبان ‪ CFC‬برای کنترل عملیات پیوسته‪ ،‬که بایستی به طور مداوم توسط ‪ CPU‬اسکن و‬ ‫چارت ‪CFC‬‬
‫پردازش شود‪ ،‬به کار می‌رود‪.‬‬
‫چارت ‪ CFC‬مهم‌ترین ابزار برنامه‌نویسی ‪ PCS7‬می‌باشد‪.‬‬
‫چارت ‪CFC‬یکی از اجزاء قابل درج در محیط ‪ SIMATIC Manager‬می‌باشد‪.‬‬
‫توسط ویزارد ایجاد پروژه به صورت خودکار در سطوح پلنت ایجاد می‌گردد‪.‬‬
‫بهتر است چارت ‪ CFC‬را در محیط ‪ Plant View‬ایجاد کرد‪.‬‬
‫توصیه می‌شود که نام هر چارت ‪ CFC‬پس ایجاد چارت تغییر یابد‪.‬‬
‫برای پیاده‌سازی برنامه کنترل یک پلنت با چارت‌های ‪ CFC‬دو روش وجود دارد‪:‬‬
‫‪ ‬پیاده‌سازی کنترل تمام بخش‌ها و سطوح فرآیندی در یک ‪CFC‬‬
‫‪ ‬نوشتن برنامه کنترل هر سطح از پلنت در یک ‪ CFC‬جداگانه‬
‫برای ایجاد و تکمیل چارت‌های ‪ ،CFC‬بلوک‌های واقع در کتابخانه ‪ PCS7‬در چارت‌های ‪ CFC‬درج‬ ‫ایجاد چارت‬
‫می‌شوند‪ .‬که شامل بلوک کنترل فرایند و بالک‌های مانیتورینگ مقادیر فرایندی می‌باشد‪ .‬پس از درج‬
‫بالک‌ها در محیط ‪ ،CFC‬ورودی و خروجی‌های این بلوک‌ها به طور مستقیم در ویرایشگر ‪ CFC‬به هم‬
‫متصل و پارامتر‌های بالک‌ها مقداردهی می‌شود‪.‬‬
‫تجهیزات فرایندی مثل موتور و وولو (‪ )Motors and Valves‬از دیدگاه ‪ ،PCS7‬با عنوان ‪ Process Tag‬شناخته‬ ‫‪Process Tag‬‬
‫می‌شوند‪ .‬برای کنترل چنین تجهیزاتی‪ ،‬از قبل در کتابخانه ‪ ،PCS7‬چارت‌های ‪ CFC‬تحت‌ عنوان ‪Process‬‬
‫‪ Tag Type‬آماده شده است‪ .‬که در کتابخانه‌های استاندارد در شاخه ‪ Template‬دسته‌بندی‌شده‌اند‪.‬‬
‫برای حفظ روشن ساختار پروژه مطابق با سطوح فرایندی پلنت‪ ،‬چارت‌های ‪ CFC‬همیشه در‬
‫پوشه‌های سلسله مراتبی پلنت (‪ )PH‬ایجاد و نگهداری می‌شوند‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
CFC Charts
 The block instances you need to solve a technological task definition can be divided into any number of charts.
 A CFC chart consists of six pages (overview display)
 1 page consists of a work area and two marginal bars.
 Automatic, chart-spanning marginal bar management
 User-friendly signal monitoring
 AutoRoute
 Resources are completely managed for the user.
 1 to 1 documentation for the entire information contents
In principle, there are three basic steps:
1. Creating empty CFC charts in the plant hierarchy
2. Copy Blocks from PCS7 Libraries to Master data Library
– Inserting individual blocks from MDL in an empty CFC chart
3. Interconnecting the inputs and outputs of blocks and assigning parameter values to them
.‫می‌باشد‬CFC ‫با زبان‬PLC ‫ یک ابزار گرافیکی برای نوشتن برنامه‌های‬CFC‫ویرایشگر‬
‫خروجی آنها به هم صورت‬/‫) بالک‌های از قبل آماده شده در یکی از شیت‌ها و اتصال ورودی‬Insert( ‫ایجاد برنامه کنترل با درج‬
:‫ اتصاالت ممکن شامل‬.‫می‌گیرد‬
‫ در یک شیت یک چارت‬IO ‫ بین فیلدهای‬
‫ بین بالک‌های تابع درون چارت‌ها‬
‫ برای مدیریت سیگنال‌های مبداء و مقصد‬Margin bar ‫ استفاده از‬
‫مزایا‬
‫ زبان برنامه نویسی برای مهندسین طراح‬
‫ دیباگ کردن و راه‌اندازی‬،‫ سرعت بخشیدن به پیاده‌سازی برنامه کنترل‬

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
.‫ باز می‌شود‬CFC ‫ با دابل کلیک روی یک چارت‬CFC ‫ویرایشگر‬
‫) با شش قسمت برای قرار دادن بالک‌های برنامه است‬A(‫چارت باز شده شامل یک شیت خالی‬
.‫ با راست کلیک بر روی تب شیت‌ها در پایین پنجره صورت می‌گیرد‬A ‫) در قبل و بعد از شیت‬B,C,…( ‫افزودن شیت دیگر‬
‫ با کشیدن بالک‌ها از کاتالوگ سمت چپ به داخل محیط و اتصال ورودی و خروجی بالک‌ها به هم به‬CFC ‫برنامه‌نویسی‬
.‫صورت گرافیکی انجام می‌گیرد‬
‫نمایش آدرس‌های وروردی بالک‌ها در نوار خاکستری سمت چپ و آدرس‌های خروجی بالک‌ها در نوار خاکستری سمت‬
‫راست شیت‬
.‫ندارد‬Undo ‫و‬Save ‫ گزینه‬CFC ‫ویرایشگر‬

Introduction to the CFC Editor


The actual editing of the CFC charts such as inserting blocks and assigning parameter values to them is done in the CFC Editor.
As soon as you open a CFC chart, the CFC Editor opens. The editor is always opened in the view in which it was closed the last time you worked with it.
With its normal settings, the CFC Editor is divided up as follows:
 On the right-hand side of the editor you see the chart displayed. If you have opened an empty CFC chart, here you will
simply see an empty space. This is where you insert blocks as required to describe continuous processes. The final job is to
assign parameter values and interconnect the blocks.
 On the left-hand side of the editor you will see the catalog with blocks, libraries, and charts.
All the work that you do with the CFC Editor is saved automatically by PCS 7.
Changing from the Overview to a Single Sheet
You can change from the overview to the single sheet view by double-clicking on the required sheet.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫کاتالوک حاوی فانکشن‌بالک‌ها یا المان‌های برنامه نویسی می‌باشد‪.‬‬
‫از منوی ‪ View > Catalog‬یا از طریق منو ابزار قابل نمایش می‌باشد که دارای سه بخش می‌باشد‪.‬‬
‫‪ – Blocks ‬بخش پیش فرض کاتالوگ بوده و حاوی مجموعه المان‌های پایه برنامه‌نویسی می‌باشد‪.‬‬
‫‪ -Charts ‬شامل لیست چارت‌های ‪ CFC‬دیگر موجود در پروژه و امکان فراخوانی‌آنها در چارت باز شده جاری‬
‫می‌باشد‪.‬‬
‫‪ - Libraries ‬حاوی لیست بالک‌های کتابخانه‌ای مختلف می‌باشد‪.‬‬
‫‪– Step7 Standard Library‬‬
‫‪– PCS7 Libraries‬‬
‫‪– CFC Library‬‬
‫– شامل كتابخانه‌هاي مربوط به نصب بسته‌هاي ‪ Optional‬نظير ‪ F-System‬و ‪CEMAT‬‬
‫تفاوت بالک‌ها‬
‫بالک‌های کتابخانه‌های ‪ PCS7‬برای کارهای پیچیده کنترلی و استفاده از توابع از پیش تعریف شده می‌باشد‪.‬‬ ‫‪‬‬
‫پوشه ‪ Blocks‬حاوی بالک‌های پایه المان اصلی یا ‪ ) BOP( Building Block‬هستند ولی بالک‌های کتابخانه‌های از‬ ‫‪‬‬
‫نوع فانکشن و فانکشن بالک هستند‪.‬‬
‫برخی از بالک‌های کتابخانه‌های دارای یک شکل گرافیکی بنام بالک آیکون در سیستم مانیتورینگ (‪) OCM‬‬ ‫‪‬‬
‫هستند‪.‬‬
‫بالک‌های پایه در هر ‪ OB‬قابل فراخوانی هستند‪ .‬ولی بالک‌های کتابخانه‌های فقط در ‪OB‬های خاص و‬ ‫‪‬‬
‫مشخص شده فراخوانی می‌شوند‪.‬‬
‫با هر بار فراخوانی بالک‌های کتابخانه‌های از جنس ‪ ،FB‬یک ‪DB‬جدیدی به آنها اختصاص داده می‌شود‪.‬‬ ‫‪‬‬
‫برای مشاهده اطالعات کامل در خصوص بالک مورد نظر‪،‬کلید ‪ F1‬را بر روی بالک کلیک نمایید‪.‬‬ ‫‪‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
Blocks
Organization Blocks (OBs). Between the operating system and the user programs there are the so-called 
“Block” is an important concept in PCS 7. A summary of the blocks used in the system is listed in Table above 
When a block is created, it must be "declared" as a function block (FB), a function call (FC), or a basic operation, (BOP).
A FB is a block with memory; in other words the data exist during processing from one cycle to another and can be 
accessed. To make the data accessible, a data block (DB) is created for each block instance.
In a multi-instance block, the calling FB contains subsidiary FBs but only one common DB is created. 
A FC is a block without memory; in other words the values generated by the block are processed immediately. No data 
block is required for a FC. A FC does not have default values at the outputs.
A BOP is also a block without memory.They are used for simple functions such as AND, OR, etc. 
Basic operations are program components in CFC and are entered as the SCL statements during compilation. 
BOPs are located in the CFC Chart folder. Refer to Picture where BOPs are indicated by the book icons. 

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫‪Integrating Libraries‬‬
‫تلفیق کتابخانههای از پیش‌ساخته در برنامه کاربر‪ -‬موقع نصب سیستم مهندسی (‪ )PCS7-ES‬کتابخانههای ‪ PCS7‬که حاوی بالکها‬
‫و چارتهای از پیش ساخته هستند‪ ،‬به صورت اتوماتیک نصب میگردند‪.‬‬
‫بالکهای مورد نیاز برای ایجاد برنامه کاربر بایستی در پروژه تلفیق (‪ )integrated‬شوند‪.‬‬
‫برنامه کاربر به کمک ویرایشگر چارتهای ‪ CFC‬و ‪ SFC‬ایجاد میگردد‪ .‬بالکهای ارایه شده در محیط ‪ CFC‬اساساً از کتابخانههای‬
‫واقع در ‪ S7Manager‬در آدرس ‪ File -> Open -> Libraries‬نشات می‌گیرند‪.‬‬
‫برای مشاهده کتابخانهها میتوان به مسیر ‪ File -> Open -> Libraries‬مراجعه کرد‪.‬‬
‫برای نمایش و مخفی کردن این کتابخانهها نیز میتوان از فرمان ‪ File -> Manage -> Hide / Display‬استفاده کرد‪.‬‬
‫‪Master Data Library : MDL‬‬
‫کتابخانه خاص پروژه می‌باشد‪ .‬از نسحه ‪ PCS7 V7.0‬به باال عالوه بر پروژهها میتوان کتابخانهها را نیز در یک ‪ Multiproject‬قرار‬
‫داد‪.‬‬
‫میتوان یکی از این کتابخانهها را به عنوان کتابخانه خاص داده‌های پروژه برای ذخیرهسازی بالکها و چارتها استفاده کرد‪ .‬تا‬
‫در تمام پروژهها به صورت یک شکل از بالکها و چارتها استفاده کرد‪.‬‬
‫کتابخانه ‪ MDL‬تنها میتواند حاوی یک پوشه ‪ S7 Program‬باشد‪.‬‬
‫برای تعریف یک کتابخانه درج شده در یک ‪ ،Multiproject‬به عنوان کتابخانه ‪ ،MD‬در محیط ‪ Component View‬کتابخانه را انتخاب‬
‫کرده و از فرمان زیر استفاده کنید‪.‬‬
‫‪File  Multiproject  Define as Master Data Library‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
Master data Library
It is recommended that the blocks used in a project (user-defined or the system libraries) are collected into the project master library.
Block types used in a particular project, no matter they are PCS 7 library blocks or created by user, they have to be available in the master data
library.
After you are sure that all blocks required are in the master data library or located in a project library, it is recommended to hide all other
libraries including the PCS 7 standard libraries as they have been adapted into the project library.
To hide a library, use the Manage function of the SIMATIC Manager, the menu path, File > Manage. See Picture.
From time to time, you have to be sure that blocks used in a project are in the master data library. It is particularly important that there is no
conflict in block numbers and symbolic names within the master data library.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫بالک‌های پایه (‪)Elementary Blocks‬‬
‫حاوی بالکهایی برای انجام عملیات پایه ‪ )BOP( Step7‬در چارت‌های ‪ CFC‬میباشد‪ .‬این بالکهای پایه مانند ‪ CMP_R‬و ‪ SQRT‬در کتابخانه‬
‫‪ CFC‬قرار دارند و به همراه ویرایشگر ‪ CFC‬نصب میشوند‪.‬‬
‫بالکهای تکنولوژیکی (‪)Technological Blocks‬‬
‫دسته بالکهای زیر توابع پایه برای انجام تسکهای اتوماسیون را فراهم میکند‪:‬‬
‫‪ ‬فانکشن بالکها (‪ ) Function blocks‬مانند ‪LIMITS_P ،INT_P ،AVER_P‬‬
‫‪ ‬بالکهای کنترل اپراتوری (‪ ) Operator controlblocks‬مانند ‪ OPD ،OP_A_LIM‬به همراه ‪ Faceplate‬های مربوطه‬
‫‪ ‬بالکهای پیام (‪ ) Message‬مانند ‪MESSAGE , MSG_CSF‬‬
‫دسته بالکهای زیر به همراه صفحات ‪ Faceplate‬مربوطه برای مانیتورینگ و بهرهبرداری در ‪ ،OS‬تسکهای پیچیده را پردازش میکنند‪.‬‬
‫‪‬‬ ‫‪Controller block CTRL_PID, CTRL_S‬‬
‫‪‬‬ ‫‪Motor blocks MOTOR, MOT_REV, MOT_SPED‬‬
‫‪‬‬ ‫‪Valve blocks VALVE, VAL_MOT‬‬
‫‪‬‬ ‫‪Interlock display INTERLOCK‬‬
‫‪‬‬ ‫‪Dosage DOSE‬‬
‫‪‬‬ ‫‪Ratio controller RATIO_P‬‬
‫‪‬‬ ‫‪Monitoring blocks MEAS_MON, DIG_MON‬‬
‫‪‬‬ ‫‪Maintenance blocks ELAP_CNT, SWIT_CNT, OB1_TIME‬‬

‫بالک‌های درایور کانال (‪)Driver Blocks‬‬


‫بالک‌های درایو واسط‌هایی به ماژول‌های ‪ I/O‬فراهم می‌کنند‪.‬‬
‫‪ CH_AI, CH_AO, CH_DI, CH_DO for the individual channel‬‬
‫– درایور‌ کانال‌های دیجیتال و آنالوگ در کارت‌ها می‌بشند‪.‬‬
‫‪ MODxx, RACK, SUBNET, OB_xx, CPU_RT for module, chain and CPU diagnostics‬‬
‫– بالکهای ‪MODxx‬برای درایور‌ کارت ماژول‌ها و تشخیص و عیبیابی ‪ CPU‬هستند‪.‬‬
‫‪ PA_xx, PO_xx PROFIBUS PA drivers‬‬
‫– بالکهای ‪PA_xx‬برای درایورهای کانال پروفیباس ‪ PA‬هستند‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫بالک‌های تبادل داده بین دو سیستم (‪)Communication Blocks‬‬
‫بالکهای ارتباط شبکه در کتابخانه ‪ PCS7 Library V6.1‬قرار دارند این بالکها عبارتند از ‪ SEND_B0‬و ‪ REC_B0‬برای ‪ 128‬مقدار‬
‫باینری و ‪ SEN_R‬و ‪ REC_R‬برای انتقال ‪ 32‬مقدار ‪ Boolean‬و ‪ 32‬مقدار ‪Real‬‬
‫‪ ‬هر دوی این جفت بالکها برای تبادل داده و ارتباطات از طریق ‪ System Bus‬مناسب هستند‪.‬‬
‫کتابخانه استاندارد ‪)Standard Library‬‬
‫کتابخانه استاندارد از نسخه ‪ 5‬بسته نرمافزار ‪ Step7‬به بعد بازسازی شده است و حاوی مجموعه بالک‌های زیر میباشد‪.‬‬
‫فانکشنهای سیستمی(‪ :) System Functions‬شامل فانکشنهای سیستمی(‪ ) SFC‬و فانکشن بالک‌های‬ ‫‪‬‬
‫سیستمی(‪ ) SFB‬می‌باشند‪ .‬به‌طوری که در سیستم مهندسی ‪ AS‬یکپارچه شده و بلوکهای کاربر قادر به‬
‫فراخوانی آنها میباشند‪.‬‬
‫بالک‌های ‪ : S5-S7 Convert‬بالکهایی برای تبدیل برنامههای ‪ Step5‬به ‪ Step7‬هستند‪.‬‬ ‫‪‬‬
‫دسته بالک‌های ‪ : IEC Functions‬شامل بالکهایی مانند انجام عملیات رشتهای (‪ ) I-STRING‬و مقایسه (‪) MAX‬‬ ‫‪‬‬
‫می‌باشند‪.‬‬
‫دسته ‪ : Communication Blocks‬بالکهای برای تبادل داده روی شبکه می‌باشند‪ .‬که شامل توابع (‪ ) FC‬برای‬ ‫‪‬‬
‫ارتباطات ‪ Prsfibus DP‬میباشد‬
‫گروه ‪ : PID Control‬شامل فانکشن‌بالکهایی (‪ ) FB‬برای کنترل ‪ PID‬هستند‪.‬‬ ‫‪‬‬
‫دسته ‪ : TI-S7 Convert‬شامل بالکهای برای تبدیل برنامههای ‪ TI‬به ‪ S7‬میباشند‪.‬‬ ‫‪‬‬
‫نکته‬
‫کتابخانه )‪REDUNDUNT_IO (V1‬تا نسخه ‪ 6.1‬نرم‌افزار ‪PCS7‬و کتابخانه ‪ REDUNDANT IO CGP‬در‬
‫نسخه ‪ 7.0‬و باالتر برای سیستم‌های ‪H‬تحمل‌پذیر خطا به همراه ‪I/O‬افزونه موجود می‌باشد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
When you place a block on a CFC chart, you place only its instance on the chart.
Instance means a usage of a block type.
When dragging the Valve block, FB73, from the PCS 7 library and dropping it on to a CFC, an instance of FB73 is placed on the chart. The
block type is left in the Blocks folder (Prog1) and in the CFC Chart folder. See Picture Above.
Further Instance blocks can be dragged from a type in the CFC Chart folder rather than from libraries or from the Blocks folder. The former is
faster as no checks for discrepancy between a block type in the CFC Chart folder and Blocks folder are
performed.
Note
 In a real project, the master data library is used throughout a project engineering cycle. Block types are created in or copied
into the master data library. The master data library is the only source for a particular project.
 You can create any number of block instances from a block type. You can assign names to these block instances ,
interconnect them, and assign parameters to them without changing the functionality of the type.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Block types are ready-made program sections that can be inserted in a CFC chart.
When a block type is inserted, a block instance is created. You can create any number of block instances from a block type.
For the SIMATIC S7 CPUs, the block types are created, edited, and compiled in the Ladder Logic editor (LAD), Statement List (STL) editor
or Structured Control Language (SCL) editor.
For PCS 7 projects, function blocks are created in the SCL or by compiling charts as blocks.
Block types of a project are located in the Blocks folder as shown in Picture.
Blocks folder also contains other blocks, e.g. system function blocks (SFB), data blocks (DB), and organization‫ ی‬blocks (OB)
The block types of Blocks folder are also shown in the CFC library catalogue so that they can be accessed in the CFC editor. In Picture
Above, block type of the S7 program,Prog1, are shown.
Block types are obtained from three sources, which are from the system libraries, from user-designed libraries, or created in the project. The
three sources of block types are shown in Picture.
Block types are also stored in the CFC Chart folder. The CFC Chart folder contains blocks indicated by the blue boxes as shown in Picture.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Block types are identified by their numbers and symbolic names while symbolic names are optional.
When the system blocks are used, their symbolic names are automatically entered in the Symbols table.
The name of the block is usually entered in the Symbols table or Symbols editor. In Picture, a block type, FB73, has a symbolic name
VALVE, which is defined in the Symbols table .
Block types
 The block type determines the characteristics (algorithm) for all implementations of this type.
 A block type represents a template for any number of instances and describes how these instances are structured internally.
 All instances of a block type obey the same basic definition as regards their characteristics and their data structure.
Block Instances
 A block instance is a concrete object generated according to its type (blocks) description.
 The type describes the characteristics and information structure for the instance while the current state of each instance
depends on its actually executed operations and is reflected in the information contents.
 Each instance has a unique identifier that enables instances to be distinguished from one another.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫تلفیق بالکها در برنامه (‪)Integrating Blocks‬‬
‫‪ ‬وقتی چارت ‪ CFC‬باز میشود‪ .‬پنجره ‪ Catalog‬را در صورتیکه فعال نباشد‪ .‬از مسیر زیر فعال کنید‪.‬‬
‫‪– View  Catalog‬‬
‫برای استفاده از یک بالک در برنامه‪ ،‬بالک مورد نظر را در بین کتابخانههای موجود جستجو و از تکنیک ‪ Drag‬روی بالک و‬
‫‪ Drop‬بالک بر روی چارت استفاده کرده و بالک را روی چارت قرار دهید‪.‬‬
‫وقتی یک تایپ بالک (‪ )Block Type‬را برای اولین بار در چارت قرار میدهید‪ .‬داده‌های این بالک در پوشه ‪ ،Blocks‬پوشه ‪ Chart‬و‬
‫جدول سیمبل‌ها وارد می‌شود‪ .‬درج داده‌ها در این پوشه‌ها به صورت مخفی صورت می‌گیرد‬
‫(‪.)Import‬‬
‫بالک قرار داده شده درچارت‪ ،‬به منظور فراخوانی و اجرا توسط ‪ ،CPU‬در داخل یک ‪ OB‬ادغام میشود‪ .‬به این معنی که این‬
‫بالک در زمان اجرا در آن ‪ OB‬فراخوانی میشود‪.‬‬
‫از قبل در زمان طراحی کتابخانه‪ ،‬هر یک از بالکهای کتابخانههای ‪ PCS7‬برای نصب در یک ‪ OB‬خاص‪ ،‬تنظیم شده است‪ .‬به‬
‫این معنی که برای هر بالک‪ ،‬یک ‪ OB‬تنظیم شده است‪ .‬که موقع قرار دادن در چارت‪ ،‬در ابتدا در‬
‫داخل همان ‪ ،OB‬ادغام میشود‪ .‬به طوریکه از پنجره ‪ Run Sequence‬می‌توان ‪ OB‬پیش تنظیم را عوض‬
‫کرد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫‪Blocks‬‬
‫یک اصل پایه در مهندسی می‌گوید که چرخ را نباید دوباره اختراع کرد‪ .‬کتابخانههای بالک‌های از پیش‌ساخته حاوی راهحلهایی هستند که میتوان‬
‫استفاده مجدد کرد‪ .‬مستندات بالک (که به صورت آنالین با فشردن کلید ‪ F1‬روی بالک باز میشود) دادههایی که در‬
‫بخش ورودی بالک به منظور حصول نتایج در بخش خروجی بالک‪ ،‬بایستی فراهم شوند را توصیف میکنند‪.‬‬
‫)‪Charts (Templates‬‬
‫راه‌حل‌های کنترلی از پیبش تعریف شده هستند که تنها الزم است با مشخصات فرآیند تطبیق داده شوند‪.‬‬
‫‪ ‬به این معنی که برای اجزای فرآیند مانند موتور یک چارت کنترل به صورت ‪ general‬ایجادشده که فقط بایستی پارامترهای‬
‫بالک‌ها را با پارامتر‌های فرآیند تطبیق داد‪.‬‬
‫‪Import‬‬
‫عمل‪ : Import‬از آن‌جایی که بالک‌های موجود در کتابخانه‌ها به صورت ‪Type‬هستند‪ ،‬قبل از استفاده از آنها بایستی به پوشه ‪ Import ،Blocks‬شده و سپس‬
‫برای پیاده‌سازی برنامه در چارت‌های ‪ ،CFC‬ورودی و خروجی‌های آنها به بالک‌های دیگر متصل شوند‪.‬‬
‫‪Inserting in Chart‬‬
‫قرار دادن در چارت (‪ )‌ Inserting In Chart‬بالک‌ها را می‌توان از طریق ‪ ،Drag & Drop‬در چارت قرار داد‪ .‬برای این کار بالک را در لیست بالک‌های کتابخانه‬
‫مربوطه انتخاب‪ ،‬و آن را در پنجره کدنویسی چارت قرار می‌دهیم (در یکی از شیت ‪ 1‬تا ‪) 6‬‬
‫‪Block Header‬‬
‫هدر بالک حاوی اطالعاتی است که می‌توان بالک را شناخت‪.‬‬
‫‪Set Parameters‬‬
‫برای تغییر پارامتر‌های بالک‪ ،‬بالک را انتخاب و با دابل کلیک یا راست کلیک‪ ،‬پنجره ‪ Object Properties‬را باز می‌کنیم‬
‫‪Connect‬‬
‫اگر قرار است نتایج حاصل از یک بالک توسط بالک دیگر پردازش بیشتری شود‪ .‬خروجی این بالک به ورودی بالکی که این مقدار را پردازش میکند‬
‫متصل میگردد (برای این کار ابتدا در خروجی بالک کلیک و سپس در ورودی بالک دوم کلیک نمایید و یا به روش‬
‫‪ Drag & Drop‬این کار را انجام دهید یعنی پایه خروجی بالک را انتخاب (‪ ) Drag‬و بر روی ورودی بالک ‪ Drop‬کنید‪.‬‬
‫‪Sheet Bars‬‬
‫همچنین میتوان بین بالکهایی که در یک ‪ Sheet‬قرار ندارند‪ ،‬از طریق باز کردن یک پنجره جدید در ‪ CFC‬اتصاالت برقرار کرد‪ .‬به طوری که دو تا شیت‬
‫در دو پنجره مختلف نمایش داده میشوند و اتصاالت بین پایه‌های بالک به همان صورت معمول صورت میگیرد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
.‫ که در گوشه سمت چپ بالک قرار می‌گیرد‬.‫ یک شماره برای نام آن تخصیص داده می‌شود‬CFC ‫با قرار دادن بالک در محیط‬
‫آن نمایان می‌شود که بهتر است یک اسم با معنی مرتبط با فرآیند برای بالک در‬Properties ‫با دابل کلیک بر روی بالک پنجره‬
.‫ وارد شود‬Name ‫قسمت‬

CFC Objects :The most important CFC terms are outlined here.

In CFC, the identifier for a block instance is made up of :


 the chart name, which is unique in the CPU,
 the separator ‘.’,
 and the block name, which is unique within the chart (maximum of 24 characters for the block name).
Blocks :
 In the STEP 7 language usage, blocks are separate parts of the user program defined by their function, their structure, or
their application purpose.
 There are logic blocks (FB, FC,...), data blocks, and user-defined data types.
 Basic instructions: Functions such as AND, SUM, etc. contained in the S7 machine model
 Global addresses: I/O signals, bit memories, counters, timers, and global data blocks

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Block IO
 Each block has a number of different I/Os that are displayed in a table of the properties dialog.
 To find the I/Os quickly in this dialog, you can click in the column head of the table and sort the column in ascending or
descending order.
 The I/Os of a block can be both visible or invisible: You can only see visible parameters in the properties of the block but
not in the representation in the CFC chart.
 You can specify which I/Os in the CFC chart will be visible and which will be invisible. You specify this in the properties
of the block in the “Invisible“ column by unchecking the check box of the relevant I/O to make the I/O visible in the CFC
chart. This function helps to make a CFC chart easier to read.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
make the required interconnections in the charts between outputs and inputs.
You can create the interconnections of blocks conveniently by :
 clicking on the graphic user interface of the CFC editor with the mouse.
 Click first the output of a block and then the input you want to connect to it. After clicking on the input, the interconnection
is displayed as a line.
 The CFC Editor automatically draws lines in the best position.
 The position of the lines has no effect on the function of the interconnection.
Note
 If you make an incorrect interconnection:
 Right-click on the line of the incorrectly interconnection and select the menu command Edit > Delete.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫‪Textual interconnection is a virtual connection arising when a partner chart is moved to another S7 program or when it is created deliberately.‬‬
‫‪Textual interconnection is indicated by a yellow triangle as shown in Picture 2.25.‬‬

‫ایجاد اتصال متنی ‪ :‬دو روش وجود دارد‪.‬‬


‫‪ ‬روش اول‪ :‬روی پایه ورودی یا خروجی بالک مورد نظر با ماوس کلیک کرده و سپس روی پایه ورودی یا‬
‫خروجی بالک دیگر که در صفحه نمایش آورده شده با ماوس کلیک می‌کنیم‪.‬‬
‫– امکان اتصال ورودی به ورودی یا خروجی به خروجی وجود ندارد‪.‬‬
‫‪ ‬روش دوم‪ :‬راست کلیک بر روی ورودی مورد نظر و انتخاب گزینه ‪Textual interconnection‬‬
‫– پنجره مذکور‌ فقط برای پایه‌های ورودی بالک ظاهر می‌شود و آدرس پایه خروجی وارد می‌شود‪.‬‬
‫– در صورت یکسان بودن سطح ‪ Hierarchy‬آدرس مبدا و مقصد‪ ،‬نیازی‌ به ذکر نام سطح نیست و دستور‌ با‬
‫عالمت \\ شروع می‌شود‪.‬‬
‫– نام بالک در یک ‪ CFC‬که شامل چندین شیت می باشد‪ ،‬منحصربفرد است‪.‬‬
‫– پرچم زردرنگ نشان دهنده اشکال در آدرس‌دهی یا عدم شناسایی مقصد می باشد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
If the connected partner is moved back or a purposely-created textual interconnection is fulfilled, the textual interconnection will be closed by
using the Close or “Make Textual Interconnection” function and the yellow triangle disappeared. See Picture
The “Make Textual Interconnections” function can also be performed when compiling program.
Note:
Copying or moving charts in the Plant view within a CPU will retain all the interconnections between charts while adapt the interconnections
automatically to new paths.
When copying or moving a plant hierarchical folder containing chart(s) and picture(s), interconnections between the charts and between
blocks and their graphic objects (icons) are retained and adapted.
Therefore, textual interconnections will not occur in the two cases above.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Exercise
‫ برای‬.‫ ایجاد و در داخل آن بالکهای باال را درج کنید‬test ‫ یک چارت بنام‬Plant View ‫ در‬: ‫تمرین‬
-‫ اجرا می‬OB32 ‫ هر دو بالک در‬.‫را به عنوان سطوح فرآیندی ایجاد کنید‬Reactorsi/Testi ‫این کار پوشه‬
.‫ می‌باشد‬ADD4_P ‫ و دومین بالک یک جمعکننده چهارتایی‬PT1_P ‫ اولین بالک تایپ‬.‫شود‬
------------------------------------------------------------------------------------------------
Steps 1. Call the project in plant view. Create folder.
2. Insert new CFC chart in the corresponding hierarchy container.
3. Define predecessor for installation.
4. Enter blocks from the library into the chart and name them.
5. Set parameters for blocks on the sheet and interconnect them.
6. Compile, download and test program.
------------------------------------------------------------------------------------------------
Procedure In the block names, "i" stands for your group number.
Add PH 1.Select the plant hierarchy view in the SIMATIC Manager via menu command
View  Plant View
Select the "REACTORSi" folder in the project PRO_ASi. Then
right-click and select New Object...  Hierarchy Folder
to insert a new folder. Rename the folder "TESTi"
Create a chart 2.Select the "TESTi" folder,
right-click and select New Object...  CFC
to insert a chart. Name your chart "ATTEMPTi"
Open Chart Select the "ATTEMPTi" chart. To open the chart,
right-click and select Open Object (or double-click)

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Settings for
compile 5. Charts must be converted from the graphic form to machine language and downloaded to the AS.
To initiate the conversion from a CFC chart, select
Chart  Compile  Charts as Program
(or click the circled C Compile icon).
The entire software is compiled for the CPU which is associated with this CFC chart.
A dialog box is displayed for the compilation settings (see slide).
Only "Entire Program" is possible under "Scope" the first time you compile. You can select "Changes only" for any subsequent compilations (after
changes/additions).
Important Option
"Generate module drivers" (only meaningful if there is a minimum of one channel driver in the chart). This
results in the CFC creating additional charts with the required drivers for data transfer with the I/O modules
and diagnostics capability.
A chart "@CPU_RT" is created in addition. The "CPU_RT" block inserted there monitors the CPU
performance in order to avoid a CPU stop (for details on the block functions, please refer to its online help)
Downloading:
The compiled charts must now be downloaded to the CPU. Activate the following menu command to start this
process:
PLC  Download
or click on the Download icon (circled on the slide).
The first time the chart is downloaded, it is only possible to download the entire program (in combination with
CPU Stop and automatic deletion of the program still residing in the CPU).

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Testing in CFC
To test your program, follow the menu path: Debug > Test Mode. You can monitor I/O values by adding them into Watch List. Then, the
values are highlighted in yellow.
Right click on an I/O and then “add I/O to Watch List.
To change a value online, double click an input, e.g. AUTO_OC. The I/O Properties dialog will open and you can set a new value for the
variable. See Picture.
Note
To operate the valve in the CFC Test Mode you set and reset AUTO_OC.
To be able to operate the valve, you need to enable the use of AUTO_OC by setting LIOP_SEL and AUT_L both to be “True”.
The library function VALVE is explained in details in Next Chapter

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
There are two Test Modes namely:
 Process Mode and Laboratory Mode.
 You can choose one of them before testing. To switch between the two modes, follow the menu path:
– Debug > Process Mode (or Laboratory Mode).
In process mode, communication for the online dynamic update of blocks is restricted and thus causes moderate load on the CP and bus.
When the test mode is activated, all blocks are assigned the "watch off" attribute.
The laboratory mode allows convenient and efficient testing and commissioning. In contrast to process mode, the laboratory mode does not
restrict communication for online dynamic update of blocks. So, use the laboratory mode with caution.
When the test mode is activated, all blocks are assigned the "watch on" attribute.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫برای پیکربندی یک چارت ‪ CFC‬مراحل زیر صورت می گیرد‪:‬‬
‫ایجاد یک چارت ‪ CFC‬در یک سطح فرآیندی در محیط ‪Plant View‬‬ ‫‪‬‬
‫باز کردن چارت ‪CFC‬‬ ‫‪‬‬
‫کپی فانکشن بالک‌های موردنظر به کتابخانه ‪ MDL‬پروژه (اختیاری)‬ ‫‪‬‬
‫درج یا قرار دادن فانکشن بالک‌های موردنظر در محیط ویرایشگر ‪)Insert blocks( CFC‬‬ ‫‪‬‬
‫تنظیم پارامترهای بالک‬ ‫‪‬‬
‫– تغيرنام پیش فرض به نام های مناسب‬
‫– تنظیم مقادیر ورودی‪ /‬خروجی‬
‫‪ ‬ترسیم اتصال بین بالک‌های داخل شیت‌های چارت و یا بین چارت‌های ‪CFC‬‬
‫‪ ‬دانلود برنامه کامپایل شده به ‪CPU‬‬
‫‪ ‬تست و دیباگ نمودن برنامه دانلود شده‬
‫نکته‬
‫‪ ‬در‌صورت‌نیاز‌به‌به‌اطالعات‌بیشتر‌در‌مورد‌بالک‌ها‪‌،‬به‌عنوان‌مثال‌این‌که‌بالک‌تابع‌موردنظر‌چه‬
‫ورودی‪/‬خروجی‌هایی‌دارد‪‌،‬بالک‌مربوطه‌در‌کتابخانه‌را‌انتخاب‌کنید‌و‌سپس‌کلید‌ ‪ F1‬را‌فشار‌دهید‪‌.‬این‌کار‌‬
‫راهنمای‌کاربری‌را‌برای‌این‌بالک‌باز‌خواهد‌کرد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫‪With Memory Reset‬‬
‫‪Object ‬ها و ‪ Tag‬ها دز ‪ WINCC‬پاک شده و از نو ساخته می شود‪.‬‬
‫‪ ‬با کامپایل ‪ OS‬دیتا از سیستم ‪ AS‬در ‪ ES‬به ‪ OS‬منتقل می گردد‪.‬‬
‫‪ ‬در صورت ظاهر شدن پیام خطا در شروع کامپایل به معنی کامپایل نشدن یک یا چند ‪ CFC‬می باشد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫‪With Memory Reset‬‬
‫‪Object ‬ها و ‪ Tag‬ها دز ‪ WINCC‬پاک شده و از نو ساخته می شود‪.‬‬
‫‪ ‬با کامپایل ‪ OS‬دیتا از سیستم ‪ AS‬در ‪ ES‬به ‪ OS‬منتقل می گردد‪.‬‬
‫‪ ‬در صورت ظاهر شدن پیام خطا در شروع کامپایل به معنی کامپایل نشدن یک یا چند ‪ CFC‬می باشد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫ می‌توان بالک‌های استفاده شده را بروزآوری کرده و‬،‫در صورتی که تایپ فانکشن‌بالک‌های استفاده شده در چارت تغییر یابد‬
.‫با تایپ جدید جایگزین نمود‬
.‫ انجام می‌گیرد‬CFC Chart ‫ کردن تایپ جدید به پوشه‬import ‫ این کار با‬
.‫ مقایسه صورت می‌گیرد‬Charts ‫ که تایپ جدید وجود دارد و پوشه‬Blocks ‫بین بالک‌های موجود در پوشه‬

Central type changes mean that all instances of a block type already included in CFC charts are automatically updated if the block type is
changed. For example, a user block is modified later after its instances have been used in CFC charts. You can
update all the instances by importing the new type to the CFC Chart Folder.
The function, “Importing block type”, can be found following the menu path: Options > Block Types. See Picture
Alternatively, you can use the New Version function to update block types used in a project. See Picture.
The Block Types dialog is where block types are compared between the Blocks folder and the CFC Chart folder. Block types in these two
folders have to be the same.
The function of the central type change is useful and powerful. If the PCS 7 library blocks have been changed by Siemens due to a newer
release of the system. You have to decide if the newer version of the blocks is to be used in your project.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
If block instances are deleted from a chart or deleted because of deleting charts, their types will not be deleted either from the CFC Chart
folder or from the Blocks folder though the block types are not used in the project.
Block types that are not used in a project can be removed from the project by using the Clean up function as shown in Picture
Using the function, you will be asked if block type is to be removed from the CFC Chart folder (Steps 2 and 3 in Picture) and Blocks folder
(Steps 3 and 4 in Picture 6.10) respectively.
Note
The library blocks, e.g. SFB36 as in Picture, could be removed as they are contained in the firmware of AS.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Locate Change To detect possible changes between e.g.
 already instantiated blocks in the project and

 the associated library substitute


before any further use, you can compare blocks - as shown above:

Right-click on selected blocks or blocks to be checked (here FBs from the


library --> Compare blocks... --> Specify comparison path/objects (here
select block container for the project).

Result A: No deviations identified in compared objects


Result B: List of objects with deviation + specific description

Note This is only a "fast comparison" without additional options (where are any
differences?).
From the PCS 7 viewpoint, the VXM option (Version Cross Manager) offers
more efficient information (also for non-programmers). This application will be
discussed later. However, the VXM does not evaluate the consequences for the
S7 program if the change were carried out.
A further possibility is shown on the next pages.
This indicates the consequences of a possible synchronization with the option
for aborting the commenced synchronization if the change does not appear to
be appropriate (e.g. downloading only possible with CPU stop).

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Functions could call other functions.
The called functions are sub-functions and are block types them. For example, a closed loop control block calls a signaling block and a
controlling block.
When copying a multi-instance block to a project (to the Blocks folder) all sub-blocks have to be copied into the block folder as well.
Note
Called SFBs and SFCs, such as SFC6 (RD_SINFO) or SFB0 (CTU) are located firstly in the PCS 7 libraries and copied into your S7 program
when you compile the calling block.
Called FBs are copied to the block folder when you insert the calling block in a CFC chart if they are located in the same library as the calling
block. Otherwise, the called blocks have to be copied into the S7 program Blocks folder manually.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Multiple Instance The FB602 is structured so that another, already existing FB40 can be called
within it. This FB is detected as static variable with the data type FB and allows
to achieve nesting of variables and concentration of all instance data in one
instance data block (multiple instance).
Structure If you want to look at the structure of your new block, proceed as follows:
- In the block folder of your library, select FB40 (INT_P), then
right-click and select Open Object.
LAD/STL/FBD is opened.
- Close the block only via
File -> Close (Do not save, if you are prompted to save!)
- In this editor open your block FB602 (V_SIM_FB) via
right-click and select Object -> Open
Now you can see the above structure on your screen.
Attributes - Position the mouse pointer in a line (with green marking), then
right-click and select Object properties -> Attributes
to display the table with attributes (properties) of the parameter.
Changes If you change/supplement attributes here, and then save the block, it will be
given an STL identification. The changes must be made known to the CFC (if
the block has already been used). Further consequences arise from the type of
modified attributes.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
The interface between the operating system of a CPU and the user program are the tasks known in S7 as organization blocks (OB).Using these
OBs, specific program sections can be executed at certain times and in certain situations.
There are OBs for CPU startup, for process interrupts, and for cyclic interrupts (with different time bases) etc.
For example, OB32 has cyclic interrupts every 1 second. Function blocks inserted in OB32 are called every second.
When a block is inserted in a chart, by default it is automatically installed in OB35. The cycle time of OB35 is 0.1 seconds.
OBs cannot be inserted nor edited in CFC. In CFC, the OBs are displayed in the Runtime editor.
OBs with different time cycles are set in the HW Config as illustrated in Picture.
Note
The default cycles are set as in Picture. It is recommended not to change the default settings.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫مشخصه‌هایی چون ‪ Run Sequence‬و ‪ ،Runtime group‬برای پاسخ ‪ CPU‬برحسب زمان واکنش‪ ،‬زمان مرده‪ ،‬یا ثبات ساختارهای‬
‫وابسته به زمان‪ ،‬به عنوان مثال کنترل حلقه بسته‪.‬تعیین کننده می‌باشد‪.‬‬
‫برای باز کردن پنجره ‪ Runtime Sequence‬به دور روش می‌توان عمل کرد‪:‬‬
‫‪ ‬از طریق دگمه ‪ Runtime Sequence‬در ‪Tool bar‬‬
‫‪ ‬راست کلیک بر روی بالک و اتخاب گزینه ‪Go to Insert Point‬‬
‫قابلیت‌های پنجره ‪Runtime Sequence‬‬
‫‪ ‬تغییر ‪ OB‬اختصاص داده شده به بالک‬
‫‪ ‬انتقال یک مجموعه ‪Runtime Group‬یا یک بالک خاص از زیر مجموعه یک ‪ OB‬به زیرمجموعه ‪ OB‬دیگر‪.‬‬
‫‪ ‬امکان ‪ drag‬کل یک چارت و ‪ drop‬آن به درون یک ‪ OB‬دیگر‬

‫نکته ‪ :‬در پنجره ‪Runtime Sequence‬فهرست تمامی ‪OB‬ها حتی در صورت عدم وجود ‪OB‬موردنظر در ‪ CPU‬مشاهده می‌شود‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
When a block inserted into a CFC chart, a block is installed in a runtime group in default OB.
It is important to re-locate the runtime group into an appropriate OB.
A runtime group is created when you insert a CFC chart.
When a block is placed on an empty CFC chart, the block is installed inside the group. Subsequently dragged-and-dropped blocks on the chart
are arranged in the group and the order in which they are placed.
‫پردازش‌بالک‬
.‫( است‬Cyclic Interrupt OBs-100ms) OB35‫ در‬PCS7 ‫ محل‌پردازش‌پیش‌فرض‌بالک‌های‬
.‫ قابل‌اجرا‌هست‬Cyclic Interrupt OBs ‌‫ فقط‌در‬PCS7 ‌‫ بیشتر‌بالک‌های‌کتابخانه‬
‌‫ مورد‌نظر‬OB ‌‫ برای‬HWConfig ‌‫در‌صورتی‌که‌حجم‌اجرای‌برنامه‌به‌صورتی‌باشد‌که‌اجرای‌آن‌بیش‌از‌زمان‌تنظیم‌شده‌در‬
.‫وجود‌ندارد‬OB1 ‌‫ با‌مشکل‌مواجه‌خواهد‌شد‌که‌این‌مشکل‌در‬CPU ‌.‫باشد‬
‌‫ شماره‌یا‌ترتیب‌اختصاص‬Runtime Sequence‌‌‫و‌شماره‬OB ‌‫در‌زیرمجموعه‬CFC ‌‫ شماره‌مربوط‌به‌چارت‬Runtime Group ‌‫شماره‬
.‫داده‌شده‌برای‌پردازش‌بالک‌در‌درون‌چارت‌می‌باشد‬
‌‫ها‌را‬OB‌‫ انتخاب‌شده‌تمام‌این‬CPU‌‫‌ممکن‌است‬.‫ لیست‌شده‌اند‬S7‌‫های‌تعریف‌شده‌در‬OB‌‫ تمام‬Runtime Group‌‫در‌فهرست‬
‌.‫پشتیبانی‌نکند‬
.‫ برنامه‌دچار‌فالت‌می‌گردد‬CPU ‌‫در‬OB ‌‫در‌صورت‌عدم‌وجود‬
‌.‫ خواهد‌گرفت‬-/1‌‫ قرار‌گیرد‌در‌این‌صورت‌شماره‬OB35 ‌‫در‌زیر‬Group ‌‫اگر‌بالکی‌به‌صورت‌مستقیم‌و‌بدون‬

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫‪Run Sequence‬‬
‫بر روی آیکون ‪ Run Sequence‬در میله ابزار (که به صورت دایره قرمز رنگ نشان داده شده) کلیک کنید‪ .‬یک پنجره باز میشود‬
‫که در آن تمام بالکهای ‪ OB‬مربوط به ‪ CPU‬فهرست شده است‪.‬‬
‫وقتی یک پروژه ایجاد میشود پیشفرض (‪ )Predecessor‬نصب بالکها در ‪OB‬ها بر روی ‪ OB35‬تنظیم شده است‪ .‬به این معنی که‬
‫وقتی یک چارت ایجاد میشود‪ .‬یک ‪ runtime group‬به صورت اتوماتیک در ‪ OB35‬به اسم همان‬
‫چارت ایجاد می‌شود‪ .‬وقتی بالکها به چارت اضافه میشوند به صورت اتوماتیک در این ‪Runtime‬‬
‫‪ Group‬گروهبندی میشوند‪.‬‬
‫‪Moving the Runtime Group‬‬
‫برای تغییر ‪ OB‬مربوط به یک ‪( Run Time Group‬چارت ‪ )CFC‬سیمبل پوشه ‪ Run Time Group‬ایجاد شده برای چارت جدید (مثالَ‬
‫پوشه ‪Test‬در شکل باال) را با ماوس گرفته و به داخل یک ‪ OB‬دیگر (‪ )OB32‬بکشید که در داخل‬
‫‪ CPU‬این ‪ OB‬با سیکل زمانی متفاوت اجرا میشود‪.‬‬
‫برای اینکه در زمان ایجاد چارتهای جدید‪ ،‬چارت‌ها در یک ‪ OB‬دیگری غیر از ‪ OB35‬نصب شوند بایستی یک پیشفرض‬
‫نصب دیگری (‪ )Predecessor for installation‬تعریف کرد‪.‬‬

‫‪Predecessor for Installation‬‬


‫برای تغییر ‪ OB‬پیش‌فرض‪ OB ،‬مورد نظر (مثال ‪ )OB32‬را اتخاب کرده و سپس با راست کلیک روی آن گزینه ‪Predecessor for‬‬
‫‪ installation position‬را اجرا کنید‪ .‬با این کار مکان جدید پس از تایید پنجره عملیاتی تعیین میشود‪.‬‬
‫لذا بالکهای بعدی در ‪ Run Time Group‬انتخاب شده قرار خواهند گرفت‪.‬‬
‫‪ Run Time Group‬به صورت رنگ سبز روشن خواهد شد و پیشفرض جدید ‪ OB32/test‬در قسمت پایین و سمت راست پنجره‬
‫‪ CFC‬نشان داده خواهد شد‪( .‬شکل را ببینید)‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
The default sequence of blocks in an OB by no means represents the signal flow between the blocks. Generally, blocks should be executed in
a logic sequence which depends on signal flows. For example, blocks in Picture should be arranged in the
following order:
 (1) Block FB_OPEN or FB_CLOSE
 (2) Block VALVE
 (3) Block OUT

To arrange blocks in a logic order, the function “Optimize Run Sequence” is used.
The menu path to call up the function and settings of the function is illustrated in Picture.
If “Optimize run sequence” is performed, the blocks of the group will be arranged according to the signal flow sequence between the blocks.
In debugging and testing, you can activate or de-activate the Optimize run sequence function by select or de-select the Active box (Step 3 of
Picture).

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Reduction ratio
The reduction ratio determines whether the CFC blocks/SFC charts of a runtime group are processed each time or only every nth time the task is
executed. "n" is an integer (n = 2t, where 0 <= t <= 15).
The cycle times are a multiple of the basic reduction ratio of the task.
Example:
Basic cycle of a cyclic interrupt (OB 33): 500 ms
Possible clock cycles with reduction ratio: 1 s, 2 s, 4 s, 8 s, 16 s, etc.
The default setting is 1 so the block/SFC chart is executed in every cycle (in OB 33 every 500 ms).
Phase offset allows a uniform distribution of load within the CPU. It must be considered in conjunction with "n", the reduction ratio. The blocks or
SFC charts of the runtime group are executed as often as specified by "n", offset by "m" units of the task cycle. "m" is an integer, where 0 <= m <=
(n-1).
Example:
Basic cycle of a cyclic interrupt: 500 ms
Reduction ratio: 16 (i.e., the block/SFC chart is processed at intervals of 8 s)
Phase offset: 3. The block/SFC chart is processed at intervals of 1.5 s, 9.5 s, 17.5 s, etc.
The default is 0; in other words, the block/SFC chart is executed without a phase offset.
"Optimize run sequence" option
You can select/deselect the check box in order to include or exclude a runtime group from run sequence optimization. If the runtime groups contains
F objects, the option is not enabled.
You will find more detailed information in: Optimizing the run sequence
"Active" option
You can select/deselect the check box in order to enable/disable the runtime group for processing, if it is not interconnected. An interconnection
always has priority.
In the detail window of the runtime editor in the column "Inactive", the mode of the runtime group is displayed. The name corresponds with that of
the runtime properties field of a block. This character "!" means that the relevant runtime group is inactive; this character "?" means that the runtime
group EN is interconnected or SFC access exists and therefore is not in static process mode (may be active or inactive).
Using the shortcut menu commands Switch on Runtime Group and Switch off Runtime Group, you can select or deselect the option for the selected
runtime group, without initiating the object properties.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
The Optimize run sequence option has to be set one by one for each runtime group. However, the option is set by default.
The Optimize run sequence function is executed by the menu path as illustrated in Picture.
The Optimizing run sequence function is relevant to all runtime groups rather than the blocks in an AS that have been activated for the
function. Therefore, the function could change a large number of blocks contained in different CFC charts and
has a global impact on the behavior of runtime performance of a S7 program.

After optimizing run sequence, the blocks on the


chart, val, are re-arranged.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
Runtime groups can be activated or deactivated individually (for example by a block output of the "BOOL" data type).
If a runtime group is deactivated, the blocks it contains will not be executed when the program is executed.
You can also de-activate an OB in runtime.

‫ دیگر‬CFC‌‫ از‌یک‬CFC‌‫کنترل‌یک‬
‫ را‌انتخاب‌می‌کنیم‬Interconnection to Runtime Group‌‫ کلیک‌و‌گزینه‬CFC‌‫روی‌خروجی‌بالک‌در‌یک‬ 
.‫ را‌انتخاب‌می‌کنیم‬OB‌‫ مورد‌نظر‌بکار‌رفته‌در‌آن‬CFC‌‫ و‬OB‌‫سپس‌از‌لیست‌نمایش‌داده‌شده‬ 
.‫ اول‌ظاهر‌می‌شود‬CFC‌‫با‌این‌کار‌پرچم‌قرمز‌رنگ‌در‌بخش‌اتصاالت‌خروجی‬ 
.‫ اول‌بستگی‌خواهد‌داشت‬CFC‌‫ دوم‌به‌یک‌شدن‌خروجی‌موردنظر‌در‬CFC‌‫ مربوط‌به‬Enable‌‫با‌این‌کار‬ 
.‫ دوم‌عالمت‌سوال‌؟‌ظاهر‌می‌شود‬CFC‌‫بر‌روی‌بالک‌ها‌در‬ 

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Interconnecting Runtime Group Statically
If you select a runtime group in the runtime sequence and open its properties, the Active option is set. This means that all blocks
from this group are taken into account for each OB pass.
If you deactivate this option, none of the blocks in the group are taken into account/processed.
In the associated CFC chart all blocks display a red exclamation mark in the rectangle showing the execution data. This indicates to
the configuring engineer that the block is not active!
Alternative Select the runtime group in the runtime sequence and execute the process using the context menu by
right-clicking and selecting Switch on (activate) Runtime Group or
right-clicking and selecting Switch off (Deactivate) runtime group

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫یک‌فانکشن‌‌بالک به‌دو‌صورت‌در‪ S7‬پیاده‌سازی‌می‌شود‪:‬‬
‫‪ ‬نوشتن یک فانکشن‌ بالک به زبان های پایه ‪ FBD-LAD-STL‬در قالب ‪ FB‬یا ‪ FC‬و فراخوانی آن در محیط ‪CFC‬‬
‫‪ ‬نوشتن‌یک‌برنامه‌به‌زبان‌ ‪ SCL‬و‌کامپایل‌آن‌در‌قالب ‪ FB‬و‌فراخوانی‌آن‌در‌محیط‌‪CFC‬‬
‫‪ FC ‬یا‌ ‪ FB‬موردنظر‌در‌محیط‌‪ Component View‬ساخته‌می‌شود‪.‬‬
‫شماره‌اختصاص‌داده‌شده‌به‌ ‪ FC‬فقط‌در‌رنج‌مجاز‌امکان‌پذیر‌است‪.‬‬
‫شماره‌های‌مجاز‌برای‌تولید‌‪ FC‬توسط‌کاربراز‌منوی‌‪ Options‬تنظیم‌می‌شود‪.‬‬
‫شماره‌مجاز‌از‌‪ 60‬تا‌‪ 700‬برای‌کاربر‌یا‌سایر‌برنامه‌ها‌یا‌ماژول‌های‌قابل‌نصب‌در‌‪ PCS7‬می‌باشد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫در داخل چارت ‪ CFC‬می‌توان ورودی‪/‬خروجی بالک ها را به ‪‌I/O‬های تعریف شده برای چارت متصل کرد‪.‬‬
‫امکان اتصال پایه‌های بالک‌ها برای برخی از بالک‌ها مانند بالک‌های ‪ Driver‬که بایستی به کانال فیزیکی متصل گردد‪ ،‬به ‪Chart IO‬‬
‫وجود ندارد‪.‬‬
‫مراحل فراخوانی یک چارت ‪ CFC‬از چارت ‪ CFC‬دیگر (‪ )Chart In Chart‬عبارت‌انداز‪:‬‬
‫‪ ‬فعال کردن پنجره ‪ Chart Input/output‬از منوی ‪ View‬ویرایشگر ‪CFC‬‬
‫‪ ‬تعریف پارامترهای ورودی و خروجی برای یک چارت ‪CFC‬‬
‫‪ ‬اتصال متغییرهای تعریف شده به ورودی خروجی های بالک‌ها در درون چارت‬
‫– راست کلیک بر روی پایه موردنظر و انتخاب گزینه ‪Interconnect To Chart I/O‬‬
‫– ظاهر شدن پرچم سفید رنگ در بخش خاکستری‌ رنگ‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
Chart in Chart Purpose of this technique: To design clear, well-structured charts.
Chart sections that are repeatedly used with the same structure can be combined to look like one chart with a predefined sheet bar -
and thus like a block with I/O.
Procedure 1. The lower-level chart is created and given interconnections (this can also be carried out in a (master data) library).
2. The previously created chart is inserted in the higher-level chart. There it its displayed like a block; its sheet bar (I/O) was
defined in step 1.
3. If the lower-level chart was created in a library and was dragged into the top chart, it will not be shown in the project's chart folder
(as you can only see the top chart there). The associated blocks are inserted in the runtime sequence. You can change their sequence
in there if required.
Alternative: If you obtain the "New chart" from the Catalog tab "Blocks" and place it as an empty chart in the CFC chart, then you can implement
a top-down approach - i.e. reverse the sequence in points 1 and 2 in the above described procedure:
1. In the higher-level chart, first place "only" empty charts as wildcards for specific functions; the function is documented first
"only" as name of the respective empty "black box". The result is a function overview chart consisting of the various individual
charts.
In the second step, the details are added to these individual charts as lower-level charts, i.e. "filled" with block functionality and
provided with chart interconnections.
3. Now you can interconnect the individual charts in the higher-level chart.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
the chart-in-chart technique is a function for efficient engineering.
This involves inserting one CFC chart into another. The inserted chart then becomes the hierarchical chart and the other the base chart.
This enables you to create a chart once and then use it as the basis for numerous other charts. This means, for example, you can create a
simulation chart for a valve and then insert this simulation chart as a hierarchical chart into the base chart for
the "valve" process tag.
Of course, you can open and edit the hierarchical chart from the base chart at any time.
Example:
As mentioned and shown in Picture, You could place a chart onto another chart. the chart, CFC_val, is placed onto CFC_2.
The chart nesting structure is displayed in the Blocks/charts catalogue as shown in Picture where Chart CFC_2 contains CFC_val.
Picture also shows how to open the original chart (Step 3).

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
Compiling CFC chart as block type (Chart-in-Block)
You can compile a chart as a block. Block instances in the chart become subsections of the chart block. A chart block is then a block type.
Note
To make a chart out of a block, the blocks in the chart must not be installed in a runtime group and they should not have interconnections to
other charts.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫پس از تعریف ‪ I/O‬برای یک چارت‪ ،‬می‌توان چارت را به عنوان یک بلوک کامپایل کرد‪.‬‬
‫لذا برای استفاده از بالک در چارت‌ها نیاز است که برای ‪IO‬های چارت که پارامتر‌های بالک حاصل از کامپایل خواهد بود‪،‬‬
‫کنیم‪.‬‬ ‫تعریف‬ ‫(‪)attributes‬‬ ‫ویژگی‌‌هایی‬ ‫‪SCL‬‬ ‫همانند‬
‫تصویر نشان میدهد که چگونه برای باز کردن خواص متغیر محاوره ارائه شده است که یک نمودار‬
‫‪ I / O‬تعریف را مشخص ویژگی های سیستم برای یک متغیر وجود دارد‪.‬‬
‫پنجره تعریف ویژگی‌ برای پارامترهای انتخاب شده‪ ،‬در تصویر باال نشان داده شده است‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
For analog variables, engineering units are provided at block instances. See Picture.
You can edit and add units in the file and they become available system-wide. When upgrading the PCS 7 system installation, you should
remember to back up the files.

Storing of the engineering


units

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
In the Test Mode of the CFC, you can test and debug your program.
The CFC test mode is convenient for testing one CFC sheet.
To monitor and manipulate variables from different charts and/or from different CPUs, you could use the Dynamic Display function.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Test Mode You must activate "test mode" to test the function downloaded to the AS.
 First activate
Debug  Process Mode Or
Debug  Laboratory Mode
to select/check the appropriate test environment.
 Use the following command to activate/deactivate test mode:
Debug  Test Mode
With laboratory operation, monitoring is automatically activated for the parameters specified "for test". During process operation,
you must select the required block each time and identify it for monitoring by
right-click and selecting Watch On
Test 1 If the test mode is active and the parameters to be tested have a yellow background (default setting for updated values), youcan set
parameters for the input parameter. The new value is written to the AS and to the project.
Change the value on the "First" block, "U" input. Monitor the result on the "Second" block, "V" output.
Test 2 Dynamic Display offers an additional test procedure. You can open a display window in CFC:
View  Dynamic Display
Use "drag and drop" in this window to drag the block parameters you want to monitor (from any of the projects- even from different
CPUs). One line in the table is reserved for each parameter.
Upon activation of test mode, you can monitor or edit (if permissible) these selected parameters.
You can delete several parameters you no longer need by selecting the relevant line, right-clicking and selecting Delete.
You can use the New , Rename or Delete buttons in the table window to create, rename or delete new dynamic displays.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
Additional exercise (option)
Try to recognize the consequences of an OB32 overload. Use the LOAD block from the KURSBS60 library for this purpose (see
slide). Supplement the CFC "Attempti" chart as suggested above.
-----------------------------------------------------------------------------------------------------
Procedure 1. LOAD block: Switch the load on using "ON"=1. Increase the OB32 load by increasing the parameter "CYCL".
2. INT block: With the parameters "TI"=1 and "U"=1, the block will increment the output "ACTUAL" each time OB32 is called. If
Test  Test settings  Monitoring cycle = 1 second
is set in the CFC, the value of the output will be incremented by 1 every second in test mode. This applies to normal operation.
Increase the CYCL input of the LOAD block, and observe the output "V" of the INT block.
Also check the diagnostics buffer of your CPU using the CFC menu
PLC  Module information  "Diagnostics buffer" tab
and the (OB1) cycle time in the tab with this name.
3. Connect the output "V" of the INT block to the input "U" of the MEAS_MON block.
In the latter, select "Long-term archiving" in the properties of the input "U" under "Archive".
4. Compile and download the AS
5. Compile the OS. The parameter "U" of the MEAS_MOS is created there in Tag Logging, in the "System archives" archive.
6. Activate the OS, and create an online trend for this variable. Carry out the same increase to the load in the AS, and check the
reaction on the OS.

‫شرکت پتروفن – بندر امام‬ SIMATIC PCS7 Training ‫ صادق اکبری‬: ‫مدرس‬
96 ‫ پاییز‬-‫آب نیرو‬ CFC Language Tel. 09123182734
‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫‪With Memory Reset‬‬
‫‪Object ‬ها و ‪ Tag‬ها در ‪ WINCC‬پاک شده و از نو ساخته می‌شود‪.‬‬
‫‪ ‬با کامپایل ‪ OS‬متغییر‌ها از سیستم ‪ AS‬در ‪ ES‬به ‪ OS‬منتقل می گردد‪.‬‬
‫‪ ‬در صورت ظاهر شدن پیام خطا در شروع کامپایل به معنی کامپایل نشدن یک یا چند ‪ CFC‬می باشد‪.‬‬

‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬
‫شرکت پتروفن – بندر امام‬ ‫‪SIMATIC PCS7 Training‬‬ ‫مدرس ‪ :‬صادق اکبری‬
‫آب نیرو‪ -‬پاییز ‪96‬‬ ‫‪CFC Language‬‬ ‫‪Tel. 09123182734‬‬

You might also like