![]() |
||
|
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
| ||
New Here? Please read this important info!!!
|
|
#1 |
|
Member
![]() Join Date: Aug 2005
Location: rousse
Posts: 2
|
PID algorithm for PLC of twincat
Hi everybody,
I have to design PID controlled regulator(position and velocity) of Beckhoff TwinCat SoftPLC controller. I need your help to write the PID algorithm. I am looking for any information(code) about PID algorithms for PLCs, not especially for TwinCat. Building of programming modules for standard and modified PID algorithms. Building the human-machine interface (HMI) of a PC for visualizing of the parameters of the developed PID algorithms. Investigate the parameters influence of the PID regulator over its characteristics. Investigating of the processes of a PID regulator system. That's my diplom. my mail is mr_garchev@yahoo.com |
|
|
|
#2 |
|
Member
|
Do a search
Search this site. There are lots of threads covering this topic.
Andrew |
|
|
|
#3 |
|
Member
![]() Join Date: Jul 2005
Location: Achterhoek
Posts: 87
|
Hi garchev,
I don't know much of Beckhoff but they sell motion software. This software is running on a PC or a CX1000 from Beckhoff as far as I know. It is better to use that than writing it. Best regards, Henry |
|
|
|
#4 |
|
Member
|
Garchev,
Henry is correct the NC Controller that is part of the Beckhoff TwinCAT software has the functions for position and velocity corrections built into it as a standard. Also by using that you are able to take advantage of the PLC Open motion control Function Blocks when writing your control program. also the algorithm that your trying to create is going to vary depending on the scan time you have set in your controller. As to the HMI question what are you using for your HMI software and which drivers have you chosen to use? these are things that we need to know to be able to help. |
|
|
|
#5 |
|
Member
![]() Join Date: Aug 2005
Location: rousse
Posts: 2
|
a
Building of programming modules for standard and modified PID algorithms. Building the human-machine interface (HMI) of a PC for visualizing of the parameters of the developed PID algorithms. Investigate the parameters influence of the PID regulator over its characteristics. Investigating of the processes of a PID regulator system.
my work is:Building of programming modules(codes)(instruction list or stuctured text) of TwinCAT PLC soft. -standard position pid algorithm -standard velocity pid algorithm - modified position pid algorithm - modified velocity pid algorithm AND Investigate the parameters influence of the PID regulator over its characteristics. |
|
|
|
#6 |
|
Member
|
Garchev,
I understand the code part of what you are asking. I still do not know what you are using for your visualization i.e. Visual basic.net, wonderware, indusoft...etc. that's my first question as to the code I am trying to understand if you are intentionally trying to re-invent the wheel here? the function blocks that are predefined in the PLC Open library meet most all of the requirements for doing industrial projects and in considering that someday there will be somebody else maintaining the machine they will be more easily recognizable by them. If as it appears that you do not wish to use them then the first order of business that you will have to address is to create custom data types to handle the passing of the axis information similar to the ones that are in the NC control provided. shown here: TYPE NCTOPLC_AXLESTRUCT STRUCT nStateDWord : DWORD; (* Status double word *) nErrorCode : DWORD; (* Axis error code *) nAxisState : DWORD; (* Axis moving status *) nAxisModeCon : DWORD; (* Axis mode (feedback from NC) *) nCalibrationState : DWORD; (* State of axis calibration (homing) *) nCoupleState : DWORD; (* Axis coupling state *) nSvbEntries : DWORD; (* SVB entries/orders (SVB = Set preparation task) *) nSafEntries : DWORD; (* SAF entries/orders (SAF = Set execution task *) nAxisId : DWORD; (* Axis ID *) nOpModeDWord : DWORD; (* Current operation mode *) nCtrlLoopIndex : DWORD; (* Axis control loop index ( old variable: nReserved2_HIDDEN : DWORD )*) fPosIst : LREAL; (* Current position (absolut value from NC) *) fModuloPosIst : LREAL; (* Current position as modulo value (e.g. in degrees) *) nModuloTurns : DINT; (* Modulo turns *) fVeloIst : LREAL; (* Current velocity (optional) *) fPosDiff : LREAL; (* Position difference (lag distance) *) fPosSoll : LREAL; (* Setpoint position *) fVeloSoll : LREAL; (* Setpoint velocity *) fAccSoll : LREAL; (* Setpoint acceleration ( old variable: fReserve1_HIDDEN : LREAL ) *) fReserve2_HIDDEN : LREAL; (* reserved *) fReserve3_HIDDEN : LREAL; (* reserved *) fReserve4_HIDDEN : LREAL; (* reserved *) END_STRUCT END_TYPE and here: TYPE PLCTONC_AXLESTRUCT STRUCT nDeCtrlDWord : DWORD; (* Control double word *) nOverride : DWORD; (* Velocity override *) nAxisModeReq : DWORD; (* Axis operating mode (PLC request) *) nAxisModeDWord : DWORD; (* *) fAxisModeLReal : LREAL; (* *) fActPosCorrection : LREAL; (* Correction value for current position *) nReserved_HIDDEN : ARRAY [32..127] OF BYTE; END_STRUCT END_TYPE then you will need to set the scan time of your plc in such a way that the information is passed to the PLC as soon as there is new information available which will require you to know your network update time and re-act accordingly. Then you will need to begin writing move blocks with your PIDs integrated into them to do your corrections on the fly no mean feat in and of itself especially when they have been done in advance for you as shown here: MC_MoveAbsolute( Execute:= , Position:= , Velocity:= , Acceleration:= , Deceleration:= , Jerk:= , Axis:= , Done=> , CommandAborted=> , Error=> , ErrorID=> ); or MC_MoveAbsoluteOrRestart( Execute:= , Position:= , Velocity:= , Acceleration:= , Deceleration:= , Jerk:= , Axis:= , Done=> , CommandAborted=> , Error=> , ErrorID=> ); These blocks are defined for all controllers not just TwinCAT which means that everyone following behind you will be able to read them and understand what your trying to do. If you still want to follow this course set up the structures and I will try to help as I am able as long as you understand that this is no small project. good luck Keeper |
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Topics
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| learning PID for Allen-Bradley ... | Ron Beaufort | LIVE PLC Questions And Answers | 9 | August 23rd, 2005 01:40 PM |
| PID Autotune algorithm | vishal-s | LIVE PLC Questions And Answers | 4 | July 2nd, 2005 02:13 PM |
| AB PLC5 PIDs | Derek McFarland | LIVE PLC Questions And Answers | 23 | March 2nd, 2005 01:18 AM |
| Use a PID? | MarBa | LIVE PLC Questions And Answers | 4 | May 8th, 2003 08:31 PM |
| how often should I trigger the PID? | Ron Beaufort | LIVE PLC Questions And Answers | 11 | February 22nd, 2003 10:57 AM |