Home
Functions and Function Blocks in ISaGRAF for
Contents
1. Example input_value nb_shifts shifted_value direction Shifts an analog value left or right arithmetically Input value is copied to the output without change if the number of shifts is less than or equal to zero If the number of shifts is greater than or equal to 32 the result is equal to all zeros for left shift and either to all zeros or all ones for right shift depending on the MSB of the input value Shifting is done arithmetically meaning that when a number is shifted to the left zeros are filled in at the right end when a number is shifted to the right MSB is copied to the bit right of it For right shift direction is FALSE for left shift direction is TRUE input_value INT nb shifts INT direction BOOL shifted value INT result shift ival nshifts dir input_value 0100 10101 shifted value 00100 1010 1 shift right with MSB 0 input_value 1100 10101 shifted value 11100 1010 1 shift right with MSB 1 input value 10011 0011 shifted value 0011 00110 1 shift left Page 19 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 8 Data Manipulation Functions Standard Data Manipulation Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description MIN
2. AUTO Auto TRUE Manual FALSE mode BOOL PV Process variable X INT SP Setpoint W INT X0 Value to be output in Manual mode INT KP Proportional gain INT TR Integral time INT TD Derivative time INT CYCLE Calculation and output updating period TMR XMIN Min value of output quantity Y INT XMAX Max value of output quantity Y INT XOUT Output quantity Y INT PID_A TRUE temp_5 1200 manual_temp kp tr td 0s40 0 10000 heater PID_A XOUT Algorithm implemented in this block is the so called independent PID algorithm Kp multiplies all three terms proportional integral and derivative in the following way error SP PV XOUT KP error 1 TR integral error TD derivative error For this type of algorithm optimum KP TR TD parameters according to the Ziegler Nichols method are Page 70 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 forP controller KP 0 5 KPosc for PI controller KP 0 45 KPosc TR 0 83 Tosc for PID controller KP 0 6 KPosc TR 0 5 Tosc TD 0 125 Tosc where KPosc is that KP which causes constant amplitude closed loop oscillations with only P action enabled and Tosc is the period of these oscillations WARNINGS FOR THE USER With respect to PID algorithm using real floating point arithmetic PID algorithm using integer arithmetic suffers from the following additional problems 1 Overflow Overflow is a major problem
3. tbit bit n int Page 13 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SET SET bit_num INT set_reset BOOL INT output input INT Short description Sets or resets indicated bit in an integer Description If bit_num is less than 0 or greater than 31 the input will be copied to the output unchanged Call parameters bit_num Bit number in range 0 to 31 INT set reset New value of the bit BOOL input Integer whose bit is to be changed INT Return parameter output Modified integer INT Prototype new set bitnum sr old Page 14 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 THRSHLD THRSHLD thrsh_val INT int BOOL ne BOOL BOOL au in16 Short description Threshold element Description out is set to TRUE if more than thrsh_val inputs are set to TRUE thrsh_val should be in range 1 to 16 If it is not within range out is set to TRUE Call parameters thrsh_val INT inl BOOL in2 BOOL inl6 BOOL Return parameter out BOOL Prototype alarm THRSHLD maxnum in1 in16 Page 15 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 PACKBOO PACKBOO bitO BOOL bit1 BOOL INT packed bit15 Short description Pack 16 boolean variables into one analog variable Description Packing bits into a word is sometimes needed to prepare data for communication with other devices or I O equipment Call parameters bitO BOOL bit15 BOOL Retur
4. BOOL BOOL BOOL BOOL SWITCC_B TRUE FALSE TRUE FALSE FALSE FALSE FALSE outl SWITCC_B q1 out8 SWITCC_B q8 a See also SWITCH_R SWITCH_A and SWITCH_T function blocks Page 45 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 EN CH Short description Description Call parameters Return params Prototype EN1 IN1 EN2 IN2 Set output to last changed input Whenever any of IN1 IN2 inputs is changed with its corresponding enable input EN1 EN2 set to TRUE output is set to the new changed state of that input If both inputs are changed at the same time in the same PLC cycle and both are enabled the new state of the input IN1 will be output State changes on a disabled input ENx FALSE cannot change the output This block is used where one boolean value Q should be changed from two or more sources If more than two sources exist blocks of this type can be cascaded ENI enable inputl INI inputl EN2 enable input2 IN2 input2 Q output EN_CH enl inl en2 in2 out EN_CH Q BOOL BOOL BOOL BOOL BOOL Page 46 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 LATCH EN OUT IN Short description Binary latch Description If enable input EN is TRUE output follows input IN otherwise output remains unchanged If EN is FALSE at power up the initial value of OUT will be FALSE Call parameters EN enable input
5. BOOL IN input BOOL Return parameter OUT output BOOL Prototype LATCH en in out LATCH OUT Page 47 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 UNPACKBOO UNPACKBOO BOOL _ _bito BOOL _ bit1 packed I bit15 Short description Unpack a word into bits Description Unpacking a word in bits is sometimes needed when managing data coming from communication with other devices or I O equipments Call parameters word INT Return parameter bitO BOOL Br TREE Prototype unpackboo word b0 unpackboo bit0 Page 48 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 2 Counting FBs Standard Counting Function Blocks delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these function blocks containing the function block name and short description CTU Up counter CTD Down counter CTUD Up down counter Currently no functions written by EXOR have been added to this group Page 49 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 3 Timer FBs Standard Timer Function Blocks delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these function blocks containing the function block name and s
6. BOOL QF forward shift data output BOOL QB backward shift data output BOOL SHIFT_B 100 TRUE FALSE FALSE TRUE TRUE outfwd SHIFT_B QF outbwd SHIFT_B QB Page 42 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFTP_B Short description Description Call parameters Return params Prototype SHIFTP_B load BOOL fwd_bwd BOOL clk BOOL BOOL q1 reset BOOL BOOL q2 in1 BOOL in2 BOOL BOOL a7 BOOL q8 in7 in8 qi q2 q3 q4 q5 q6 q7 q8 in2 in3 in4 ind in6 in7 Bidirectional boolean shift register with 8 parallel inputs and outputs Except that it is of fixed length and has parallel inputs and outputs the functioning of this block is similar to that of SHIFT_B block Initially after power up and during reset the whole register contains only Zeros Inputs in2 in7 are parallel inputs only while inputs inl and in8 are both parallel and serial inputs See also SHIFTP_R SHIFTP_A and SHIFTP_T function blocks load on rising edge register is loaded from parallel inputs fwd_bwd shift direction forwards TRUE backwards clk shifts one place on rising edge reset when TRUE clears register to 0 inl parallel input 1 and forward shift data input in2 parallel input 2 in7 parallel input 7 ins parallel input 8 and backward shift data input ql output 1 q8 output 8 SHIFTP_B FALSE TRUE TRUE FALSE TRUE FALSE TRUE ol SHIFTP_B ql 08 SHIFTP
7. MAX MOD MUX4 MUX8 ODD SEL LIMIT RAND Minimum of INTEGERs extensible Maximum of INTEGERs extensible Modulo INTEGER division remainder Multiplexer 4 INTEGER inputs Multiplexer 8 INTEGER inputs Odd parity for na INTEGRER Binary selector INTEGER limiter Random INTEGER generator Page 20 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 MAX_R first_value maximum_of_both second_value Short description Maximum of two real values Description Call parameters first_value REAL second value REAL Return parameter maximum of both REAL Prototype maxval max_r vall val2 Remarks This is the real equivalent of the standard MAX function It does not support an extensible number of inputs Page 21 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 MIN_R first_value a u minimum_of_both second_value Short description Minimum of two real values Description Call parameters first_value REAL second value REAL Return parameter minimum of both REAL Prototype minval min r vall val2 Remarks This is the real equivalent of the standard MIN function It does not support an extensible number of inputs Page 22 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 MUX4 R MUX4_R selector INT value0 REAL value1 REAL REAL result value2 REAL value3 REAL Short description Select one of four real values For any other selector
8. 0 5 of the cycle and this amount of error introduced by the finite resolution can be accepted in most applications If CYCLE is shorter than this one must be aware of the increased influence of the resolution related error rising with the decreasing CYCLE value cycle Cycle time TMR dutyc Duty cycle percentage 0 100 REAL out Output waveform BOOL DUTYCYC 1m30s 20 5 wave DUTYCYC out Page 112 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DUTYCYCM DUTYCYCM cycle TMR dutyc1 REAL BOOL out1 dutyc2 REAL BOOL out2 dutyc8 REAL BOOL out8 Short description Description REMARK cycle 1 71 cycle 2 Multiple digital oscillator with variable duty cycle Within each cycle on each channel the outX signal will be TRUE for dutycX percent of the cycle duration and FALSE for 100 dutycX percent of cycle duration The FALSE to TRUE transition on each two successive channels will be apart by 0 125 cycle In this way FALSE to TRUE OFF to ON transitions will be uniformly spaced over the cycle duration This is very important since this function block is typically used as a pulse width modulator whose outputs drive electrical heaters known to create current surges in a short interval following the switch on By spacing the OFF to ON transitions uniformly over the cycle duration the power supply can be designed for just Isurge instead of 8 Isurge max which is the worst case fo
9. 5 on_off TWO_ST OUT Page 98 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 STEP_REG Short description Description STEP_REG SP REAL PV REAL DB REAL KD REAL KI REAL BOOL OPEN KP REAL NORMA REAL BOOL CLOSE PD TMR DT TMR CYCLE TMR OT TMR 3 state controller with PID velocity algorithm Internally the block can be conceived as being composed ot two sub blocks PID and 3 state Controller connected in series Input to the PID sub block is the deviation value SP PV and its output is the internal variable Y The difference of PID output values in the current and previous calculation cycles Y k Y k 1 is fed to the input of the 3 state Controller sub block If this value exceeds the positive value of the dead band output OPEN is set to TRUE ON and output CLOSE is set to FALSE OFF If it exceeds the negative value of dead band OPEN is set to FALSE and CLOSE is set to TRUE providing that minimum output ON and OFF times have elapsed The minimum duration of TRUE ON state on any output is equal to PD and the minimum duration of FALSE OFF state is equal to DT Input sampling period CYCLE depends on the process that is controlled Since PID parameters also depend on the process a good rule of the thumb is to choose CYCLE to be approximately equal to Tmin 10 where Tmin is defined as min KD KP Page 99 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 Call parameters Retu
10. A 65 DSEL_A 66 DSEL_R 87 DUTYCYC 112 DUTYCYCM 113 E EN_CH 46 EXP 8 EXP R 7 H HARDWARE SPECIFIC FBs 117 HARDWARE SPECIFIC FUNCTIONS 37 HYSTER_A 60 L LAG 97 LATCH 47 LIM AL A 67 LIMIT R 27 LIMMON A 68 LIMMON R 88 LINTRANS 105 LN 9 LOGIC FUNCTIONS 12 M MAJOR A 69 MAJOR R 89 MAX R 21 MIN R 22 MONO 109 MUX4 R 23 MUX8 B 25 MUX8 R 24 O OSC _SIN 110 OSC SQW 111 P PACKBOO 16 PID A 70 PID REX 102 PLAUS A 73 PLAUS R 90 PT100 37 R RAMP A 79 RAMP R 101 REAL DATA MANIPULATION FBs 80 REALATCH 82 REGISTER CONTROL FUNCTIONS 18 RESERV 104 S SCALE A 29 SCALE R 30 SEL R 26 SET 14 SHIFT 19 SHIFT A 74 SHIFT B 42 SHIFT R 97 SHIFT T 52 SHIFTP A 75 SHIFTP B 43 SHIFTP R 92 SHIFTP T 53 SIGNAL GENERATION FBs 106 STACKR 94 STEP_REG 99 STRING MANAGEMENT FUNCTIONS 34 SWITCC_A 78 SWITCC B 45 SWITCC R 96 SWITCC T 56 SWITCH A 77 SWITCH B 44 SWITCH R 95 SWITCH T 55 SYSTEM ACCESS FUNCTIONS 36 T THRSHLD 15 TIMER FBs 50 TRIGONOMETRIC FUNCTIONS 10 TRMCPL J 32 TRMCPL K 33 TWO_ST 98 U UNPACKBOO 48 USR_RANA 115 USR_WANA 116 W WDRESET 37 Page 121
11. B fs fl fr addr in ol DEMUX _B outl err DEMUX _B aerr Page 41 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFT_B SHIFT_B size INT fwd_bwd BOOL clk BOOL BOOL QF reset BOOL BOOL QB fwd_in BOOL bwd_in BOOL QB QF Short description Bidirectional boolean shift register of programmable length Description Call parameters Return params Prototype At each end of the shift register there is one input and one output When a forward shift is executed the value applied to the fwd_in input appears immediately at the QB output Likewise when a backward shift is executed the value applied to the bwd_in input appears immediately at the QF output Initially after power up and during reset the whole register contains only zeros If a number less than 2 is applied to the size input the shift register will have the length of 2 If a number greater than 256 is applied to the size input the shift register will have the length of 256 The length of the register cannot be changed dynamically value applied to the size input is read only in first cycle after power up or reset See also SHIFT_R SHIFT_A and SHIFT_T function blocks size register length range 2 256 INT fwd_bwd shift direction forwards TRUE backwards BOOL clk shifts one place on rising edge BOOL reset when TRUE clears register to 0 BOOL fwd_in forward shift data input BOOL bwd in backward shift data input
12. B q8 BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL TRUE Page 43 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SWITCH _B act a1 a2 a7 a8 Short description Description Call parameters Return params Prototype Remarks SWITCH_B BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL act al q1 q2 a8 q7 q8 FALSE 8 single switches for analog integer data act al a8 ql q8 SWITCH_B TRUE TRUE FALSE TRUE TRUE TRUE inputs connected to outputs FALSE FALSE output on all outputs input to switch 1 input to switch 8 output of switch 1 output of switch 8 outl SWITCH_B q1 out8 SWITCH _B q8 q8 BOOL BOOL BOOL BOOL BOOL a See also SWITCH_A SWITCH_R and SWITCH T function blocks Page 44 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SWITCC_B Short description act a1 b1 a8 b8 Description Call parameters Return params Prototype Remarks SWITCC_B BOOL BOOL BOOL BOOL q1 q8 act al b1 a8 b8 8 changeover switches for boolean data act al bl a8 b8 ql q8 TRUE A inputs connected to outputs FALSE B inputs connected to outputs switch 1 input A switch 1 input B switch 8 input A switch 8 input B output of switch 1 output of switch 8 q8 BOOL BOOL BOOL
13. CANSDORD CANSDORD Enable BOOL BOOL xecutingF Nodeld INT INT rrCod Idx INT INT AbortCod Subldx INT INT IntegerValue Datatype INT loatValue Short description Read one variable in CANopen node using SDO protocol Description Read an element of remote database using SDO protocol as defined in CANopen standard document DS301 Call parameters ENABLE start the read operation must be reset by user BOO NODEID node number od the remote node INT IDX index in remote database INT SUBIDX subindex in database INT DATATYPE type of data to be read see table below INT Return params EXECUTINGF TRUE if operation is still in progress BOO ERRCOD state of the last execution see table below BOO ABORTCOD code answered by remote node see table below BOO INTEGERVALUE value read represented as integer number INT FLOATVALUE value read represented as float numbe REAL Prototype CANSDORD TRUE node index subindex INT32 isrunning CANSDORD EXECUTINGF error CANSDORD ERRCOD answer CANSDORD ABORTCOD Value CANSDORD INTEGERVALUE Remarks several SDO operations cannot be executed on the same node at the same time Data Type Table 1 BOOL 2 INT8 3 INTI6 4 INT32 5 UINNT8 6 UINTI6 7 UINT32 8 FLOAT Error Codes Table 12 Too many SDO PDO Page 117 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 13 Invalid parameter s 14 Invalid reply from remote SDO server 15 Returned
14. analog integer data q8 BOOL INT INT INT INT INT INT a See also SWITCH_R SWITCH_B and SWITCH _T function blocks Page 78 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 RAMP_A Short description Description Call parameters Return params Prototype OUT Ramp limiter for analog signals Output OUT follows the input signal IN as long as the absolute value of its rate of change is below the value applied to the SLOPE input When the absolute value of rate of change of input exceeds SLOPE the rate of change of output il limited to SLOPE or SLOPE until the moment when OUT again becomes equal to IN At that moment tracking continues SLOPE is expressed in units of 1 10ms i e the numerical value applied to this input represents the maximum allowed change of the IN signal in the interval of 10ms This makes the block compatible with blocks delivered by CJ International e g derivator However care should be taken to appropriately scale the IN signal since due to integer arithmetic the least SLOPE supported is 100 units per second 100 s 1 10ms IN input INT SLOPE allowed input change INT OUT output INT RAMP_A inp slope outp RAMP_A out Page 79 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 5 Real Data Manipulation FBs Standard Real Data Manipulation Function Blocks delivered by CJ International are not described
15. are used so that no problems with Td and Ti resolution emerge Kp however was subject to input scaling what is input is NOT the actual value od Kp but the value Kp 100 Therefore for Kp 1 5 the value applied to the Kp input should be 150 This is consistent with Ti and Td and helps improve resolution in the most useful range of Kp values See also PID REX function block Page 72 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 PLAUS A PLAUS_A in INT INT Short description Description Call parameters Return params Prototype out Plausibility checking block for analog integer input The block compares the difference between two succesive values sampled on the in input with the value on the diff input If the difference of successive samples is less than diff the actual in value is forwarded to the output If the difference exceeds diff the value to be output is calculated as the mean value of in samples in the 3 preceding cycles In the cycle following this one in is compared not to the preceding value but with the last plausible value i e one before it If the difference in the cycle following the cycle in which the mean value was output is still above diff this is taken as the proof that both this and previous in values are plausible and the in value is normally forwarded to the output in input INT diff allowed difference INT out output INT P
16. bw is positioned symetrically around the center point and flanked on both sides by hysteresis regions of width eps Width of deadband bw is measured from the origin of the coordinate system to the center of any hysteresis region in input signal INT set_pt center point INT eps width of hysteresis INT bw width of deadband INT out output signal INT DEADBH_A input cpt hyst bw out DEADBH_A out Page 62 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DELAY_A Short description Description Call parameters Return params Prototype DELAY_A val INT INT delayed_val delay TMR Time delay of analog value If delay is smaller than the duration of one program execution cycle DELAY_A block just passes the unmodified input value to the output The maximum delay value is limited only by ISaGRAF limit on variables of TMR type i e it is 24 hours If the specified delay is shorter than 100 cycles val measured in each cycle is put into FIFO and is output after the delay elapses However if this is not the case max delayed _val update period is delay 100 otherwise the FIFO through which the input values pass before being output would be too long Inside one update period the values of val input in all cycles belonging to it are averaged to produce the value that is eventually put into FIFO and output later Averaging is correct for up to 10 cycles per update period but for longer up
17. in integer PID algorithms using 16 bit variables for internal data storage However since here variables are of the type signed long integer which are 32 bit entities in C compilers for 80x86 processors the problem is much less pronounced Having the range of 2 147 483 648 to 2 147 483 647 with reasonable values for process value X set point W and output value Y as well as proportional gain Kp integral Ti and derivative Td times the probability of exceeding the signed long range is extremely low For this reason no range checking is done which makes the algorithm faster 2 Rounding noise Integer arithmetic rounds off all division results Obviously accuracy is lost in this way Divisions cannot be avoided but it is important to make sure that a the ratio between the integer division result and the truncated decimal part is as large as possible and that b rounding off errors are not cumulative The problem of keeping the dividends much larger than divisors is in stand alone PID controllers usually solved by appropriate scaling normalization This is easily done since although X W and Y can each be expressed in its own physical units they are usually represented by already normalized input or output signals 0 10V 0 20mA 4 20mA transferred into digital domain also as normalized quantities 0 4095 for 12 bit A D converters OUR CASE IS DIFFERENT Our PID is a function block having numerical inputs and o
18. it would remain at that value until qout becomes greater then qin Page 104 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 LINTRANS LINTRANS in REAL a REAL REAL out b REAL Short description Linear transformation of real input Description out a in b Call parameters in input signal a multiplication factor b offset Return params out output signal Prototype LINTRANS input 10 2 out LINTRANS out REAL REAL REAL REAL Page 105 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 6 Signal Generation FBs Standard Signal Generation Function Blocks delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these function blocks containing the function block name and short description BLINK Blinking BOOLEAN signal Page 106 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 BLINK_A BLINK_A run BOOL cycle TMR INT out_a high_val INT low_val INT run cycle Sue high_val low_val Short description Alternating analog integer signal generation Description Based on standard boolean BLINK function block Once enabled the output will toggle continuously between high_val and low_val values with the period equivalent to cycle When disabled low_val will be output Call parameters run Bink enable BOOL cycle Blin
19. just as in PID_CJ but integral term is not reset to zero it is recalculated so that the equation PTERM ITERM DTERM XOUT remains satisfied AUTO PV SP X0 KP TR TD CYCLE Auto TRUE Manual FALSE mode Process variable X Setpoint W Value to be output in Manual mode Proportional gain Integral time Derivative time Calculation and output updating period XMIN Min value of output quantity Y XMAX Max value of output quantity Y XOUT Output quantity Y BOOL REAL REAL REAL REAL REAL REAL TMR REAL REAL REAL PID_REX TRUE temp_5 120 5 manual_temp kp tr td 0s40 0 1000 heater PID_REX XOUT Page 102 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 Remarks Algorithm implemented in this block is the so called independent PID algorithm Kp multiplies all three terms proportional integral and derivative in the following way error SP PV XOUT KP error 1 TR integral error TD derivative error For this type of algorithm optimum KP TR TD parameters according to the Ziegler Nichols method are forP controller KP 0 5 KPosc for PI controller KP 0 45 KPosc TR 0 83 Tosc for PID controller KP 0 6 KPosc TR 0 5 Tosc TD 0 125 Tosc where KPosc is that KP which causes constant amplitude closed loop oscillations with only P action enabled and Tosc is the period of these oscillations IMPORTANT Int
20. note PN tn145 0 doc 04 04 00 Ver 1 00 2 11 Array Manipulation Functions Standard Array Manipulation Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description ARCREATE Create INTEGER array ARREAD Read INTEGER array element ARWRITE Write INTEGER array element Currently no functions written by EXOR have been added to this group Page 35 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 12 System Access Functions Standard System Access Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description SYSTEM System access OPERATE Operate I O Channel Currently no functions written by EXOR have been added to this group Page 36 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 13 Hardware Specific Functions WDRESET WDRESET BOOL dummy Short description Reset the WatchDog timer Description The watch dog timer will reset the processor if a PLC cycle will exeed 1 6sec duration Calling WDRESET inside the program will restart the timer ATTENTION the use of WDRESET inside program loop
21. result mux8_b select val0 vall val2 val3 val4 val5 val6 val7 Remarks This is the boolean equivalent of the standard MUX8 function It does not support an extensible number of inputs Page 25 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SEL R Short description Description Call parameters Return parameter Prototype Remarks SEL_R condition BOOL false_value REAL REAL result true_value REAL Select one of two real values If condition FALSE then the result is equal to the false value If condition TRUE then the result is equal to the true_value condition BOOL false_value REAL true_value REAL result REAL result sel_r selector valuel value2 This is the real equivalent of the standard SEL function It does not support an extensible number of inputs Page 26 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 LIMIT_R Short description Description Call parameters Return parameter Prototype Remarks LIMIT_R MN REAL IN REAL REAL Q MX REAL MN IN Q MX Bounds a real value between a minimum and a maximum MN minimum value REAL IN input value REAL MX maximum value REAL Q bound value REAL bound_ value limit mini value maxi This is the real equivalent of the standard LIMIT function Page 27 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 9 Data Conversion Functions Stand
22. value result is set to 0 Call parameters selector INT value0 REAL valuel REAL value2 REAL value3 REAL Return parameter result REAL Prototype result mux4 r select val0 vall val2 val3 Remarks This is the real equivalent of the standard MUX4 function It does not support an extensible number of inputs Page 23 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 MUX8 R selector valueO value1 value2 value3 result value4 value5 value6 value7 Short description Select one of eight real values Description Ifselectoris 0 thenresult valueO l valuel 7 value For any other selector value result is set to 0 Call parameters selector INT value0 REAL valuel REAL value7 REAL Return parameter result REAL Prototype result mux8 r select val0 vall val2 val3 val4 val5 val6 val7 Remarks This is the real equivalent of the standard MUX8 function It does not support an extensible number of inputs Page 24 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 MUX8 B selector value0 value1 value2 value3 result value4 value5 value6 value7 Short description Select one of eight boolean values Description Ifselectoris 0 thenresult valueO l valuel 7 value7 For any other selector value result is set to FALSE Call parameters selector INT value0 BOOL valuel BOOL value7 BOOL Return parameter result BOOL Prototype
23. 0 t 3 this formula gives error of maximum 0 0524141 Ohm in temperature range of 0 to 200 degrees Celsius which produces error of maximum 0 126668 and 0 122284 degrees Celsius in resistance range 100 to 18 49316 Ohm IN input value in ohms REAL OUT output value in degrees Celsius REAL temp PT100 res Page 31 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 TRMCPL_J Short description Description Call parameters Return parameter Prototype TRMCPL_J dV REAL REAL out Tc REAL Thermocouple linearization compensation for J type For conversion from millivolts to degrees Celsius the standard J type thermocouple conversion table is used with supporting points at every 10 degrees Celsius Between supporting points linear interpolation is used We could not estimate maximum errors that result from this 10 degree spacing of supporting points since we had neither a table with more dense spacing nor a polynomial describing the voltage to temperature mapping dV Voltage diff between thermocouple junctions mV REAL Tc Thermocouple cold junction temperature degrees C REAL out Thermocouple hot junction temperature degrees C REAL temp TRMCPL J delta_v tcold Page 32 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 TRMCPL_K Short description Description Call parameters Return parameter Prototype TRMCPL_K dV REAL REAL out T
24. 2 12 ol SHIFTP Aql Page 75 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 08 SHIFTP_A q8 Page 76 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SWITCH_A act a1 a2 a7 a8 Short description Description Call parameters Return params Prototype Remarks SWITCH_A BOOL INT INT act al q1 q2 a8 q7 q8 0 8 single switches for analog integer data act al a8 ql q8 SWITCH_A TRUE 1 22 17 4 512 93 100 0 TRUE inputs connected to outputs FALSE zero output on all outputs input to switch 1 input to switch 8 output of switch 1 output of switch 8 outl SWITCH_A ql out8 SWITCH _A q8 q8 BOOL INT INT INT INT a See also SWITCH R SWITCH B and SWITCH _T function blocks Page 77 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SWITCC_A Short description act a1 b1 a8 b8 Description Call parameters Return params Prototype Remarks SWITCC_A BOOL INT INT act al bl ag b8 ql q8 SWITCC_A TRUE 1 22 17 4 q1 q8 TRUE A inputs connected to outputs FALSE B inputs connected to outputs switch 1 input A switch 1 input B switch 8 input A switch 8 input B output of switch 1 output of switch 8 outl SWITCC_A ql out8 SWITCC_A q8 act al b1 a8 b8 8 changeover switches for
25. CYCM 1m30s 10 7 22 5 30 49 2 55 5 65 78 83 1 wavel DUTYCYCM outl waves DUTYCYCM out8 Page 114 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 7 Variable Access FBs USR_RANA word_adr word_val Short description Read one analog variable Description Read the analog value of a variable using the Network Address to select it Ifthe variable is not found Network Address is not defined the returned value is 0 The returned value is always analog even if the variable is of different type Call parameters WORD ADR network address INT Return params WORD_VAL analog output INT Prototype USR_RANA 16 1000 value USR_RANA WORD VAL Page 115 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 USR_WANA Short description Description Call parameters Return params Prototype USR_WANA word_adr INT written INT word_val INT Write one analog variable Write a analog value to a variable using the Network Address to select it If the variable is not found Network Address is not defined the returned value is FALSE The value is always written as analog even ifthe variable is of different type WORD_ ADR network address INT WORD_VAL analog output INT WRITTEN TRUE if successful BOO USR_WANA 16 1000 1234 isok USR_WANA WRITTEN Page 116 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 8 Hardware Specific FBs
26. D answer CANSDORD ABORTCOD Remarks several SDO operations cannot be executed on the same node at the same time Data Type Table 1 BOOL 2 INT8 3 INT16 4 INT32 5 UINT8 6 UINTI6 7 UINT32 8 FLOAT Error Codes Table 12 Too many SDO PDO 13 Invalid parameter s 14 Invalid reply from remote SDO server 15 Returned size differs from requested size Page 119 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 16 No reply timeout Abort code Description 0503 0000h Toggle bit not alternated 0504 0000h SDO protocol timed out 0504 0001h Client server command specifier not valid or unknown 0504 0002h Invalid block size block mode only 0504 0003h Invalid sequence number block mode only 0504 0004h CRC error block mode only 0504 0005h Out of memory 0601 0000h Unsupported access to an object 0601 0001h Attempt to read a write only object 0601 0002h Attempt to write a read only object 0602 0000h Object does not exist in the object dictionary 0604 0041h Object cannot be mapped to the PDO 0604 0042h The number and length of the objects to be mapped would exceed PDO length 0604 0043h General parameter incompatibility reason 0604 0047h General internal incompatibility in the device 0606 0000h Access failed due to an hardware error 0607 0010h Data type does not match length of service parameter does not match 0607 0012h Data type does not match length of service parameter too high 0607 0013
27. EAL amp2 amplitude during time T2 REAL amp3 amplitude during time T3 REAL amp4 amplitude during time T4 REAL tl time T1 TMR t2 time T2 TMR t3 time T3 TMR t4 time T4 TMR square square wave output REAL OSC_SQW start 0 1 0 1 1s 1s 1s 1s sqw OSC_SQW square Page 111 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DUTYCYC Short description Description REMARK Call parameters Return params Prototype DUTYCYC cycle TMR BOOL out dutyc REAL Digital oscillator with variable duty cycle Within each cycle the out signal will be TRUE for dutyc percent ofthe cycle duration and FALSE for 100 dutyc percent ofthe cycle duration The first cycle after power up will begin with out set to TRUE except if dutyc is less than or equal to zero If dutyc is less than or equal to zero a steady FALSE signal will be output If dutyc is greater than or equal to 100 a steady TRUE signal will be output One should take into account the limited time resolution of the PC based target 55ms one BIOS tick No regular pulse can be shorter than this interval Therefore some lower limit on the CYCLE input variable to DUTYCYC and DUTYCYCM blocks must be respected As a reasonable value 10 seconds for this limit is proposed Since the unit for CYCLE is 10ms 10 seconds are represented by number 1000 applied to CYCLE input of the block In this case 55ms will be approximately
28. EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 Functions and Function Blocks in ISaGRAF for SCMO3 This Technical Note contains detailed information on all the Function Blocks available for PLC programming in the SCM03 controller Contents Vs IAtr ducli n u 22er ID 2 Ze FUNCIONS aan nennen 3 2 1 Arithmetic Functions 2200 00 eeeee eee ceee cece eee eeeeeeeeeeeeeeeaaeeaaeeeeeeeseeeaaaaaaeeeeeeeeeeeaaes 4 2 2 Math Functions 0 cccccccccceeeeeeeeeeeeeeeeeeaaeeeceeeeeeeeeeeaaeaaaeeeeeeeeeesaaaaaeeeeeeeeeesaaea 5 2 3 Trigonometrie FUNC WONG ae lute heciintnckedcatiniel isinisisi iadaaa diaa 10 2 4 Boolean Functions cccccccecececececeeeeeeeeeeeeeeeeeeaaaeaaaeeaeeeeeeeeeeeeaaecneeeeeneeeeeees 11 2 9 Logic FUNCOMS ac ec 12 2 6 Comparison FUNCTIONS uussssssssennnennnnnnnnnnnnnnnnnnnnnnnennnnnnnnnsnnnnnnnnnnnnnnen 17 2 7 Register Control Functions 44444440snnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnennnnnn 18 2 8 Data Manipulation Functions nnneennnnnnnnennnnnnnnnnnnnnneesnnnnnnnnnnnnnnen 20 2 9 Data Conversion Functions 4444sssnnnnnnnnnnnnnennnnnnnnnnnnnnensnnnnnnnnnnnnnnen 28 2 10 String Management F nglions naesser ee 34 2 11 Array Manipulation FUNCTIONS eee cece cere reer reer reer nn nn nnnnnnnnnnnnnnnnnnn 35 2 12 System Access FUNCHOMS sci cccsccsccacsceasessctaacadsdbahcadsaradcadacesteadaateacadidbahdadaceunds 36 2 13 Har
29. L Low alarm BOOL Prototype LIM AL A 215 0 temp_5 120 5 30 hot LIM ALRM QH alarm LIM ALRM Q cold LIM ALRM QL Remarks a This is the analog equivalent of the standard LIM_ALRM function block Page 67 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 LIMMON_A Short description Description Call parameters Return params Prototype LIMMON_A INPUT INT BOOL HH HH_Limit INT Bo BOOL H H_Limit INT a BOOL L L_Limit INT ae BOOL LL LL_Limit INT Extended limit monitor of integer value This function block implements the standard industrial 4 level limit monitor supporting high alarm HH high prealarm H low prealarm L and low alarm LL levels The 4 outputs indicate in which of the 5 regions the input value currently is above HH HH output TRUE between HH and H H output TRUE between L and H inside normal band all outputs FALSE between LL and L L output TRUE below LL LL output TRUE At most one of the outputs will be TRUE at any time except when the limit values are not in increasing order i e when the inequality LL_Limit lt L_Limit lt H_Limit lt HH Limit is not satisfied in which case all 4 outputs will be set to TRUE INPUT INT HH Limit INT H Limit INT L Limit INT LL Limit INT HH BOOL H BOOL L BOOL LL BOOL LIMMON A in hh 1 h 1 1 1 II hh alarm LIMMON_A HH h alarm LIMMON_A H l alarm LIMMON_A L ll
30. LAG in 10 1s filtered LAG OUT a TI input is of type REAL although it is used for inputting a quantity that has a dimension of time so type TMR would be appropriate The reason for this awkward typing is in keeping the block compatible with similar standard blocks delivered by CJ International This may change with the following release of ISaGRAF ALL inputs outputs in ALL function blocks with dimension of time and type REAL use a unit of 10ms For example to denote a time interval of 1s value 100 must be applied to such an input Page 97 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 TWO ST DT OUT PD DB Short description Two state regulator Description This block is used for switching the output load ON and OFF according to the value of the input signal Two mechanisms for protecting both the contactor and the load from too frequent switching are provided deadband minimun times for ON and OFF output states If IN exceeds DB and if the time elapsed since last ON to OFF transition of OUT exceeds DT OUT is set to ON If IN falls below the negative value of DB and if the time elapsed since last OFF to ON transition of OUT exceeds PD OUT is set to OFF Call parameters IN input value REAL DT min output non activation time dead time TMR PD minimum output ON pulse duration TMR DB dead band REAL Return params OUT ON TRUE OFF output BOOL Prototype TWO_ST in 5s 20s 1
31. LAUS A input difference o PLAUS A out Page 73 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFT_A size fwd_bwd clk reset fwd_in bwd_in SHIFT_A INT BOOL BOOL INT QF BOOL INT QB INT INT QB QF Short description Description Bidirectional analog integer shift register of programmable length At each end of the shift register there is one input and one output When a forward shift is executed the value applied to the fwd_in input appears immediately at the QB output Likewise when a backward shift is executed the value applied to the bwd_in input appears immediately at the QF output Initially after power up and during reset the whole register contains only ZETOS If a number less than 2 is applied to the size input the shift register will have the length of 2 If a number greater than 256 is applied to the size input the shift register will have the length of 256 The length of the register cannot be changed dynamically value applied to the size input is read only in first cycle after power up or reset See also SHIFT_R SHIFT_B and SHIFT_T function blocks Call parameters size fwd_bwd reset bwd in Return params QF Prototype register length range 2 256 shift direction forwards TRUE backwards clk shifts one place on rising edge when TRUE clears register to 0 fwd_in forward shift data input backward shift data input forward shift d
32. Q rest MONO time_elapsed BOOL BOOL TMR BOOL TMR Page 109 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 OSC_SIN OSC_SIN enable BOOL REAL sine period TMR BOOL err amplitude REAL Short description Sine wave oscillator Description The sine wave is created from a table containing 256 amplitude values per period If enable is FALSE output is set to 0 The period should be minimally 20 times longer than the duration of one PLC cycle otherwise the err output is set and zero is output on the sine output Call parameters enable oscillator enable BOOL period period of oscillations TMR amplitude amplitude of sine wave REAL Return params sine sine wave REAL err set to TRUE if period is too short BOOL Prototype OSC_SIN TRUE per amp osc OSC_SIN sine error OSC_SIN err Page 110 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 OSC_SQW Short description Description Call parameters Return params Prototype OSC_SQW enable BOOL amp1 REAL amp2 REAL amp3 REAL amp4 REAL REAL square t1 TMR t2 TMR t3 TMR t4 TMR Four level square wave oscillator One full period of the square wave is composed of 4 parts with potentially different duration and with the output amplitude selectable for each sub period independently If enable is FALSE output is set to 0 enable oscillator enable BOOL ampl amplitude during time T1 R
33. UTPUT Page 82 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DEADB R Short description Description Call parameters Return params Prototype DEADB_R in REAL set_pt REAL REAL out bw REAL set_pt out Deadband for real input The deadband of total width 2 bw is positioned symetrically around the center point Ifthe value of in input falls within the deadband set_pt value is output otherwise in value is output See also DEADB_A and DEADBH R function blocks in input signal REAL set pt center point REAL bw halfwidth of deadband REAL out output signal REAL DEADB R input 10 2 out DEADB_R out Page 83 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DEADBH_R Short description Description Call parameters Return params Prototype DEADBH_R in REAL set_pt REAL REAL eps REAL bw REAL bw set_pt eps p bw out out Deadband with hysteresis for real input To reduce the frequency of switching operations it is usual to provide final control elements with a hysteresis or differential gap This hysteresis prevents minor deviations of input signal from the center point from being forwarded to the output If the system deviation exceeds the switching differential the input value is passed unchanged to the output The deadband of width 2 bw is positioned symetrically around the center point and flanked on both sides by hyste
34. added to this group Page 10 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 4 Boolean Functions Standard Boolean Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description AND Boolean AND extensible OR Boolean OR extensible XOR Boolean XOR extensible Currently no functions written by EXOR have been added to this group Page 11 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 5 Logic Functions Standard Logic Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description AND Analog INTEGER bit to bit AND extensible OR Analog INTEGER bit to bit OR extensible XOR Analog INTEGER bit to bit XOR extensible Page 12 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 BIT Short description Description Call parameters Return parameter Prototype Test indicated bit of given integer If bit_num is less than 0 or greater than 31 bit 0 is tested bit_num Bit number in range 0 to 31 INT input Integer whose bit is to be tested INT bit Tested bit BOOL
35. alarm LIMMON_A LL Page 68 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 MAJOR_A MAJOR_A dev INT int out in2 err in3 in4 Short description Majority selector for integer inputs Description The majority selector calculates the mean value of all inputs If exactly one input differs from the calculated mean value by more than dev mean value is calculated once more but that input is excluded from the calculation If more than one input deviates by more than dev the mean value of all of the input values is calculated and the output err is set See also MAJOR R function block Call parameters dev Max permissible deviation between INT any input and the calculated mean value inl Input 1 INT in4 Input 4 INT Return params out Mean value of inputs not deviating by INT more than dev from itself err set when majority selection is impossible BOOL Prototype MAJOR A deviation il i2 13 14 error MAJOR_A err mean MAJOR_A out Page 69 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 PID_A Short description Description Call parameters Return params Prototype Remarks AUTO PV SP x0 E XOUT TR TD CYCLE XMIN XMAX PID Controller with analog integer inputs and output This is the analog version of the standard PID_REX function block all inputs and the output which are of type REAL in the original block are here of type ANALOG INTEGER
36. ard Data Conversion Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description BOO ANA REAL TMR MSG ASCII CHAR Convert to BOOLEAN any input type Convert to ANALOG INTEGER any input type Convert to REAL any input type Convert to TIMER any input type Convert to MESSAGE any input type Character to ASCII code ASCII code to character Page 28 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SCALE_A SCALE_A in INT inmin INT inmax INT out outmin INT outmax INT Short description Scaling of analog value Description This block scales the input value from range INMIN INMAX to the range OUTMIN OUTMAX using the following formula IN INMIN OUTMAX OUTMIN OUT OUTMIN INMAX INMIN If INMIN gt INMAX or OUTMIN gt OUTMAX the output is set to OUTMIN The IN INMIN and OUTMAX OUTMIN expressions MUST fall within the range 32768 to 32767 If they get out of that range the OUT output is set to OUTMIN Call parameters IN input value INMIN minimum input value INMAX maximum input value INT INT INT OUTMIN output value if IN INMIN INT OUTMAX output value if IN INMAX INT Return parameter OUT output value Prot
37. ata output QB backward shift data output INT BOOL BOOL BOOL INT INT INT INT SHIFT_A 100 TRUE FALSE FALSE 123 47 outfwd SHIFT_A QF outbwd SHIFT_A QB Page 74 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFTP_A SHIFTP_A load BOOL fwd_bwd BOOL clk BOOL q1 reset BOOL q2 in1 INT in2 INT q7 q8 in7 in8 qi q2 q3 q4 q5 q6 q7 q8 in2 in3 in4 in5 in6 in Short description Bidirectional analog integer shift register with 8 parallel inputs and outputs Description Except that it is of fixed length and has parallel inputs and outputs the functioning of this block is similar to that of SHIFT_A block Initially after power up and during reset the whole register contains only zeros Inputs in2 in7 are parallel inputs only while inputs inl and in8 are both parallel and serial inputs See also SHIFTP_R SHIFTP_B and SHIFTP_T function blocks Call parameters load on rising edge register is loaded from parallel inputs BOOL fwd_bwd shift direction forwards TRUE backwards BOOL clk shifts one place on rising edge BOOL reset when TRUE clears register to 0 BOOL inl parallel input 1 and forward shift data input INT in2 parallel input 2 INT in7 parallel input 7 INT in8 parallel input 8 and backward shift data input INT Return params ql output 1 INT q8 output 8 INT Prototype SHIFTP_A FALSE TRUE TRUE FALSE 2 15 4 0 100 1 5
38. bsolute value of its rate of change is below the value applied to the SLOPE input When the absolute value of rate of change of input exceeds SLOPE the rate of change of output il limited to SLOPE or SLOPE until the moment when OUT again becomes equal to IN At that moment tracking continues SLOPE is expressed in units of 1 10ms i e the numerical value applied to this input represents the maximum allowed change of the IN signal in the interval of 10ms This makes the block compatible with blocks delivered by CJ International e g derivator Call parameters IN input REAL SLOPE allowed input change REAL Return params OUT output REAL Prototype RAMP R inp slope outp RAMP R out Page 101 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 PID_REX Short description Description Call parameters Return params Prototype AUTO PV SP x0 KP TR TD CYCLE XMIN XMAX PID_REX BOOL REAL REAL REAL REAL XOUT REAL REAL TMR REAL REAL PID controller with real I O EXOR version This PID Controller block implements the same algorithm as the standard PID_CJ function block delivered by CJI with the following differences current time is not read from the static variable LAST_DATE since this doesn t work a call to sys_readtim function is done instead when calculated output is outside the XMIN XMAX lt interval the appropriate limit value is output
39. c REAL Thermocouple linearization compensation for K type For conversion from millivolts to degrees Celsius the standard K type thermocouple conversion table is used with supporting points at every 10 degrees Celsius Between supporting points linear interpolation is used We could not estimate maximum errors that result from this 10 degree spacing of supporting points since we had neither a table with more dense spacing nor a polynomial describing the voltage to temperature mapping dV Voltage diff between thermocouple junctions mV REAL Te Thermocouple cold junction temperature degrees C REAL out Thermocouple hot junction temperature degrees C REAL temp TRMCPL K delta_v tcold Page 33 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 10 String Management Functions Standard String Management Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description DELETE Delete substring FIND Find substring REPLACE Replace substring MLEN String length INSERT Insert string LEFT Extract left substring MID Extract middle substring RIGHT Extract right substring CAT String Concatenation DAY_TIME Time of Day Currently no functions written by EXOR have been added to this group Page 34 EXOR Tech
40. d REALs extensible DIV Division INTEGERs and REALs Currently no functions written by EXOR have been added to this group Page 4 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 2 Math Functions Standard Math Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description ABS Absolute value ofa REAL number EXPT Exponentiation of REAL base by the INTEGER exponent LOG Logarithm to the base 10 ofa REAL number POW Power Calculation SQRT Square root of a REAL number TRUNC Truncation of a REAL number with REAL output Page 5 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 ABS _A Short description Description Call parameters Return parameter Prototype Remarks ABS_A input_value INT INT absolute_value input_value a absolute_value Absolute analog integer value input_value INT absolute value INT absolute abs_a value This is the analog equivalent of the standard ABS function Page 6 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 EXP_R base result exponent base x result exponent Short description Exponentiation real base real exponent Description Call parameters base REAL exponent REAL Return parameter result REAL Pro
41. date periods certain values are weighted with varying weights in order to keep the needed memory space limited val value to delay INT delay delay time TMR delayed val delayed value INT DELAY A value deltat d_val DELAY_A delayed_val Page 63 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DEMUX_A DEMUX_A set BOOL INT out1 load BOOL INT out2 reset BOOL address INT INT out16 input INT BOOL aerr Short description Integer demultiplexer with memory Description RESET overrides SET and LOAD inputs SET overrides LOAD input If ADDRESS is 0 all outputs are set to 0 just as if RESET input was active See also DEMUX_R DEMUX_B and DEMUX_T blocks Call parameters set if TRUE new input value is loaded in each cycle BOOL load new input value is loaded on rising edge BOOL reset if TRUE all outputs are set to 0 BOOL address address of output range 1 to 16 INT input input value to be demultiplexed INT Return params outl out16 outputs INT aerr address error set if address lt 0 or gt 16 BOOL Prototype DEMUX A fs fl fr addr in ol DEMUX_A outl err DEMUX _A aerr Page 64 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DIVIDE_A DIVIDE dividend INT INT quotient divisor INT INT modulo Short description Full integer divider quotient and remainder Description Returns 1 on both outputs if divisor is less than or equal to 0 Call parameters di
42. dware Specific Functions cccccccccceeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeseeeeeeeeeeeeeees 37 3 Function BIOCKS siiin a bendana oinaan oni SAARA nan AEREA ESNEA a 39 3 1 Boolean Data Manipulation FBS cecccceeeeeceeeeeeeeeeeeeeeeeeeeeeeeeeaaeneeeeeeees 40 22 70101014106 IB arete a E E eee ne Pee eee ere 49 3 3 Timer FBS essinu een nein 50 3 4 Analog Integer Data Manipulation FBS 42444sssnnennnenennnnnnnnnnnn 57 3 5 Real Data Manipulation FBS 0 cccccccccceeeeeeeeeeeeeeeeeaaeeeeeeeeeeeeseaaaaneeseeeees 80 3 6 Signal Generation FIRS cdisiesisechintsioieradieteswisiaasnd tinetd wasaanediveriouieamealion 106 3 7 Variable Access FBS cccccccccsceeeeeeeeeeeeeeaaeeeaeeeeeeeeeeeaaaaaeeeeeeeeeesaaannseeeeeeees 115 3 8 Hardware Specific FBS unun a nnen nnnn ennnen nn nnnnnn nennen 117 A INdeX nen neh EA EE 121 Page 1 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 1 Introduction This document contains the list of Functions and Function Blocks written for the ISaGRAF softlogic system installed on the SCMO03 board Before using it please make sure that the version you have is the most recent one otherwise you might miss recently added blocks and changes to previously written blocks This list is intended for use as a reference by PLC programmers writing applications for the HM Control systems based on ISaGRAF PLC language interpreter Throughout the docume
43. e CYCLE input does not influence the output value but is only used to execute calculation and output updating not more often than it states For further details please refer to the description of the original block in the ISaGRAF User s Manual RUN enable command reset output if FALSE BOOL XIN sample of the function to be differentiated INT CYCLE sampling period TMR XOUT output differentiated input DERIV_A TRUE temp_5 period_5 speed 5 DERIV_A XOUT INT If the rate of change of input is 200 units per second 200 s the value that will be output is 2 200 s 200 100 10ms 200 100 1 10ms 2 1 10ms ATTENTION For an input with rate of change less than 100 units per second 100 s output will be 0 99 s 99 100 10ms 99 100 1 10ms INTEGER ARITHMETIC 0 1 10ms 0 Page 59 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 HYSTER_A Short description Description Call parameters Return params Prototype HYSTER_A INT INT BOOL Boolean hysteresis on the difference of analog inputs This is the analog equivalent ofthe standard HYSTER function block Except for changed input and output types its functioning is exactly the same as the original block For details please refer to the above drawing and to the description of the original block in the ISaGRAF User s Manual XIN1 input signal INT XIN2 hysteresis centerpoint INT EPS hysteresis halfw
44. e Specific FBs RAN RND Page 39 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 1 Boolean Data Manipulation FBs Standard Boolean Data Manipulation Function Blocks delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these function blocks containing the function block name and short description SR Set dominant bistable RS Reset dominant bistable R_TRIG Rising edge detection F_TRIG Falling edge detection SEMA Semaphore Page 40 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DEMUX_B Short description Description Call parameters Return params Prototype set load reset address input Boolean demultiplexer with memory DEMUX_B BOOL BOOL BOOL BOOL BOOL INT BOOL BOOL BOOL out1 out2 out16 aerr RESET overrides SET and LOAD inputs SET overrides LOAD input If ADDRESS is 0 all outputs are set to 0 just as if RESET input was active See also DEMUX_R DEMUX_A and DEMUX_T blocks set if TRUE new input value is loaded in each cycle BOOL load new input value is loaded on rising edge BOOL reset if TRUE all outputs are set to 0 BOOL address address of output range 1 to 16 INT input input value to be demultiplexed BOOL outl outl6 outputs BOOL aerr address error set if address lt 0 or gt 16 BOOL DEMUX
45. ediately at the QB output Likewise when a backward shift is executed the value applied to the bwd_in input appears immediately at the QF output Initially after power up and during reset the whole register contains only zeros If a number less than 2 is applied to the size input the shift register will have the length of 2 If a number greater than 256 is applied to the size input the shift register will have the length of 256 The length of the register cannot be changed dynamically value applied to the size input is read only in first cycle after power up or reset See also SHIFT_A SHIFT_B and SHIFT_T function blocks size register length range 2 256 INT fwd_bwd shift direction forwards TRUE backwards BOOL clk shifts one place on rising edge BOOL reset when TRUE clears register to 0 BOOL fwd_in forward shift data input REAL bwd_in backward shift data input REAL QF forward shift data output REAL QB backward shift data output REAL SHIFT_R 100 TRUE FALSE FALSE 123 55 47 2 outfwd SHIFT_R QF outbwd SHIFT_R QB Page 91 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFTP_R SHIFTP_R load BOOL fwd_bwd BOOL clk BOOL REAL reset BOOL REAL int REAL in2 REAL in in8 qi q2 q3 q4 q5 q6 q7 q8 q1 q2 q7 q8 in1 in8 in2 in3 in4 ind in6 in Short description Bidirectional real shift register with 8 parallel inputs and outputs Description Except that it is o
46. egral time TR and derivative time TD MUST be input in units of 10ms e g 100 should be applied to TR to indicate that integral time is 1 second See also PID_A function block Page 103 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 RESERV RESERV Se en sit BER gin x N maxlevel ZN gout REAL basearea REAL level gt minlevel REAL qout N minlevel maxlevel REAL basearea Short description Reservoir integrator with input and output flow Description This block simulates a prismatic cylindrical reservoir with input and output pipe and upper full and lower empty limit level as depicted above Call parameters qin flow in input pipe REAL qout flow in output pipe REAL basearea area of the prismatic reservoir base REAL minlevel minimum level reservoir empty REAL maxlevel maximum level reservoir spilling over REAL Return params level current level in the reservoir REAL Prototype RESERV 0 5 0 4 1 0 5 lvl RESERV level Remarks Reasonable care about units must be taken if one wants level to be expressed in U units then minlevel and maxlevel must also be expressed in U units basearea must be expressed in U units and qin and qout must be expressed in U3 s units Example For level in meters minlevel could be 0 maxlevel 5m basearea 1m2 qin could be 0 5m3 s and qout 0 4m3 s In this case level would steadily rise at the rate of 0 1m s until it reaches 5m then
47. f fixed length and has parallel inputs and outputs the functioning of this block is similar to that of SHIFT_R block Initially after power up and during reset the whole register contains only zeros Inputs in2 in7 are parallel inputs only while inputs inl and in8 are both parallel and serial inputs See also SHIFTP_A SHIFTP_B and SHIFTP_T function blocks Call parameters load on rising edge register is loaded from parallel inputs BOOL fwd_bwd shift direction forwards TRUE backwards BOOL clk shifts one place on rising edge BOOL reset when TRUE clears register to 0 BOOL inl parallel input 1 and forward shift data input REAL in2 parallel input 2 REAL in7 parallel input 7 REAL ing parallel input 8 and backward shift data input REAL Return params ql output 1 REAL q8 output 8 REAL Prototype SHIFTP_R FALSE TRUE TRUE FALSE 2 1 15 4 11 0 100 1 5 5 2 7 ol SHIFTP_R ql Page 92 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 08 SHIFTP R q8 Page 93 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 STACKR Short description Description Call parameters Return params Prototype STACKR PUSH BOOL POP BOOL BOOL EMPTY R1 BOOL BOOL OFLO IN REAL REAL OUT N INT Stack of real values PUSH pushes IN value on rising edge BOOL POP pops value on rising edge BOOL R1 TRUE resets stack to the Empty state BOOL IN value to be p
48. h Data type does not match length of service parameter too low 0609 001 1h Sub index does not exist 0609 0030h Value range of parameter exceeded only for write access 0609 003 1h Value of parameter written too high 0609 0032h Value of parameter written too low 0609 0036h Maximum value is less than minimum value 0800 0000h general error 0800 0020h Data cannot be transferred or stored to the application 0800 0021h Data cannot be transferred or stored to the application because of local control 0800 0022h Data cannot be transferred or stored to the application because of the present device state 0800 0023h Object dictionary dynamic generation fails or no object dictionary is present e g object dictionary is generated from file and generation fails because of an file error Page 120 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 4 Index A ABS_A 6 ACCESS TO VARIABLE FBs 115 ANALOG INTEGER DATA MANIPULATION FBs 57 ARITHMETIC FUNCTIONS 4 ARRAY MANIPULATION FUNCTIONS 35 AVRG A 58 B BIT 13 BLINK_A 107 BLINK R 708 BOOLEAN DATA MANIPULATION FBs 40 BOOLEAN FUNCTIONS 11 C CANONMT 38 CANSDORD 117 CANSDOWR 119 CMP R 81 COMPARISON FUNCTIONS 17 COUNTING FBs 49 D DATA CONVERSION FUNCTIONS 28 DATA MANIPULATION FUNCTIONS 20 DEADB A 61 DEADB R 83 DEADBH_A 62 DEADBH R 84 DELAY_A 63 DELAY R 85 DEMUX A 64 DEMUX B 4 DEMUX R 86 DEMUX_T 5 DERIV_A 59 DIVIDE
49. he above relay diagram which should be clear enough Call parameters sel in Selects in_l FALSE or in_2 TRUE BOOL sel out Selects out_1 FALSE or out 2 TRUE BOOL in 1 Real input 1 REAL in 2 Real input 2 REAL default_out Value to be placed at non selected output REAL Return params out 1 Real output 1 REAL out 2 Real output 2 REAL Prototype DSEL R selin selout invall inval2 defout outvall DSEL_R out_1 outval2 DSEL_R out_2 Page 87 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 LIMMON_R Short description Description Call parameters Return params Prototype LIMMON_R INPUT REAL BR BOOL HH HH_Limit REAL BOOL H H_Limit REAL M BOOL L L_Limit REAL oe BOOL LL LL_Limit REAL Extended limit monitor of real value This function block implements the standard industrial 4 level limit monitor supporting high alarm HH high prealarm H low prealarm L and low alarm LL levels The 4 outputs indicate in which of the 5 regions the input value currently is above HH HH output TRUE between HH and H H output TRUE between L and H inside normal band all outputs FALSE between LL and L L output TRUE below LL LL output TRUE At most one of the outputs will be TRUE at any time except when the limit values are not in increasing order i e when the inequality LL_Limit lt L_Limit lt H_Limit lt HH_Limit is not satisfied in which case all 4 output
50. hort description TON On delay timing TOFF Off delay timing TP Pulse timing Page 50 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DEMUX_T DEMUX_T set BOOL TMR out1 load BOOL TMR out2 reset BOOL address INT TMR out16 input TMR BOOL aerr Short description Timer demultiplexer with memory Description RESET overrides SET and LOAD inputs SET overrides LOAD input If ADDRESS is 0 all outputs are set to 0 just as if RESET input was active See also DEMUX_A DEMUX_B and DEMUX_R blocks Call parameters set if TRUE new input value is loaded in each cycle BOOL Load new input value is loaded on rising edge BOOL seset if TRUE all outputs are set to 0 BOOL address address of output range to 16 INT input input value to be demultiplexed TMR Return params outl outl6 outputs TMR aerr address error set if address lt 0 or gt 16 BOOL Prototype DEMUX T fs fl fr addr in ol DEMUX_T out1 err DEMUX_T aerr Page 51 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFT_T Short description Description Call parameters Return params Prototype SHIFT_T size INT fwd_bwd BOOL clk BOOL TMR QF reset BOOL TMR QB fwd_in TMR bwd_in TMR QB QF Bidirectional timer shift register of programmable length At each end of the shift register there is one input and one output When a forward shift is executed the value applied to the fwd_in input appear
51. idth INT Q output BOOL HYSTER_A pressure press_limit 21 too_high HYSTER_A Q Page 60 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DEADB A Short description Description Call parameters Return params out Prototype DEADB_A in INT set_pt INT INT out bw INT set_pt out Deadband for analog integer input The deadband of total width 2 bw is positioned symetrically around the center point If the value of in input falls within the deadband set_pt value is output otherwise in value is output See also DEADB_R and DEADBH_A function blocks in input signal INT set_pt center point INT bw halfwidth of deadband INT output signal INT DEADB A input 10 2 out DEADB A out Page 61 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DEADBH_A Short description Description Call parameters Return params Prototype DEADBH_A in INT set_pt INT zi out eps INT bw INT in bw set_pt out eps p bw Deadband with hysteresis for analog integer input To reduce the frequency of switching operations it is usual to provide final control elements with a hysteresis or differential gap This hysteresis prevents minor deviations of input signal from the center point from being forwarded to the output If the system deviation exceeds the switching differential the input value is passed unchanged to the output The deadband of width 2
52. in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these function blocks containing the function block name and short description AVERAGE Running average of REAL samples HYSTER Boolean hysteresis on the difference of REALs LIM_ALRM _ High low limit alarm with hysteresis INTEGRAL Integration over time DERIVATE Differentiation with respect to time Page 80 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 CMP_R Short description Description Call parameters Return params Prototype LT VAL1 VAL2 EQ GT Full comparison of two real numbers VALI VAL2 numbers to be compared LT TRUE if VALI is lower than VAL2 EQ TRUE if VALI is equal to VAL2 GT TRUE if VALI is greater than VAL2 CMP R value reference is lower CMP_R LT is equal CMP R EQ is_greater CMP_R GT REAL BOOL BOOL BOOL Page 81 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 REALATCH REALATCH data REAL REAL output follow BOOL Short description Real data latch Description For follow TRUE output follows data For follow FALSE output holds the value present at the data input at the moment of the TRUE to FALSE transition Call parameters data real data input REAL follow enable input following INT Return params output REAL Prototype REALATCH flow pass flow_max REALATCH O
53. input B REAL a8 switch 8 input A REAL b8 switch 8 input B REAL ql output of switch 1 REAL q8 output of switch 8 REAL SWITCC_R TRUE 1 22 6 17 11 4 100 0 52 outl SWITCC R ql out8 SWITCC R q8 a See also SWITCH _A SWITCH B and SWITCH T function blocks Page 96 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 LAG Short description Description Call parameters Return parameter Prototype Remarks LAG IN REAL TI REAL REAL OUT CYCLE TMR First order filter The transfer function implemented by this block is 1 TI p 1 where TI has the dimension of time and p is the Laplace transform p plane operator In the time domain output OUT will follow the value of input IN with a certain lag The rate of output change is proportional to the difference IN OUT If a step function is applied to the input an exponential waveform will be output according to the following formula OUT IN 1 exp t TD In this case but also in any other case in which the IN value is stable for a reasonable amount of time for practical purposes the output can be considered to be equal to the input after an interval of 3 5 TI Many natural phenomena for example common heating processes can be simulated using the LAG block IN value to be filtered REAL TI integral time in units of 0 01s REAL CYCLE input sampling interval TMR OUT filtered value REAL
54. itch 1 output of switch 8 q8 BOOL TMR TMR TMR TMR SWITCH_T TRUE 1s 22m 17h 4m30s 5s12 90ms 1s20 1h20m outl SWITCH_T q1 out8 SWITCH _T q8 a See also SWITCH_A SWITCH_B and SWITCH R function blocks Page 55 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SWITCC_T Short description act a1 b1 a8 b8 Description Call parameters Return params Prototype Remarks SWITCC_T BOOL TMR TMR TMR 8 changeover switches for timer data act q1 q8 TRUE A inputs connected to outputs act al b1 a8 b8 FALSE B inputs connected to outputs al bl a8 b8 ql qs SWITCC_T TRUE 1s 220ms 17h 4m30s switch 1 input A switch 1 input B switch 8 input A switch 8 input B output of switch 1 output of switch 8 outl SWITCC _T ql out8 SWITCC_T q8 q8 BOOL TMR TMR TMR TMR TMR TMR 100ms 0s20 a See also SWITCH_A SWITCH_B and SWITCH R function blocks Page 56 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 4 Analog Integer Data Manipulation FBs Standard Analog INTEGER Data Manipulation Function Blocks delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these function blocks containing the function b
55. king period TMR high val Ist level to be output INT low_val 2nd level to be output INT Return params out_a Output signal INT Prototype BLINK_A enab period hilev lolev signal BLINK_A out a Page 107 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 BLINK_R Short description Description Call parameters Return params Prototype BLINK_R run BOOL cycle TMR REAL out_r high_val REAL low_val REAL run cycle out_r high_val low_val Alternating real signal generation Based on standard boolean BLINK function block Once enabled the output will toggle continuously between high_val and low_val values with the period equivalent to cycle When disabled low_val will be output run Bink enable BOOL cycle Blinking period TMR high val Ist level to be output REAL low_val 2nd level to be output REAL out r Output signal REAL BLINK A enab period hilev lolev signal BLINK_A out_r Page 108 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 MONO retriggerable Q start time_elapsed pulse_time Short description Monostable element Description Call parameters retriggerable if TRUE monostable can be retriggered start positive edge triggers monostable pulse_time duration of monostable pulse Return params Q monostable output time elapsed time elapsed from last pos edge of start Prototype MONO TRUE TRUE 5s out MONO
56. lication 0800 0021h Data cannot be transferred or stored to the application because of local control 0800 0022h Data cannot be transferred or stored to the application because of the present device state 0800 0023h Object dictionary dynamic generation fails or no object dictionary is present e g object dictionary is generated from file and generation fails because of an file error Page 118 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 CANSDOWR CANSDOWR Enable BOOL BOOL xecutingF Nodeld INT rrCod Idx AbortCod Subldx Datatype IntegerValue FloatValue Short description Write one variable in CANopen node using SDO protocol Description Write an element of remote database using SDO protocol as defined in CANopen standard document DS301 Call parameters ENABLE start the read operation must be reset by user BOO NODEID node number od the remote node INT IDX index in remote database INT SUBIDX subindex in database INT DATATYPE type of data to be read see table below INT INTEGERVALUE value read represented as integer number INT FLOATVALUE value read represented as float numbe REAL Return params EXECUTINGF TRUE if operation is still in progress BOO ERRCOD state of the last execution see table below BOO ABORTCOD code answered by remote node see table below BOO Prototype CANSDORD TRUE node index subindex INT32 1234 0 0 isrunning CANSDORD EXECUTINGF error CANSDORD ERRCO
57. llel inputs and outputs the functioning of this block is similar to that of SHIFT_T block Initially after power up and during reset the whole register contains only zeros Inputs in2 in7 are parallel inputs only while inputs inl and in8 are both parallel and serial inputs See also SHIFTP_A SHIFTP_B and SHIFTP_R function blocks Call parameters load on rising edge register is loaded from parallel inputs BOOL fwd_bwd shift direction forwards TRUE backwards BOOL clk shifts one place on rising edge BOOL reset when TRUE clears register to 0 BOOL inl parallel input 1 and forward shift data input TMR in2 parallel input 2 TMR in7 parallel input 7 TMR ing parallel input 8 and backward shift data input TMR Return params ql output 1 TMR q8 output 8 TMR Prototype SHIFTP_T FALSE TRUE TRUE FALSE 2s 15h30m 5m20s 120ms ol SHIFTP_T q1 Page 53 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 08 SHIFTP_T q8 Page 54 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SWITCH_T act a1 a2 a7 a8 Short description Description Call parameters Return params Prototype Remarks SWITCH_T BOOL TMR TMR act al q1 q2 a8 q7 q8 0 8 single switches for timer data act al a8 ql q8 TRUE inputs connected to outputs FALSE zero output on all outputs input to switch 1 input to switch 8 output of sw
58. lock name and short description CMP Full comparison STACKINT Stack of INTEGERs Page 57 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 AVRG_A Short description Description Call parameters Return params Prototype RUN XIN XOUT Running average over N integer analog samples This is the analog equivalent of the standard AVERAGE function block Except for changed input and output types its functioning is exactly the same as the original block For further details please refer to the description of the original block in the ISaGRAF User s Manual RUN enable command reset average if FALSE XIN input sample N number of samples for averaging XOUT running average AVRG A average_enable sample_value 4 clean_value AVRG_A XOUT BOOL INT INT INT Page 58 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DERIV_A Short description Description Call parameters Return params Prototype Example DERIV_A RUN BOOL XIN INT XOUT CYCLE TMR RUN dx dt XOUT CYCLE Differentiation with respect to time This is the analog equivalent of the standard DERIVATE function block Except for changed input and output types its functioning is exactly the same as the original block Derivation is output in units of 1 10ms i e the output numerical quantity represents the change of the input signal in the interval of 10ms The value applied to th
59. n parameter packed INT Prototype packed packboo b0 b1 b2 b15 Page 16 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 6 Comparison Functions Standard Comparison Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description LT Less than all data types LE Less than or equal all data types except TMR GT Greater than all data types GE Greater than or equal all data types except TMR EQ Equal to all data types except TMR NE Not equal to all data types except TMR Currently no functions written by EXOR have been added to this group Page 17 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 7 Register Control Functions Standard Register Control Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description ROL ROR SHL SHR Rotate INTEGER left Rotate INTEGER right Shift INTEGER left Shift INTEGER right Page 18 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFT Short description Description Call parameters Return parameter Prototype
60. nt the generic term Function Block will be used as a reference to Functions Conversion Functions and Function Blocks as defined in the ISaGRAF User s Manual This Manual should also be used as a reference to standard Function Blocks written by CJ International and delivered as a part of the ISaGRAF package Page 2 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 Functions A function has at most one output and no internal memory Due to this lack of information transfer between calls for the same set of inputs a function will always return the same output value Each function belongs to one of the following classes Arithmetic functions Math functions Trigonometric functions Boolean functions Logic functions Comparison functions Register control functions Data manipulation functions Data conversion functions String management functions Array manipulation functions System access functions Hardware specific functions Page 3 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 1 Arithmetic Functions Standard Arithmetic Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description ADD Addition INTEGERs and REALs extensible SUB Subtraction INTEGERs and REALs MUL Multiplication INTEGERs an
61. otype scaled_value SCALE_A inp imin imax omin omax INT Page 29 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SCALE R SCALE_R in REAL inmin REAL inmax REAL out outmin REAL outmax REAL Short description Scaling of real value Description This block scales the input value from range INMIN INMAX to the range OUTMIN OUTMAX using the following formula IN INMIN OUT OUTMIN OUTMAX OUTMIN INMAX INMIN Call parameters IN input value REAL INMIN minimum input value REAL INMAX maximum input value REAL OUTMIN output value if IN INMIN REAL OUTMAX output value if IN INMAX REAL Return parameter OUT output value REAL Prototype scaled value SCALE R inp imin imax omin omax Page 30 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 PT100 Short description Description Call parameters Return parameter Prototype PT100 in REAL REAL out Converts PT100 resistance value to temperature value The temperature for input value gt 100 ohms is calculated exactly from formula Rt 100 1 A t B t 2 The temperature for input value lt 100 ohms is approximately calculated from the formula Rt 100 1 A t B t 2 100 C t 3 where A 3 90802E 3 B 5 802E 7 and C 1 216532358E 11 C is the corrected value of C 4 2735E 12 Compared with correct formula Rt 100 1 A t B t 2 C t 10
62. r non synchronized channels If dutyc is less than or equal to zero for some channel a steady FALSE signal will be output on that channel s output If dutyc is greater than or equal to 100 for some channel a steady TRUE signal will be output on that channel s output One should take into account the limited time resolution of the PC based target 55ms one BIOS tick No regular pulse can be shorter than this interval Therefore some lower limit on the CYCLE input variable to DUTYCYC and DUTYCYCM blocks must be respected Page 113 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 Call parameters Return params Prototype As a reasonable value 10 seconds for this limit is proposed Since the unit for CYCLE is 10ms 10 seconds are represented by number 1000 applied to CYCLE input of the block In this case 55ms will be approximately 0 5 of the cycle and this amount of error introduced by the finite resolution can be accepted in most applications If CYCLE is shorter than this one must be aware of the increased influence of the resolution related error rising with the decreasing CYCLE value cycle Cycle time TMR dutycl Duty cycle percentage channel 1 0 100 REAL dutyc2 Duty cycle percentage channel 2 0 100 REAL dutyc8 Duty cycle percentage channel 8 0 100 REAL outl Output waveform channel 1 BOOL out2 Output waveform channel 2 BOOL out8 Output waveform channel 8 BOOL DUTY
63. r to keep the needed memory space limited val value to delay REAL delay delay time TMR delayed val delayed value REAL DELAY R value deltat d val DELAY_R delayed_val Page 85 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DEMUX_R Short description Description Call parameters Return params Prototype set load reset address input DEMUX_R BOOL REAL BOOL REAL BOOL INT REAL REAL BOOL Real demultiplexer with memory out1 out2 out16 aerr RESET overrides SET and LOAD inputs SET overrides LOAD input If ADDRESS is 0 all outputs are set to 0 just as if RESET input was active See also DEMUX_A DEMUX_B and DEMUX_T blocks set if TRUE new input value is loaded in each cycle BOOL load new input value is loaded on rising edge BOOL reset if TRUE all outputs are set to 0 BOOL address address of output range 1 to 16 INT input input value to be demultiplexed REAL outl outl6 outputs aerr address error set if address lt 0 or gt 16 BOOL DEMUX R fs fl fr addr in ol DEMUX_R outl err DEMUX_R aerr REAL Page 86 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DSEL R sel_in sel_out out_1 in_1 out_2 in_2 default_out sel_in sel_out in_1 out_1 in_2 Aue out_2 default_out Short description Double independently operated real switch with two inputs Description Please refer to t
64. resis regions of width eps Width of deadband bw is measured from the origin of the coordinate system to the center of any hysteresis region in input signal set_pt center point eps width of hysteresis bw width of deadband out output signal DEADBH R input cpt hyst bw out DEADBH_R out REAL REAL REAL REAL REAL Page 84 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DELAY_R Short description Description Call parameters Return params Prototype DELAY_R val REAL REAL delayed_val delay TMR Time delay of real value If delay is smaller than the duration of one program execution cycle DELAY R block just passes the unmodified input value to the output The maximum delay value is limited only by ISaGRAF limit on variables of TMR type i e it is 24 hours If the specified delay is shorter than 100 cycles val measured in each cycle is put into FIFO and is output after the delay elapses However if this is not the case max delayed_val update period is delay 100 otherwise the FIFO through which the input values pass before being output would be too long Inside one update period the values of val input in all cycles belonging to it are averaged to produce the value that is eventually put into FIFO and output later Averaging is correct for up to 10 cycles per update period but for longer update periods certain values are weighted with varying weights in orde
65. rn params Prototype Remarks SP setpoint REAL PV process variable REAL DB dead band REAL KD derivative time REAL KI integral time REAL KP proportional gain REAL NORMA maximum setpoint or process variable value REAL PD minimum output ON time TMR DT minimum output OFF time dead time TMR CYCLE inputs sampling period TMR OT time needed for fully opening closing the valve TMR OPEN when TRUE ON valve is opening BOOL CLOSE when TRUE ON valve is closing BOOL STEP_REG in real db real kd real ki real kp real norma_real pd_tmr dt_tmr cycle tmr ot_tmr op_out STEP_REG OPEN cl_out STEP_REG CLOSE or an external automatic control specialist b KD and KI inputs are of type REAL although they are used for inputting quantites that have a dimension of time so type TMR would be appropriate The reason for this awkward typing is in keeping the block compatible with similar standard blocks delivered by CJ International This may change with the following release of ISaGRAF ALL inputs outputs in ALL function blocks with dimension of time and type REAL use a unit of 10ms For example to denote a time interval of 1s value 100 must be applied to such an input Page 100 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 RAMP_R IN OUT SLOPE Short description Ramp limiter for real signals Description Output OUT follows the input signal IN as long as the a
66. s Prototype PLAUS_R in REAL REAL out diff REAL Plausibility checking block for real input The block compares the difference between two succesive values sampled on the in input with the value on the diff input Ifthe difference of successive samples is less than diff the actual in value is forwarded to the output If the difference exceeds diff the value to be output is calculated as the mean value of in samples in the 3 preceding cycles In the cycle following this one in is compared not to the preceding value but with the last plausible value i e one before it If the difference in the cycle following the cycle in which the mean value was output is still above diff this is taken as the proof that both this and previous in values are plausible and the in value is normally forwarded to the output in input REAL diff allowed difference REAL out output REAL PLAUS R input difference o PLAUS_R out Page 90 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFT_R Short description Description Call parameters Return params Prototype SHIFT_R size INT fwd_bwd BOOL clk BOOL REAL QF reset BOOL REAL QB fwd_in REAL bwd_in REAL QB QF Bidirectional real shift register of programmable length At each end of the shift register there is one input and one output When a forward shift is executed the value applied to the fwd_in input appears imm
67. s immediately at the QB output Likewise when a backward shift is executed the value applied to the bwd_in input appears immediately at the QF output Initially after power up and during reset the whole register contains only zeros If a number less than 2 is applied to the size input the shift register will have the length of 2 If a number greater than 256 is applied to the size input the shift register will have the length of 256 The length of the register cannot be changed dynamically value applied to the size input is read only in first cycle after power up or reset See also SHIFT_A SHIFT_B and SHIFT_R function blocks size register length range 2 256 INT fwd_bwd shift direction forwards TRUE backwards BOOL clk shifts one place on rising edge BOOL reset when TRUE clears register to 0 BOOL fwd_in forward shift data input TMR bwd in backward shift data input TMR OF forward shift data output TMR QB backward shift data output TMR SHIFT_T 100 TRUE FALSE FALSE 4m30s 0s50 outfwd SHIFT_T QF outbwd SHIFT_T QB Page 52 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SHIFTP_T SHIFTP_T load BOOL fwd_bwd BOOL clk BOOL q1 reset BOOL q2 in1 TMR in2 TMR q7 q8 in7 in8 qi q2 q3 q4 q5 q6 q7 q8 in2 in3 in4 in5 in6 in Short description Bidirectional timer shift register with 8 parallel inputs and outputs Description Except that it is of fixed length and has para
68. s can be dangerous Call parameters Return parameter dummy Prototype dummy WDRESET Page 37 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 CANONMT Short description Description Call parameters Return parameter CANONMT Enable BOOL BOOL Cmd INT Nodeld INT Send NMT command to a CANopen node CANopen nodes can be controlled by a master using the NMT protocol The master can send NMT commands to cause a change of state in the remote node Enable enable the function BOOL Cmd NMT command can assume the following values INT 1 START node 2 STOP node 128 enter PRE OPERATIONAL mode 129 RESET node 130 RESET COMMUNICATION NodeID node number from 1 to 127 INT 0 will send command to ALL nodes ExecutingF TRUE while executing BOOL Prototype Exec CANONMT TRUE command node Page 38 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 3 Function Blocks Function blocks can have more than one output and can contain internal memory that lets certain data be preseved from one execution of the block to another Therefore a function block may return different values in two invocations with the same input parameters Each function block belongs to one of the following classes Boolean data manipulation FBs Counting FBs Timer FBs Analog integer data manipulation FBs Real data manipulation FBs Signal generation FBs Variable interface FBs Hardwar
69. s will be set to TRUE INPUT REAL HH Limit REAL H Limit REAL L Limit REAL LL Limit REAL HH BOOL H BOOL L BOOL LL BOOL LIMMON R in hh 1 h 1 1 1 I_D hh alarm LIMMON_R HH h alarm LIMMON R H l alarm LIMMON R L ll alarm LIMMON R LL Page 88 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 MAJOR_R Short description Description Call parameters Return params Prototype MAJOR_R dev REAL in1 REAL out in2 REAL err in3 REAL in4 REAL Majority selector for real inputs The majority selector calculates the mean value of all inputs If exactly one input differs from the calculated mean value by more than dev mean value is calculated once more but that input is excluded from the calculation If more than one input deviates by more than dev the mean value of all of the input values is calculated and the output err is set See also MAJOR_A function block dev Max permissible deviation between any input and the calculated mean value inl Input 1 m4 Input 4 out Mean value of inputs not deviating by more than dev from itself err set when majority selection is impossible MAJOR R deviation il 12 13 14 error MAJOR R err mean MAJOR_R out REAL REAL REAL REAL BOOL Page 89 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 PLAUS R Short description Description Call parameters Return param
70. size differs from requested size 16 No reply timeout Abort code Description 0503 0000h Toggle bit not alternated 0504 0000h SDO protocol timed out 0504 0001h Client server command specifier not valid or unknown 0504 0002h Invalid block size block mode only 0504 0003h Invalid sequence number block mode only 0504 0004h CRC error block mode only 0504 0005h Out of memory 0601 0000h Unsupported access to an object 0601 0001h Attempt to read a write only object 0601 0002h Attempt to write a read only object 0602 0000h Object does not exist in the object dictionary 0604 0041h Object cannot be mapped to the PDO 0604 0042h The number and length of the objects to be mapped would exceed PDO length 0604 0043h General parameter incompatibility reason 0604 0047h General internal incompatibility in the device 0606 0000h Access failed due to an hardware error 0607 0010h Data type does not match length of service parameter does not match 0607 0012h Data type does not match length of service parameter too high 0607 0013h Data type does not match length of service parameter too low 0609 001 1h Sub index does not exist 0609 0030h Value range of parameter exceeded only for write access 0609 003 1h Value of parameter written too high 0609 0032h Value of parameter written too low 0609 0036h Maximum value is less than minimum value 0800 0000h general error 0800 0020h Data cannot be transferred or stored to the app
71. totype result EXP_R base exp Remarks This is an extension of the corresponding standard function which allows only an integer exponent to be applied to a real base Page 7 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 EXP E Short description Description Call parameters Return parameter Prototype EXP exponent REAL REAL result base xX e result exponent Natural exponential function base e with real exponent exponent REAL result REAL result EXP_E rex Page 8 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 LN E Short description Description Call parameters Return parameter Prototype LN value REAL REAL result base n result exponent Natural logarithm base e ofa real number value REAL result REAL logval In _e rval Page 9 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 2 3 Trigonometric Functions Standard Trigonometric Functions delivered by CJ International are not described in this document For their full description please refer to the ISaGRAF User s Manual For quick reference here is just a brief listing of these functions containing the function name and short description ACOS Arc cosine of a REAL number ASIN Arc sine of a REAL number ATAN Arc tangent of a REAL number COS Cosine of a REAL number SIN Sine of a REAL number TAN Tangent of a REAL number Currently no functions written by EXOR have been
72. ushed REAL N maximum stack depth INT EMPTY TRUE indicates that the stack is empty BOOL OFLO TRUE indicates stack overflow BOOL OUT value at the top of stack REAL STACKR push_cmd pop_cmd reset_cmd push value max_stack stackempty STACKR EMPTY overflow STACKR OFLO top_value STACKR OUT Page 94 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SWITCH_R act SWITCH_R BOOL act al a1 REAL REAL q1 q1 a2 REAL REAL q2 l a8 l a7 REAL REAL q7 q8 a8 REAL REAL q8 0 Short description 8 single switches for real data Description Call parameters act TRUE inputs connected to outputs BOOL FALSE zero output on all outputs al input to switch 1 REAL as input to switch 8 REAL Return params ql output of switch 1 REAL q8 output of switch 8 REAL Prototype SWITCH _R TRUE 1 22 2 17 11 4 512 93 745 100 0 outl SWITCH R ql out8 SWITCH R qg8 Remarks a See also SWITCH_A SWITCH_B and SWITCH_T function blocks Page 95 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 SWITCC_R Short description act a1 b1 a8 b8 Description Call parameters Return params Prototype Remarks SWITCC_R ad BOOL al REAL REAL q1 q1 REAL b1 l a8 l q8 q8 b8 8 changeover switches for real data act TRUE A inputs connected to outputs BOOL FALSE B inputs connected to outputs al switch 1 input A REAL bl switch 1
73. utputs for which no fixed range is defined in advance For this reason no reasonable normalization can be done and this step remains AT THE RESPONSIBILITY OF THE BLOCK USER In extreme cases rounding errors can make an otherwise stable system become unstable In less critical cases permanent small oscillations of the output value Y in the stable state result They can adversely affect the actuator if not filtered out by an external dead band block To avoid problems of this kind and worse it is recommended to choose Y range to be at least 1 1000 and to scale X and W to values greater than 100 before applying them to the inputs of the analog PID block 3 Input parameters resolution Page 71 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 Since input parameters of an analog PID are also integer quantities they too are subject to loss od resolution For example Kp is often in the range 1 10 If Kp were input without scaling with Kp 1 5 we could only choose whether to apply 1 or 2 to the Kp input with Kp 1 probably giving too slow rise time and Kp 2 too high and too broad an overshoot Ti and Td are subject to similar resolution related problems Standard real PID block supplied by CJ International already uses Ti and Td in 10ms units which is equal to the basic resolution of the whole system Therefore 100 is applied to Ti input to indicate Ti 1 second This approach was not changed on analog PID the same units
74. vidend number to be divided INT divisor number to divide with INT Return params quotient result of division INT modulo remainder value INT Prototype DIVIDE_A dend sor res DIVIDE_A quotient rem DIVIDE _A modulo Page 65 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 DSEL_A sel_in sel_out out_1 in_1 out_2 in_2 default_out sel_in sel_out in_1 out_1 in_2 Aue out_2 default_out Short description Double independently operated analog switch with two inputs Description Please refer to the above relay diagram which should be clear enough Call parameters sel in Selects in_l FALSE or in_2 TRUE BOOL sel out Selects out_1 FALSE or out 2 TRUE BOOL in 1 Analog input 1 INT in_2 Analog input 2 INT default out Value to be placed at non selected output INT Return params out_l Analog output 1 INT out 2 Analog output 2 INT Prototype DSEL A selin selout invall inval2 defout outvall DSEL_ A out_1 outval2 DSEL_A out_2 Page 66 EXOR Tech note PN tn145 0 doc 04 04 00 Ver 1 00 LIM_AL A LIM_AL_A H INT BOOL QH x INT BOOL Q L INT BOOL QL EPS INT Short description Alarm detection for an analog integer variable Description Call parameters H High limit INT X Variable value INT L Lower limit INT EPS Hysteresis around limits INT Return params OH High alarm BOOL Q Any alarm QH or QL BOOL Q
Download Pdf Manuals
Related Search
Related Contents
Wireless Mobile Robots: A Tool for Undergraduate について Modicon Premium PLCs TSX SAY 1000 AmeNitY(アメニティ)取扱説明書 Copyright © All rights reserved.