9/7/2012 10:25 AM | |
Joined: 8/23/2012 Last visit: 11/18/2024 Posts: 118 Rating:
|
Code of FB (to scl source file): --------------------------------------------------------------------------------------------------------- {SCL_CreateDebugInfo := 'y'} FUNCTION_BLOCK FB1 NAME:'Invertor' AUTHOR:'' FAMILY:'' // Typical attributes { S7_m_c:='true'; S7_blockview:='big' } VAR_INPUT open {S7_m_c:='true'}: BOOL; close {S7_m_c:='true'}: BOOL; opened {S7_m_c:='true'}: BOOL; closed {S7_m_c:='true'}: BOOL; END_VAR VAR_OUTPUT status {S7_m_c:='true'} : STRING[14]; valve_status {S7_m_c:='true'}: WORD; END_VAR VAR opening :BOOL; closing :BOOL; fault : BOOL; END_VAR BEGIN; //Fault, both position : opened and closed together IF opened AND closed THEN fault:=true;ELSE fault:=false; END_IF; //state logic IF open AND NOT opened AND NOT fault THEN opening:=true; closing:=false; ELSIF close AND NOT closed AND NOT fault THEN closing:=true; opening:=false; ELSIF fault THEN opening:=false; closing:=false; END_IF; //status logic IF opened AND NOT fault THEN valve_status:=w#2#0000_0000_0000_0001; //opened - 1 ELSIF closed AND NOT fault THEN valve_status:=w#2#0000_0000_0000_0010; //closed - 2 ELSIF opening THEN valve_status:=w#2#0000_0000_0000_0100; //opening - 4 ELSIF closing THEN valve_status:=w#2#0000_0000_0000_1000; //closing - 8 ELSIF fault THEN valve_status:=w#2#0000_0000_0001_0000; //fault - 16 ELSE valve_status:=w#2#0000_0000_0000_0000; //unknown - 0 END_IF; // CASE WORD_TO_INT(valve_status) OF w#2#0000_0000_0000_0000: status:='Unknown'; w#2#0000_0000_0000_0001: status:='Opened'; w#2#0000_0000_0000_0010: status:='Closed'; w#2#0000_0000_0000_0100: status:='Opening'; w#2#0000_0000_0000_1000: status:='Closing'; w#2#0000_0000_0001_0000: status:='Fault'; END_CASE; END_FUNCTION_BLOCK ---------------------------------------------------------------------------------------- Block icon for this block and faceplate in attachment AttachmentPDLs.zip (299 Downloads) |
9/7/2012 11:29 AM | |
Joined: 11/4/2011 Last visit: 1/19/2025 Posts: 253 Rating:
|
1. You forgot to include pictures for Status Display (IL_valve_unknown.bmp, IL_valve_opened.bmp, IL_valve_closed.bmp, IL_valve_opening.bmp, IL_valve_closing.bmp) 2. You can't use APL functions in your own hand-made block icons and faceplates. APL functions require many-many special objects and properties in the icon and faceplate. If you want it, you should copy any nearest APL icon/faceplate and change it. And also to read a lot about APL specifics in the APL Style Guide Or you can take icon from the Standard library. If so then you can generate faceplate in the WinCC. But! You can't take APL block icon and generate faceplate in Faceplate Designer. Because it is very simple (not advanced) and could be used just for the Standard blocks. |
This contribution was helpful to
1 thankful Users |
9/7/2012 11:43 AM | |
Joined: 8/23/2012 Last visit: 11/18/2024 Posts: 118 Rating:
|
Yes.. i open APL_OpenFacePlate in Global Script C ... terrible ... too long to understand algoritm. But how i can simple do own faceplate and link it with my block icon? So maybe i try change APL block icons, but it is very bad . Attachmentvalve.zip (277 Downloads) |
Last edited by: Eli_47 at: 9/7/2012 11:48 AM |
|
9/7/2012 12:26 PM | |
Joined: 11/4/2011 Last visit: 1/19/2025 Posts: 253 Rating:
|
You did a mistake in the properties of you Block Icon: Servername = PCS7 Invertor control It was important to write "Control" with the capital. In the open-script I saw the hint: lpszControl = strstr (lpszServerName, " Control"); Try to use the standard function to open faceplate: PCS7_OpenGroupDisplay_V6. And don't create your faceplates just like you did with simple pdl. Use Faceplate Designer like I did for you ;) Put your graphic objects to @PG_INVERTOR_STANDARD.pdl, but not the @PG_INVERTOR.pdl AttachmentPCS7 Invertor Control.zip (298 Downloads) |
Follow us on