diff --git a/KD_Pliessnigg_Reinraum.apj b/KD_Pliessnigg_Reinraum.apj index 28c293a..f675c2b 100644 --- a/KD_Pliessnigg_Reinraum.apj +++ b/KD_Pliessnigg_Reinraum.apj @@ -1,5 +1,5 @@  - + diff --git a/LastUser.set b/LastUser.set index 9cdd4bd..4be53a5 100644 --- a/LastUser.set +++ b/LastUser.set @@ -1,5 +1,5 @@  - + diff --git a/Logical/Libraries/LoopConR/Binary.lby b/Logical/Libraries/LoopConR/Binary.lby new file mode 100644 index 0000000..e15927a --- /dev/null +++ b/Logical/Libraries/LoopConR/Binary.lby @@ -0,0 +1,13 @@ + + + + + LoopConR.var + LoopConR.typ + LoopConR.fun + + + + + + \ No newline at end of file diff --git a/Logical/Libraries/LoopConR/LoopConR.fun b/Logical/Libraries/LoopConR/LoopConR.fun new file mode 100644 index 0000000..72608f8 --- /dev/null +++ b/Logical/Libraries/LoopConR/LoopConR.fun @@ -0,0 +1,798 @@ + +{REDUND_OK} FUNCTION_BLOCK LCRPID (* PID controller. *) + VAR_INPUT + enable : BOOL; + ident : {REDUND_UNREPLICABLE} UDINT; + W : REAL; + X : REAL; + Y_max : REAL; + Y_min : REAL; + A : REAL; + Y_man : REAL; + Y_fbk : REAL; + hold_I : BOOL; + mode : USINT; + END_VAR + VAR_OUTPUT + status : UINT; + e : REAL; + Y : REAL; + Yp : REAL; + Yi : REAL; + Yd : REAL; + END_VAR + VAR + Set_Yi : BOOL; + Yi_set : REAL; + force_Yi : BOOL; + Yi_min : REAL; + Yi_max : REAL; + joltFreeDoneLowerLim : BOOL; + joltFreeDoneUpperLim : BOOL; + Yi_minInternal : REAL; + Yi_maxInternal : REAL; + Tv_Tf_old : REAL; + enable_old : BOOL; + e_old : REAL; + deadband_state : UINT; + sysinfo_inst : {REDUND_UNREPLICABLE} SysInfo; + scal_inst : LCRScal; + store1 : {REDUND_UNREPLICABLE} UDINT; + store2 : {REDUND_UNREPLICABLE} UDINT; + timeCnt : {REDUND_UNREPLICABLE} UDINT; + musecs_old : {REDUND_UNREPLICABLE} UINT; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRScal (* Scaling of REAL signals. *) + VAR_INPUT + x : REAL; + x1 : REAL; + y1 : REAL; + x2 : REAL; + y2 : REAL; + END_VAR + VAR_OUTPUT + y : REAL; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRCurveByPoints (* y=f(x) function using coordinates. *) + VAR_INPUT + x : REAL; + NoOfPoints : UINT; + ptr_table : REFERENCE TO lcrCurveByPoints_TabEntry_type; + END_VAR + VAR_OUTPUT + status : UINT; + y : REAL; + END_VAR + VAR + i_tab : INT; + iterations : UINT; + scal1 : LCRScal; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRPIDpara (* Manual configuration of the PID controller. *) + VAR_INPUT + enable : BOOL; + enter : BOOL; + WX_max : REAL; + WX_min : REAL; + invert : BOOL; + deadband : REAL; + deadband_mode : USINT; + dY_max : REAL; + Kp : REAL; + Tn : REAL; + Tv : REAL; + Tf : REAL; + Kw : REAL; + Kfbk : REAL; + fbk_mode : USINT; + d_mode : USINT; + END_VAR + VAR_OUTPUT + status : UINT; + ident : {REDUND_UNREPLICABLE} UDINT; + END_VAR + VAR + internal_data : lcrpid_internal_typ; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRContinServo (* Control of a continuous servo drive without position feedback. *) + VAR_INPUT + enable : BOOL; + x : REAL; + max_value : REAL; + min_value : REAL; + t_impulse : REAL; + t_change_up : REAL; + t_change_down : REAL; + ref : BOOL; + END_VAR + VAR_OUTPUT + status : UINT; + up : BOOL; + down : BOOL; + hysteresis_up : REAL; + hysteresis_down : REAL; + refOk : BOOL; + END_VAR + VAR + enable_old : BOOL; + counter_state : UINT; + bootkey_old : {REDUND_UNREPLICABLE} UDINT; + systicks_old : {REDUND_UNREPLICABLE} UDINT; + musecs_old : {REDUND_UNREPLICABLE} UINT; + ref_old : BOOL; + t_cnt_1 : DINT; + t_cnt_2 : DINT; + y_dbl_1 : DINT; + y_dbl_2 : DINT; + sysInfo_inst : {REDUND_UNREPLICABLE} SysInfo; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRPT1 (* First-order delay element, see LCRPT1e(). *) + VAR_INPUT + enable : BOOL; + x : REAL; + t : REAL; + y_set : REAL; + set : BOOL; + END_VAR + VAR_OUTPUT + status : UINT; + y : REAL; + END_VAR + VAR + counter_state : UINT; + bootkey_old : {REDUND_UNREPLICABLE} UDINT; + systicks_old : {REDUND_UNREPLICABLE} UDINT; + musecs_old : {REDUND_UNREPLICABLE} UINT; + y_dbl_1 : DINT; + y_dbl_2 : DINT; + sysinfo_inst : {REDUND_UNREPLICABLE} SysInfo; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRRamp (* Ramp generator. *) + VAR_INPUT + enable : BOOL; + x : REAL; + dy_up : REAL; + dy_down : REAL; + y_max : REAL; + y_min : REAL; + y_set : REAL; + set : BOOL; + END_VAR + VAR_OUTPUT + status : UINT; + y : REAL; + x_reached : BOOL; + max_limit : BOOL; + min_limit : BOOL; + END_VAR + VAR + y_dbl_1 : DINT; + y_dbl_2 : DINT; + timestore1 : UDINT; + timestore2 : UDINT; + getDtForceOff : UDINT; + sysinfo_inst : {REDUND_UNREPLICABLE} SysInfo; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRIntegrate (* Integrator with limits and set value. *) + VAR_INPUT + enable : BOOL; + x : REAL; + tn : REAL; + y_max : REAL; + y_min : REAL; + y_set : REAL; + set : BOOL; + END_VAR + VAR_OUTPUT + status : UINT; + y : REAL; + max_limit : BOOL; + min_limit : BOOL; + END_VAR + VAR + counter_state : UINT; + bootkey_old : {REDUND_UNREPLICABLE} UDINT; + systicks_old : {REDUND_UNREPLICABLE} UDINT; + musecs_old : {REDUND_UNREPLICABLE} UINT; + y_dbl_1 : DINT; + y_dbl_2 : DINT; + sysinfo_inst : {REDUND_UNREPLICABLE} SysInfo; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRLimit (* Limiter with overrun indicators. *) + VAR_INPUT + in : REAL; + max_value : DINT; + min_value : DINT; + END_VAR + VAR_OUTPUT + status : UINT; + out : DINT; + max_limit : BOOL; + min_limit : BOOL; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRLimScal (* Scaling and limiting of REAL signals. *) + VAR_INPUT + x : REAL; + x1 : REAL; + y1 : REAL; + x2 : REAL; + y2 : REAL; + END_VAR + VAR_OUTPUT + y : REAL; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRPWM (* Pulse width modulator (can also be used as pulse frequency modulator). *) + VAR_INPUT + enable : BOOL; + x : REAL; + max_value : REAL; + min_value : REAL; + t_min_pulse : REAL; + t_period : REAL; + END_VAR + VAR_OUTPUT + status : UINT; + pulse : BOOL; + t_on : REAL; + t_off : REAL; + END_VAR + VAR + cnt_terron_1 : DINT; + cnt_terron_2 : DINT; + cnt_terroff_1 : DINT; + cnt_terroff_2 : DINT; + cnt_t_pulse_1 : DINT; + cnt_t_pulse_2 : DINT; + store1 : UDINT; + store2 : UDINT; + timeCnt : UDINT; + sysinfo_inst : SysInfo; + corr : BOOL; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRMovAvgFlt (* Floating average value filter. *) + VAR_INPUT + enable : BOOL; + x : REAL; + base : UINT; + END_VAR + VAR_OUTPUT + status : UINT; + y : REAL; + END_VAR + VAR + sum_old_dbl_1 : DINT; + sum_old_dbl_2 : DINT; + p_xold : {REDUND_UNREPLICABLE} UDINT; + i_xold : UINT; + base_old : {REDUND_UNREPLICABLE} UINT; + enable_old : {REDUND_UNREPLICABLE} BOOL; + bootkey_old : {REDUND_UNREPLICABLE} UDINT; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRTimeBasedOnOff (* 3-position step output, see LCRContinServo(). *) + VAR_INPUT + enable : BOOL; + x : REAL; + max_value : REAL; + min_value : REAL; + timpulse : REAL; + tchange_up : REAL; + tchange_down : REAL; + ref : BOOL; + END_VAR + VAR_OUTPUT + status : UINT; + up : BOOL; + down : BOOL; + hysteresis_up : REAL; + hysteresis_down : REAL; + refOk : BOOL; + END_VAR + VAR + enable_old : BOOL; + counter_state : UINT; + bootkey_old : UDINT; + systicks_old : UDINT; + musecs_old : UINT; + ref_old : BOOL; + t_cnt_1 : DINT; + t_cnt_2 : DINT; + y_dbl_1 : DINT; + y_dbl_2 : DINT; + sysInfo_inst : SysInfo; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRDifferentiate (* Differentiator with filter. *) + VAR_INPUT + enable : BOOL; + x : REAL; + tv : REAL; + tf : REAL; + END_VAR + VAR_OUTPUT + status : UINT; + y : REAL; + END_VAR + VAR + store1 : {REDUND_UNREPLICABLE} UDINT; + store2 : {REDUND_UNREPLICABLE} UDINT; + timeCnt : {REDUND_UNREPLICABLE} UDINT; + counter_state : UINT; + bootkey_old : {REDUND_UNREPLICABLE} UDINT; + systicks_old : {REDUND_UNREPLICABLE} UDINT; + musecs_old : {REDUND_UNREPLICABLE} UINT; + sysinfo_inst : {REDUND_UNREPLICABLE} SysInfo; + a11 : DINT; + a12 : DINT; + a21 : DINT; + a22 : DINT; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRSlimPID (* PID controller with integrated tuning. *) + VAR_INPUT + enable : BOOL; + W : REAL; + X : REAL; + request : UDINT; + pPar : REFERENCE TO lcrslimpid_par_typ; + END_VAR + VAR_OUTPUT + e : REAL; + Y : REAL; + status : UINT; + addInfo : UINT; + END_VAR + VAR + MovAvgFlt_inst : LCRMovAvgFlt; + PIDTune_inst : LCRPIDTune; + PID_inst : LCRPID; + enable_old : BOOL; + requ_old : UDINT; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRPIDTune (* Automatically determines the control parameters for an LCRPID() instance with different methods. *) + VAR_INPUT + enable : BOOL; + Y_min : REAL; + Y_max : REAL; + Y0 : REAL; + Y1 : REAL; + okToStep : BOOL; + X0 : REAL; + X_min : REAL; + X_max : REAL; + P_manualAdjust : INT; + I_manualAdjust : INT; + D_manualAdjust : INT; + request : UDINT; + pAddPar : REFERENCE TO lcrpid_tune_addpar_typ; + pOptions_osc : REFERENCE TO lcrpid_tune_osc_options_typ; + pOptions_step : REFERENCE TO lcrpid_tune_step_options_typ; + END_VAR + VAR_OUTPUT + status : UINT; + addInfo : UINT; + ident : UDINT; + state : UINT; + rdyToStep : BOOL; + END_VAR + VAR + t_autotune : REAL; + status_tmp : UINT; + counter_state : UINT; + bootkey_old : UDINT; + systicks_old : UDINT; + musecs_old : UINT; + curveDown : BOOL; + e : REAL; + e_minAmp : REAL; + e_old_up : REAL; + e_old_down : REAL; + curveUp : BOOL; + e_old : REAL; + sysinfo_inst : SysInfo; + MovAvgFlt_inst : LCRMovAvgFlt; + old : lcrpid_old_typ; + processPar : lcrpid_procPar_typ; + internal_data : lcrpid_internal_typ; + addPar : lcrpid_tune_addpar_typ; + oscillation : lcrpid_tune_osc_typ; + stepresponse : lcrpid_tune_step_typ; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRPFM (* Pulse frequency modulator. *) + VAR_INPUT + enable : BOOL; + x : REAL; + max_value : REAL; + min_value : REAL; + t_pulse : REAL; + t_pause : REAL; + END_VAR + VAR_OUTPUT + status : UINT; + pulse : BOOL; + END_VAR + VAR + area : REAL; + area_c : REAL; + range : REAL; + last : REAL; + tpls : REAL; + enable_old : BOOL; + counter_state : UINT; + bootkey_old : UDINT; + systicks_old : UDINT; + musecs_old : UINT; + sysinfo_inst : SysInfo; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRSimModExt (* Thermal simulation model of an extruder with heating zones and cooling circulation. *) + VAR_INPUT + enable : BOOL; + Tt_h : DINT; + Tt_c : DINT; + k_h : REAL; + k_c : REAL; + PT2_T1 : REAL; + PT2_T2 : REAL; + Temp_amb : REAL; + Temp_c : REAL; + Alpha_h : REAL; + Alpha_c : REAL; + END_VAR + VAR_OUTPUT + y : REAL; + status : UINT; + END_VAR + VAR + Tt_heat : LCRTt; + Tt_cool : LCRTt; + k_h_intern : REAL; + k_c_intern : REAL; + PT2 : LCRPT2; + y_c : REAL; + y_end : REAL; + y_h : REAL; + Bootkey : UDINT; + enable_old : BOOL; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRTt (* Delay time. *) + VAR_INPUT + enable : BOOL; + Tt : DINT; + x : REAL; + y_set : REAL; + set : BOOL; + END_VAR + VAR_OUTPUT + y : REAL; + status : UINT; + END_VAR + VAR + Ts : DINT; + Tt_Max : DINT; + pRingBuf : {REDUND_UNREPLICABLE} REFERENCE TO REAL; + pBuf_OutIn : {REDUND_UNREPLICABLE} REFERENCE TO REAL; + set_old : USINT; + Set_y : USINT; + enable_old : {REDUND_UNREPLICABLE} BOOL; + Bootkey : {REDUND_UNREPLICABLE} UDINT; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRPT2 (* Second-order delay element. *) + VAR_INPUT + enable : BOOL; + V : REAL; + T1 : REAL; + T2 : REAL; + x : REAL; + y_set : REAL; + set : USINT; + END_VAR + VAR_OUTPUT + y : REAL; + status : UINT; + END_VAR + VAR + x1_dbl_1 : UDINT; + x1_dbl_2 : UDINT; + x2_dbl_1 : UDINT; + x2_dbl_2 : UDINT; + Ts : DINT; + Ts_dbl_1 : UDINT; + Ts_dbl_2 : UDINT; + set_old : USINT; + Set_y : USINT; + Bootkey : {REDUND_UNREPLICABLE} UDINT; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRPT1e (* First-order delay element. *) + VAR_INPUT + enable : BOOL; + V : REAL; + T1 : REAL; + x : REAL; + y_set : REAL; + set : USINT; + END_VAR + VAR_OUTPUT + y : REAL; + status : UINT; + END_VAR + VAR + x1_dbl_1 : UDINT; + x1_dbl_2 : UDINT; + Ts : DINT; + Ts_dbl_1 : UDINT; + Ts_dbl_2 : UDINT; + set_old : USINT; + Set_y : USINT; + Bootkey : {REDUND_UNREPLICABLE} UDINT; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRDblActPID (* PID controller with two outputs for two opposing manipulated variables and integrated tuning. *) + VAR_INPUT + enable : BOOL; + W : REAL; + X : REAL; + Y_man : REAL; + hold_I : BOOL; + mode : USINT; + okToStep : BOOL; + pPar1 : REFERENCE TO lcrdblpid_par_typ; + pPar2 : REFERENCE TO lcrdblpid_par_typ; + pAddPar : REFERENCE TO lcrpid_tune_addpar_typ; + pOpt : REFERENCE TO lcrdblpid_tune_typ; + END_VAR + VAR_OUTPUT + e : REAL; + Y1 : REAL; + Y2 : REAL; + status : UINT; + tuneState : USINT; + rdyToStep : BOOL; + END_VAR + VAR + enable_old : BOOL; + pid : LCRPID; + tune : LCRPIDTune; + sysinfo_inst : SysInfo; + gradient : REAL; + Y_avg : REAL; + tcnt_1 : UDINT; + tcnt_2 : UDINT; + Tmeas : REAL; + y_lim_old : REAL; + p_fact : REAL; + bootkey_old : UDINT; + systicks_old : UDINT; + musecs_old : UINT; + use_par : USINT; + meas : USINT; + mode_old : USINT; + tune_step : USINT; + tune_grad : USINT; + tune_2nd : USINT; + invert : USINT; + counter_state : USINT; + mode_int : USINT; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRMinMax (* Smallest and largest peak value. *) + VAR_INPUT + reset : BOOL; + in : REAL; + END_VAR + VAR_OUTPUT + out_min : REAL; + out_max : REAL; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRTempPID (* PID controller especially for temperature systems. *) + VAR_INPUT + enable : BOOL; + Temp_set : REAL; + Temp : REAL; + Y_man : REAL; + mode : UDINT; + update : BOOL; + pSettings : REFERENCE TO lcrtemp_set_typ; + END_VAR + VAR_OUTPUT + y_heat : REAL; + y_cool : REAL; + status : UINT; + END_VAR + VAR + pid : LCRPID; + pid_para : LCRPIDpara; + Temp_set_delay : REAL; + Temp_set_int : REAL; + TempSetOld : REAL; + delayCnt : REAL; + delayFlag : BOOL; + enable_old : BOOL; + stateOld : SINT; + state : SINT; + a : REAL; + sysinfo_inst : SysInfo; + para_check_done : USINT; + internal_para : lcrtemp_pid_internal_typ; + dbl_dt : REAL; + tAlt : REAL; + altTime : REAL; + tKnick : REAL; + fAlt : REAL; + altActive : BOOL; + a_alt : REAL; + a_e : REAL; + a_internal : REAL; + err_flag : BOOL; + Temp_set_int_old1 : REAL; + Temp_set_int_old2 : REAL; + Temp_set_int_old3 : REAL; + mode_old : UDINT; + timestore1 : UDINT; + timestore2 : UDINT; + yManInternal : REAL; + timeCnt : UDINT; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRTempTune (* Precision tuning process especially for temperature systems. *) + VAR_INPUT + enable : BOOL; + start : BOOL; + Temp_set : REAL; + Temp : REAL; + okToHeat : BOOL; + okToFree : BOOL; + okToFreeEnd : BOOL; + okToCool : BOOL; + okToCoolEnd : BOOL; + pSettings : REFERENCE TO lcrtemp_set_typ; + END_VAR + VAR_OUTPUT + y_heat : REAL; + y_cool : REAL; + rdyToHeat : BOOL; + rdyToFree : BOOL; + rdyToFreeEnd : BOOL; + rdyToCool : BOOL; + rdyToCoolEnd : BOOL; + done : BOOL; + busy : BOOL; + status : UINT; + END_VAR + VAR + enable_old : BOOL; + pid : LCRPID; + pid_para : LCRPIDpara; + DT2 : LCRDifferentiate; + pt2 : LCRPT2o; + Temp_flt : REAL; + step : UINT; + t : REAL; + Temp_start : REAL; + mem00 : REAL; + cnt02 : REAL; + cnt33 : REAL; + cnt20 : REAL; + pem01 : REAL; + pem33 : REAL; + pem10 : REAL; + pem02 : REAL; + pem44 : REAL; + pem20 : REAL; + tol01 : REAL; + tol10 : REAL; + tol02 : REAL; + tol20 : REAL; + tol22 : REAL; + Temp_old : REAL; + delta_Temp : REAL; + tcnt_1 : UDINT; + tcnt_2 : UDINT; + tcnt_dT_1 : UDINT; + tcnt_dT_2 : UDINT; + sysinfo_inst : SysInfo; + Temp_set_internal : REAL; + timecounter : REAL; + internal_para : lcrtemp_tune_internal_typ; + dbl_dt : REAL; + call_counter : UDINT; + store1 : UDINT; + store2 : UDINT; + timeCnt : UDINT; + timer2 : REAL; + waitCounter : UINT; + Y_heat_tune_intern : REAL; + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION_BLOCK LCRPT2o (* Oscillating 2nd order delay element. *) + VAR_INPUT + enable : BOOL; + V : REAL; + D : REAL; + Tf : REAL; + u : REAL; + Set_y : USINT; + y_set : REAL; + END_VAR + VAR_OUTPUT + y : REAL; + status : UINT; + END_VAR + VAR + Internal : lcrpt2o_Internal_typ; + END_VAR +END_FUNCTION_BLOCK + +FUNCTION_BLOCK LCRSchedulePWM (* Pulse width modulator for n inputs with a specified power limitation. *) + VAR_INPUT + enable : BOOL; + Pmax : REAL; + n : UINT; + pPar : UDINT; + min_value : REAL; + max_value : REAL; + t_min_pulse : REAL; + t_period : REAL; + END_VAR + VAR_OUTPUT + status : UINT; + END_VAR + VAR + sysinfo_inst : SysInfo; + store1 : UDINT; + store2 : UDINT; + timeCnt : UDINT; + numberUnits : UINT; + limFact : UINT; + enable_old : BOOL; + cmd_delay : BOOL; + err_flag : BOOL; + limAll : BOOL; + Pact : REAL; + Pman : REAL; + intern0 : ARRAY[0..5] OF REAL; + in : REFERENCE TO lcrschedule_par_typ; + END_VAR +END_FUNCTION_BLOCK diff --git a/Logical/Libraries/LoopConR/LoopConR.typ b/Logical/Libraries/LoopConR/LoopConR.typ new file mode 100644 index 0000000..74c20a0 --- /dev/null +++ b/Logical/Libraries/LoopConR/LoopConR.typ @@ -0,0 +1,400 @@ + +TYPE + lcrCurveByPoints_TabEntry_type : STRUCT + x : REAL; + y : REAL; + END_STRUCT; + lcrdblpid_par_typ : STRUCT + Y_max : REAL; + Y_min : REAL; + K_fact : INT; + Kp : REAL; + Tn : REAL; + Tv : REAL; + END_STRUCT; + lcrdblpid_tune_typ : STRUCT + P1_manualAdjust : INT; + I1_manualAdjust : INT; + D1_manualAdjust : INT; + P2_manualAdjust : INT; + I2_manualAdjust : INT; + D2_manualAdjust : INT; + X_min : REAL; + X_max : REAL; + X0 : REAL; + de_min : REAL; + Y0 : REAL; + Y1step : REAL; + Y2step : REAL; + tuneY1_opt : UDINT; + tuneY2_opt : UDINT; + tune_first : USINT; + hyst : REAL; + measDelta : REAL; + osc_opt : lcrpid_tune_osc_options_typ; + step_opt : lcrpid_tune_step_options_typ; + END_STRUCT; + lcrpid_internal_typ : {REDUND_REPLICABLE} STRUCT + size : UINT; + valid : BOOL; + WX_max : REAL; + WX_min : REAL; + invert : BOOL; + deadband : REAL; + deadband_mode : USINT; + dY_max : REAL; + Kp : REAL; + Kp_Tn : REAL; + Tv_Tf : REAL; + Tf_reciproc : REAL; + Kw : REAL; + Kfbk_Kp : REAL; + Kfbk_Kp_max : REAL; + fbk_mode : USINT; + d_mode : USINT; + force_mode : USINT; + Y_force : REAL; + W : REAL; + X : REAL; + pid_init : USINT; + Yp1 : DINT; + Yp2 : DINT; + dYi1 : DINT; + dYi2 : DINT; + Yi1 : DINT; + Yi2 : DINT; + dt_Tf : REAL; + a11 : DINT; + a12 : DINT; + a21 : DINT; + a22 : DINT; + Yd1 : DINT; + Yd2 : DINT; + Ytotal1 : DINT; + Ytotal2 : DINT; + Ylim1 : DINT; + Ylim2 : DINT; + Y1 : DINT; + Y2 : DINT; + deltaY_fbk : REAL; + e_fbk : REAL; + END_STRUCT; + lcrpid_old_typ : STRUCT + processPar : lcrpid_procPar_typ; + P_manualAdjust : INT; + I_manualAdjust : INT; + D_manualAdjust : INT; + Y_min : REAL; + Y_max : REAL; + dY_max : REAL; + Tf_Tv : REAL; + Kw : REAL; + Kfbk : REAL; + deadband : REAL; + W : REAL; + request : UDINT; + fbk_mode : USINT; + d_mode : USINT; + invert : BOOL; + enable : BOOL; + END_STRUCT; + lcrpid_osc_per_typ : STRUCT + max : lcrpid_osc_val_typ; + min : lcrpid_osc_val_typ; + END_STRUCT; + lcrpid_osc_val_typ : STRUCT + X : REAL; + t : REAL; + END_STRUCT; + lcrpid_procPar_typ : STRUCT + size : UINT; + valid : BOOL; + stepResp_valid : BOOL; + stepResp_v : REAL; + stepResp_t_u : REAL; + stepResp_t_g : REAL; + osc_valid : BOOL; + osc_amplitudeRatio : REAL; + osc_tPeriod : REAL; + force_params : BOOL; + Kp : REAL; + Kp_tune : REAL; + Tn : REAL; + Tn_tune : REAL; + Tv : REAL; + Tv_tune : REAL; + END_STRUCT; + lcrpid_tune_addpar_typ : STRUCT + t_max_tune : REAL; + WX_min : REAL; + WX_max : REAL; + dY_max : REAL; + Tf_Tv : REAL; + Kw : REAL; + Kfbk : REAL; + fbk_mode : USINT; + d_mode : USINT; + deadband : REAL; + deadband_mode : USINT; + invert : BOOL; + END_STRUCT; + lcrpid_tune_osc_options_typ : STRUCT + osc_minAmplitude : REAL; + Q_min : REAL; + END_STRUCT; + lcrpid_tune_osc_typ : STRUCT + options : lcrpid_tune_osc_options_typ; + oscPhase : UINT; + dir : SINT; + enHi : BOOL; + enLo : BOOL; + Y_hi : REAL; + Y_lo : REAL; + i_maxPeriod : UINT; + i_period : UINT; + X_ampl : REAL; + X_avg : REAL; + X_min_avg : REAL; + X_max_avg : REAL; + Y_avg : REAL; + deltaY : REAL; + t_Ylohi : ARRAY[0..4] OF REAL; + t_Yhilo : ARRAY[0..4] OF REAL; + Q_act : REAL; + a_wx : REAL; + amplitudeRatio : REAL; + Ku : REAL; + tPeriod : REAL; + period : ARRAY[0..4] OF lcrpid_osc_per_typ; + END_STRUCT; + lcrpid_tune_step_options_typ : STRUCT + eqDeltaX : REAL; + eqDeltaWX : REAL; + eqDeltat : REAL; + evalDeltaX : REAL; + evalNfilter : UINT; + exitNotMaxdXCount : UINT; + exitdXRatio : REAL; + END_STRUCT; + lcrpid_tune_step_typ : STRUCT + options : lcrpid_tune_step_options_typ; + Y0 : REAL; + Y1 : REAL; + t_jump : REAL; + W : REAL; + X0 : REAL; + Xmax : REAL; + Xmin : REAL; + Xfiltered : REAL; + deltaXok : BOOL; + deltaWXok : BOOL; + eqTime : REAL; + dir : SINT; + deltaX : REAL; + X1 : REAL; + t1 : REAL; + t1set : BOOL; + dX_dt : REAL; + dX_dt_max : REAL; + XmaxGrad : REAL; + maxX1 : REAL; + maxX2 : REAL; + maxt1 : REAL; + maxt2 : REAL; + tmaxGrad : REAL; + gainFactor : REAL; + deadTime : REAL; + riseTime : REAL; + notMaxCount : UINT; + gradientRatio : REAL; + END_STRUCT; + lcrpt2o_Internal_typ : STRUCT + Ts : DINT; + Ts_dbl_1 : UDINT; + Ts_dbl_2 : UDINT; + V_old : REAL; + D_old : REAL; + Tf_old : REAL; + Set_y_old : USINT; + Set_y_2 : USINT; + x1_dbl_1 : UDINT; + x1_dbl_2 : UDINT; + x2_dbl_1 : UDINT; + x2_dbl_2 : UDINT; + Sqrt_D_1_dbl_1 : UDINT; + Sqrt_D_1_dbl_2 : UDINT; + Ts_Tf_dbl_1 : UDINT; + Ts_Tf_dbl_2 : UDINT; + Exp_D_Ts_Tf_dbl_1 : UDINT; + Exp_D_Ts_Tf_dbl_2 : UDINT; + a0_dbl_1 : UDINT; + a0_dbl_2 : UDINT; + a1_dbl_1 : UDINT; + a1_dbl_2 : UDINT; + b0_dbl_1 : UDINT; + b0_dbl_2 : UDINT; + b1_dbl_1 : UDINT; + b1_dbl_2 : UDINT; + Bootkey : {REDUND_UNREPLICABLE} UDINT; + END_STRUCT; + lcrschedule_add_typ : STRUCT + periodTime : REAL; + onTime : REAL; + t_on_intern : REAL; + bcOnTime : REAL; + sortIndex : UINT; + fbkPWM : LCRPWM; + flagDelay : BOOL; + END_STRUCT; + lcrschedule_par_typ : STRUCT + P : REAL; + X : REAL; + pulse : BOOL; + Pout : REAL; + lim : BOOL; + Internal : lcrschedule_add_typ; + END_STRUCT; + lcrslimpid_par_typ : STRUCT + Y_max : REAL; + Y_min : REAL; + Kp : REAL; + Tn : REAL; + Tv : REAL; + Kfbk : REAL; + END_STRUCT; + lcrtemp_add_typ : STRUCT + mem01 : REAL; + mem02 : REAL; + mem10 : REAL; + mem20 : REAL; + exp_mem : REAL; + cnt01 : REAL; + cnt02 : REAL; + cnt10 : REAL; + cnt20 : REAL; + cnt03 : REAL; + cnt30 : REAL; + cnt00 : REAL; + t_ignore_dT_heat : REAL; + t_ignore_dT_free : REAL; + t_ignore_dT_cool : REAL; + yMin : REAL; + yMax : REAL; + reserved3 : UDINT; + reserved4 : UDINT; + reserved5 : BOOL; + reserved6 : BOOL; + END_STRUCT; + lcrtemp_pid_internal_typ : STRUCT + enable_cooling : BOOL; + disable_heating : BOOL; + hyst : REAL; + delay : REAL; + Kw : REAL; + Kfbk : REAL; + Kp_h : REAL; + Tn_h : REAL; + Tv_h : REAL; + Kp_c : REAL; + Tn_c : REAL; + Tv_c : REAL; + dynGeneral : REAL; + dynHeat : REAL; + dynCool : REAL; + mem01 : REAL; + mem02 : REAL; + mem10 : REAL; + mem20 : REAL; + exp_mem : REAL; + yMin : REAL; + yMax : REAL; + END_STRUCT; + lcrtemp_pid_opt_typ : STRUCT + Kp_h : REAL; + Tn_h : REAL; + Tv_h : REAL; + Tf_h : REAL; + Kp_c : REAL; + Tn_c : REAL; + Tv_c : REAL; + Tf_c : REAL; + dynGeneral : REAL; + dynHeat : REAL; + dynCool : REAL; + END_STRUCT; + lcrtemp_pid_set_typ : STRUCT + hyst : REAL; + hyst_mode : USINT; + delay : REAL; + Kw : REAL; + Kfbk : REAL; + END_STRUCT; + lcrtemp_set_typ : STRUCT + enable_cooling : BOOL; + disable_heating : BOOL; + PIDpara : lcrtemp_pid_opt_typ; + TuneSet : lcrtemp_tune_set_typ; + PIDSet : lcrtemp_pid_set_typ; + Internal : lcrtemp_add_typ; + END_STRUCT; + lcrtemp_tune_internal_typ : STRUCT + cool_tuning : BOOL; + disable_heating : BOOL; + mode : UDINT; + Temp_amb : REAL; + dRatio_heat : REAL; + cnt_tp_heat : REAL; + delta_T_heat : REAL; + dT_min_heat : REAL; + dRatio_free : REAL; + cnt_tp_free : REAL; + delta_T_free : REAL; + dT_min_free : REAL; + dRatio_cool : REAL; + cnt_tp_cool : REAL; + delta_T_cool : REAL; + dT_min_cool : REAL; + delta_T_sync_heat : REAL; + delta_dT_sync_heat : REAL; + cnt_wait_heat : REAL; + delta_T_sync_free : REAL; + delta_dT_sync_free : REAL; + cnt_wait_free : REAL; + delta_T_sync_cool : REAL; + delta_dT_sync_cool : REAL; + cnt_wait_cool : REAL; + filter_base_T : REAL; + t_ignore_dT_heat : REAL; + t_ignore_dT_free : REAL; + t_ignore_dT_cool : REAL; + delta_T_sync_stop : REAL; + END_STRUCT; + lcrtemp_tune_set_typ : STRUCT + mode : UDINT; + Temp_amb : REAL; + dRatio_heat : REAL; + cnt_tp_heat : REAL; + delta_T_heat : REAL; + dT_min_heat : REAL; + dRatio_free : REAL; + cnt_tp_free : REAL; + delta_T_free : REAL; + dT_min_free : REAL; + dRatio_cool : REAL; + cnt_tp_cool : REAL; + delta_T_cool : REAL; + dT_min_cool : REAL; + delta_T_sync_heat : REAL; + delta_dT_sync_heat : REAL; + cnt_wait_heat : REAL; + delta_T_sync_free : REAL; + delta_dT_sync_free : REAL; + cnt_wait_free : REAL; + delta_T_sync_cool : REAL; + delta_dT_sync_cool : REAL; + cnt_wait_cool : REAL; + filter_base_T : REAL; + delta_T_sync_stop : REAL; + Y_heat_tune : REAL; + END_STRUCT; +END_TYPE diff --git a/Logical/Libraries/LoopConR/LoopConR.var b/Logical/Libraries/LoopConR/LoopConR.var new file mode 100644 index 0000000..788a286 --- /dev/null +++ b/Logical/Libraries/LoopConR/LoopConR.var @@ -0,0 +1,192 @@ +VAR CONSTANT + LCRPID_DEADBAND_MODE_ZERO : USINT := 0; + LCRTEMP_HEAT : USINT := 0; + LCRPID_MODE_OFF : USINT := 0; + LCRPID_TUNE_STATE_READY : UINT := 0; + LCRSLIMPID_REQU_OFF : UDINT := 0; + LCRTEMP_PT1 : USINT := 0; + LCRTEMPTune_MODE_DEF : UDINT := 0; + LCRDBLPID_TSTATE_OFF : USINT := 0; + LCRPID_TUNE_REQU_OFF : UDINT := 0; + LCRTEMPTune_MODE_EXP : UDINT := 1; + LCRPID_MODE_AUTO : USINT := 1; + LCRPID_D_MODE_X : USINT := 1; + LCRPID_DEADBAND_MODE_STANDARD : USINT := 1; + LCRPID_FBK_MODE_INTERN : USINT := 1; + LCRDBLPID_TSTATE_Y1 : USINT := 1; + LCRPID_TUNE_REQU_OSCILLATE : UDINT := 1; + LCRTEMPPID_MODE_AUTO : UDINT := 1; + LCRTEMP_HYST_MODE_JOLTFREE : USINT := 1; + LCRTEMP_PT2 : USINT := 1; + LCRTEMP_COOL : USINT := 1; + LCRSLIMPID_REQU_OSCILLATE : UDINT := 1; + LCRPID_DEADBAND_MODE_STANDARD_I : USINT := 2; + LCRTEMPPID_MODE_MAN : UDINT := 2; + LCRDBLPID_TSTATE_Y2 : USINT := 2; + LCRPID_D_MODE_E : USINT := 2; + LCRSLIMPID_REQU_STEPRESPONSE : UDINT := 2; + LCRPID_MODE_MAN : USINT := 2; + LCRPID_FBK_MODE_EXTERN : USINT := 2; + LCRPID_TUNE_REQU_STEPRESPONSE : UDINT := 2; + LCRPID_MODE_OPEN : USINT := 3; + LCRDBLPID_TSTATE_FINISHED : USINT := 3; + LCRSLIMPID_REQU_READ_PARAS : UDINT := 3; + LCRPID_FBK_MODE_EXT_SELECTOR : USINT := 3; + LCRDBLPID_TSTATE_ERROR : USINT := 4; + LCRPID_FBK_MODE_LIMIT_YI : USINT := 4; + LCRPID_MODE_CLOSE : USINT := 4; + LCRSLIMPID_REQU_WRITE_PARAS : UDINT := 4; + LCRTEMP_STEP_WAIT : UINT := 5; + LCRPID_MODE_FREEZE : USINT := 5; + LCRPID_FBK_MODE_SET_YI : USINT := 5; + LCRDBLPID_MODE_TUNE_4 : USINT := 6; + LCRDBLPID_MODE_TUNE_6 : USINT := 7; + LCRDBLPID_MODE_TUNE_Y1 : USINT := 8; + LCRDBLPID_MODE_TUNE_Y2 : USINT := 9; + LCRPID_TUNE_REQU_DIR_POS : UDINT := 10; + LCRPID_TUNE_STATE_OSCILLATE : UINT := 10; + LCRSLIMPID_REQU_DIR_POS : UDINT := 10; + LCRTEMP_STEP_WAIT_HEAT : UINT := 10; + LCRPID_TUNE_STATE_OSC_SEQ_CNTL : UINT := 11; + LCRPID_TUNE_STATE_OSC_PERFORM_1 : UINT := 12; + LCRPID_TUNE_STATE_OSC_PERFORM_2 : UINT := 13; + LCRPID_TUNE_STATE_OSC_CNTLPAR : UINT := 19; + LCRPID_TUNE_REQU_DIR_NEG : UDINT := 20; + LCRPID_TUNE_STATE_STEP_WAITEQ1 : UINT := 20; + LCRTEMP_STEP_START_HEAT : UINT := 20; + LCRSLIMPID_REQU_DIR_NEG : UDINT := 20; + LCRPID_TUNE_STATE_STEP_MAXGRAD : UINT := 21; + LCRPID_TUNE_STATE_STEP_WAITEQ2 : UINT := 22; + LCRTEMP_STEP_HEAT : UINT := 30; + LCRTEMP_STEP_PID_FREE : UINT := 40; + LCRPID_TUNE_STATE_CALC_PARA : UINT := 45; + LCRPID_TUNE_STATE_RESET_CNTL : UINT := 49; + LCRPID_TUNE_STATE_FINISHED : UINT := 50; + LCRTEMP_STEP_WAIT_FREE : UINT := 50; + LCRTEMP_STEP_START_FREE : UINT := 60; + LCRTEMP_STEP_FREE : UINT := 70; + LCRTEMP_STEP_PID : UINT := 80; + LCRTEMP_STEP_PID_COOL : UINT := 90; + LCRSLIMPID_REQU_PID : UDINT := 100; + LCRPID_TUNE_REQU_PID : UDINT := 100; + LCRTEMP_STEP_WAIT_COOL : UINT := 100; + LCRPID_MODE_MAN_JOLTFREE : USINT := 102; + LCRPID_MODE_OPEN_JOLTFREE : USINT := 103; + LCRPID_MODE_CLOSE_JOLTFREE : USINT := 104; + LCRPID_MODE_FREEZE_JOLTFREE : USINT := 105; + LCRTEMP_STEP_WAIT_COOLONLY : UINT := 105; + LCRTEMP_STEP_START_COOL : UINT := 110; + LCRPID_TUNE_ADDINFO_OSC_PERIOD : UINT := 111; + LCRTEMP_STEP_COOL : UINT := 120; + LCRTEMP_STEP_PID_DONE_COOLONLY : UINT := 122; + LCRTEMP_STEP_PID_DONE : UINT := 125; + LCRTEMP_STEP_DONE : UINT := 130; + LCRPID_TUNE_REQU_PI : UDINT := 200; + LCRSLIMPID_REQU_PI : UDINT := 200; + LCRPID_TUNE_REQU_P : UDINT := 300; + LCRSLIMPID_REQU_P : UDINT := 300; + LCRSLIMPID_REQU_CHR_DIST_AP : UDINT := 1000; + LCRPID_TUNE_REQU_CHR_DIST_AP : UDINT := 1000; + LCRSLIMPID_REQU_CHR_DIST_OS : UDINT := 2000; + LCRPID_TUNE_REQU_CHR_DIST_OS : UDINT := 2000; + LCRSLIMPID_REQU_ZN_DIST : UDINT := 3000; + LCRPID_TUNE_REQU_ZN_DIST : UDINT := 3000; + LCRPID_TUNE_REQU_CHR_REF_AP : UDINT := 4000; + LCRSLIMPID_REQU_CHR_REF_AP : UDINT := 4000; + LCRPID_TUNE_REQU_CHR_REF_OS : UDINT := 5000; + LCRSLIMPID_REQU_CHR_REF_OS : UDINT := 5000; + LCRPID_TUNE_REQU_OSC_1 : UDINT := 10000; + LCRSLIMPID_REQU_OSC_1 : UDINT := 10000; + LCR_WARN_LCRPID_I_MAXLIMIT : UINT := 12001; + LCR_WARN_LCRPID_I_MINLIMIT : UINT := 12002; + LCR_WARN_LCRPID_YFBK_LIMIT : UINT := 12003; + LCR_WARN_LCRPIDTune_CYCLETIME : UINT := 12004; + LCR_WARN_LCRPT12_T1_ZERO : UINT := 12005; + LCR_WARN_Tx_DT : UINT := 12007; + LCR_WARN_LCRPID_A_LIMIT : UINT := 12008; + LCR_WARN_LCRPID_YMAN_LIMIT : UINT := 12009; + LCR_WARN_LCRPT12_T1_TS : UINT := 12010; + LCR_WARN_LCRPT12_T1_INT : UINT := 12011; + LCR_WARN_LCRPT12_T2_ZERO : UINT := 12012; + LCR_WARN_LCRPT12_T2_TS : UINT := 12013; + LCR_WARN_LCRPT12_T2_INT : UINT := 12014; + LCR_WARN_LCRTT_TT_ZERO : UINT := 12015; + LCR_WARN_LCRTT_TT_TS : UINT := 12016; + LCR_WARN_LCRTT_TT_INT : UINT := 12017; + LCR_WARN_LCRTT_MEM : UINT := 12018; + LCR_WARN_LCRDBLPID_TUNE_CHANGE : UINT := 12019; + LCR_WARN_LCRTEMPTune_HEAT_TP : UINT := 12021; + LCR_WARN_LCRTEMPTune_WR_PARA : UINT := 12022; + LCR_WARN_LCRTEMPTune_WR_BASE : UINT := 12023; + LCR_WARN_LCRTEMPPID_WR_PARA : UINT := 12024; + LCR_ERR_LCRPID_PAR_KFBK : UINT := 12025; + LCR_ERROR : UINT := 12025; + LCR_ERR_LCRPID_PAR_KP : UINT := 12026; + LCR_ERR_LCRPID_PAR_KW : UINT := 12027; + LCR_ERR_LCRPID_PAR_TF : UINT := 12028; + LCR_ERR_LCRPID_PAR_TN : UINT := 12029; + LCR_ERR_LCRPID_PAR_TV : UINT := 12030; + LCR_ERR_LCRPT1_T : UINT := 12031; + LCR_ERR_LCRPWM_TMINPULSE : UINT := 12032; + LCR_ERR_LCRPWM_TPULSE : UINT := 12033; + LCR_ERR_LCRPWM_TPERIOD : UINT := 12033; + LCR_ERR_LCRRamp_DYUP_DYDOWN : UINT := 12034; + LCR_ERR_LCRContinServo_TCHANGE : UINT := 12035; + LCR_ERR_LCRContinServo_TIMPULSE : UINT := 12036; + LCR_ERR_MAXMIN : UINT := 12037; + LCR_ERR_LCRPIDTune_ABORT : UINT := 12038; + LCR_ERR_LCRPIDTune_PARAMETER : UINT := 12039; + LCR_ERR_LCRPIDTune_TIMEOUT : UINT := 12040; + LCR_ERR_LCRPIDTune_W_CHANGED : UINT := 12041; + LCR_ERR_LCRPID_PAR_DEADBAND_MODE : UINT := 12042; + LCR_ERR_LCRPID_PAR_WX_MAXMIN : UINT := 12043; + LCR_ERR_LCRPID_PAR_DEADBAND : UINT := 12044; + LCR_ERR_LCRCurveByPoints_TABLE : UINT := 12045; + LCR_ERR_LCRPT12_T1_NEG : UINT := 12046; + LCR_ERR_LCRPT12_T2_NEG : UINT := 12047; + LCR_ERR_LCRTT_TT_NEG : UINT := 12048; + LCRSLIMPID_REQU_OSC_2 : UDINT := 20000; + LCRPID_TUNE_REQU_OSC_2 : UDINT := 20000; + LCRSLIMPID_REQU_OSC_3 : UDINT := 30000; + LCRPID_TUNE_REQU_OSC_3 : UDINT := 30000; + LCR_ERR_LCRIntegrate_TN : UINT := 31550; + LCR_ERR_LCRMovAvgFlt_BASE : UINT := 31551; + LCR_ERR_LCRPID_IDENT : UINT := 31552; + LCR_ERR_LCRPID_MODE : UINT := 31553; + LCR_ERR_LCRPID_PARADAT : UINT := 31554; + LCR_ERR_LCRPID_PAR_DMODE : UINT := 31556; + LCR_ERR_LCRPID_PAR_DYMAX : UINT := 31557; + LCR_ERR_LCRPID_PAR_FBKMODE : UINT := 31558; + LCR_ERR_LCRPIDTune_INVALID_REQU : UINT := 31559; + LCR_ERR_LCRPIDTune_CONTROL_VAR : UINT := 31560; + LCR_ERR_LCRDBLPID_WX_LOW : UINT := 31561; + LCR_ERR_LCRDBLPID_DX_DT : UINT := 31562; + LCR_ERR_POINTER : UINT := 31563; + LCR_ERR_LCRPIDTune_MAXMIN : UINT := 31564; + LCR_ERR_LCRTEMPTune_WR_PTR : UINT := 31566; + LCR_ERR_LCRTEMPTune_WR_TSET : UINT := 31567; + LCR_ERR_LCRTEMPPID_WR_PARA : UINT := 31567; + LCR_ERR_LCRTEMPPID_WR_PTR : UINT := 31568; + LCR_ERR_LCRTEMPPID_ILLEGALMODE : UINT := 31569; + LCR_ERR_LCRTEMPTune_TASKTIME_0 : UINT := 31570; + LCR_ERR_LCRTEMPPID_TKNICK : UINT := 31571; + LCR_ERR_LCRTEMPPID_NO_TALT : UINT := 31572; + LCR_ERR_SCHEDULE_P : UINT := 31573; + LCR_ERR_SCHEDULE_N : UINT := 31574; + LCR_WARN_LCRTEMPTune_DT_HIGH : UINT := 33100; + LCR_WARN_LCRTEMPTune_ASYNC : UINT := 33101; + LCR_WARN_PT2O_TF_TS : UINT := 33102; + LCR_ERR_LCRTEMPTune_INVALID_MODE : UINT := 33150; + LCR_ERR_LCRTEMPPID_INVALID_MODE : UINT := 33151; + LCR_ERR_LCRTEMPTune_DT_IGNORED : UINT := 33152; + LCR_ERR_PT2O_D_NEG : UINT := 33153; + LCR_ERR_PT2O_TF_NEG_ZERO : UINT := 33154; + LCR_ERR_DISABLED : UINT := 65534; + LCRTEMP_STEP_ERROR : UINT := 65535; + LCRSLIMPID_REQU_PER_3 : UDINT := 300000; + LCRPID_TUNE_REQU_PER_3 : UDINT := 300000; + LCRPID_TUNE_REQU_PER_4 : UDINT := 400000; + LCRSLIMPID_REQU_PER_4 : UDINT := 400000; + LCRSLIMPID_REQU_PER_5 : UDINT := 500000; + LCRPID_TUNE_REQU_PER_5 : UDINT := 500000; +END_VAR diff --git a/Logical/Libraries/LoopConR/SG3/LoopConR.h b/Logical/Libraries/LoopConR/SG3/LoopConR.h new file mode 100644 index 0000000..e88fcf4 --- /dev/null +++ b/Logical/Libraries/LoopConR/SG3/LoopConR.h @@ -0,0 +1,1677 @@ +/* Automation Studio generated header file */ +/* Do not edit ! */ +/* LoopConR 4.10.2 */ + +#ifndef _LOOPCONR_ +#define _LOOPCONR_ +#ifdef __cplusplus +extern "C" +{ +#endif +#ifndef _LoopConR_VERSION +#define _LoopConR_VERSION 4.10.2 +#endif + +#include + +#ifndef _BUR_PUBLIC +#define _BUR_PUBLIC +#endif +#ifdef _SG4 + #include "sys_lib.h" + #include "brsystem.h" +#endif +#ifdef _SG3 + #include "sys_lib.h" + #include "brsystem.h" +#endif +#ifdef _SGC + #include "sys_lib.h" + #include "brsystem.h" +#endif + +/* Constants */ +#ifdef _REPLACE_CONST + #define LCRPID_TUNE_REQU_PER_5 500000U + #define LCRSLIMPID_REQU_PER_5 500000U + #define LCRSLIMPID_REQU_PER_4 400000U + #define LCRPID_TUNE_REQU_PER_4 400000U + #define LCRPID_TUNE_REQU_PER_3 300000U + #define LCRSLIMPID_REQU_PER_3 300000U + #define LCRTEMP_STEP_ERROR 65535U + #define LCR_ERR_DISABLED 65534U + #define LCR_ERR_PT2O_TF_NEG_ZERO 33154U + #define LCR_ERR_PT2O_D_NEG 33153U + #define LCR_ERR_LCRTEMPTune_DT_IGNORED 33152U + #define LCR_ERR_LCRTEMPPID_INVALID_MODE 33151U + #define LCR_ERR_LCRTEMPTune_INVALID_MODE 33150U + #define LCR_WARN_PT2O_TF_TS 33102U + #define LCR_WARN_LCRTEMPTune_ASYNC 33101U + #define LCR_WARN_LCRTEMPTune_DT_HIGH 33100U + #define LCR_ERR_SCHEDULE_N 31574U + #define LCR_ERR_SCHEDULE_P 31573U + #define LCR_ERR_LCRTEMPPID_NO_TALT 31572U + #define LCR_ERR_LCRTEMPPID_TKNICK 31571U + #define LCR_ERR_LCRTEMPTune_TASKTIME_0 31570U + #define LCR_ERR_LCRTEMPPID_ILLEGALMODE 31569U + #define LCR_ERR_LCRTEMPPID_WR_PTR 31568U + #define LCR_ERR_LCRTEMPPID_WR_PARA 31567U + #define LCR_ERR_LCRTEMPTune_WR_TSET 31567U + #define LCR_ERR_LCRTEMPTune_WR_PTR 31566U + #define LCR_ERR_LCRPIDTune_MAXMIN 31564U + #define LCR_ERR_POINTER 31563U + #define LCR_ERR_LCRDBLPID_DX_DT 31562U + #define LCR_ERR_LCRDBLPID_WX_LOW 31561U + #define LCR_ERR_LCRPIDTune_CONTROL_VAR 31560U + #define LCR_ERR_LCRPIDTune_INVALID_REQU 31559U + #define LCR_ERR_LCRPID_PAR_FBKMODE 31558U + #define LCR_ERR_LCRPID_PAR_DYMAX 31557U + #define LCR_ERR_LCRPID_PAR_DMODE 31556U + #define LCR_ERR_LCRPID_PARADAT 31554U + #define LCR_ERR_LCRPID_MODE 31553U + #define LCR_ERR_LCRPID_IDENT 31552U + #define LCR_ERR_LCRMovAvgFlt_BASE 31551U + #define LCR_ERR_LCRIntegrate_TN 31550U + #define LCRPID_TUNE_REQU_OSC_3 30000U + #define LCRSLIMPID_REQU_OSC_3 30000U + #define LCRPID_TUNE_REQU_OSC_2 20000U + #define LCRSLIMPID_REQU_OSC_2 20000U + #define LCR_ERR_LCRTT_TT_NEG 12048U + #define LCR_ERR_LCRPT12_T2_NEG 12047U + #define LCR_ERR_LCRPT12_T1_NEG 12046U + #define LCR_ERR_LCRCurveByPoints_TABLE 12045U + #define LCR_ERR_LCRPID_PAR_DEADBAND 12044U + #define LCR_ERR_LCRPID_PAR_WX_MAXMIN 12043U + #define LCR_ERR_LCRPID_PAR_DEADBAND_MODE 12042U + #define LCR_ERR_LCRPIDTune_W_CHANGED 12041U + #define LCR_ERR_LCRPIDTune_TIMEOUT 12040U + #define LCR_ERR_LCRPIDTune_PARAMETER 12039U + #define LCR_ERR_LCRPIDTune_ABORT 12038U + #define LCR_ERR_MAXMIN 12037U + #define LCR_ERR_LCRContinServo_TIMPULSE 12036U + #define LCR_ERR_LCRContinServo_TCHANGE 12035U + #define LCR_ERR_LCRRamp_DYUP_DYDOWN 12034U + #define LCR_ERR_LCRPWM_TPERIOD 12033U + #define LCR_ERR_LCRPWM_TPULSE 12033U + #define LCR_ERR_LCRPWM_TMINPULSE 12032U + #define LCR_ERR_LCRPT1_T 12031U + #define LCR_ERR_LCRPID_PAR_TV 12030U + #define LCR_ERR_LCRPID_PAR_TN 12029U + #define LCR_ERR_LCRPID_PAR_TF 12028U + #define LCR_ERR_LCRPID_PAR_KW 12027U + #define LCR_ERR_LCRPID_PAR_KP 12026U + #define LCR_ERROR 12025U + #define LCR_ERR_LCRPID_PAR_KFBK 12025U + #define LCR_WARN_LCRTEMPPID_WR_PARA 12024U + #define LCR_WARN_LCRTEMPTune_WR_BASE 12023U + #define LCR_WARN_LCRTEMPTune_WR_PARA 12022U + #define LCR_WARN_LCRTEMPTune_HEAT_TP 12021U + #define LCR_WARN_LCRDBLPID_TUNE_CHANGE 12019U + #define LCR_WARN_LCRTT_MEM 12018U + #define LCR_WARN_LCRTT_TT_INT 12017U + #define LCR_WARN_LCRTT_TT_TS 12016U + #define LCR_WARN_LCRTT_TT_ZERO 12015U + #define LCR_WARN_LCRPT12_T2_INT 12014U + #define LCR_WARN_LCRPT12_T2_TS 12013U + #define LCR_WARN_LCRPT12_T2_ZERO 12012U + #define LCR_WARN_LCRPT12_T1_INT 12011U + #define LCR_WARN_LCRPT12_T1_TS 12010U + #define LCR_WARN_LCRPID_YMAN_LIMIT 12009U + #define LCR_WARN_LCRPID_A_LIMIT 12008U + #define LCR_WARN_Tx_DT 12007U + #define LCR_WARN_LCRPT12_T1_ZERO 12005U + #define LCR_WARN_LCRPIDTune_CYCLETIME 12004U + #define LCR_WARN_LCRPID_YFBK_LIMIT 12003U + #define LCR_WARN_LCRPID_I_MINLIMIT 12002U + #define LCR_WARN_LCRPID_I_MAXLIMIT 12001U + #define LCRSLIMPID_REQU_OSC_1 10000U + #define LCRPID_TUNE_REQU_OSC_1 10000U + #define LCRSLIMPID_REQU_CHR_REF_OS 5000U + #define LCRPID_TUNE_REQU_CHR_REF_OS 5000U + #define LCRSLIMPID_REQU_CHR_REF_AP 4000U + #define LCRPID_TUNE_REQU_CHR_REF_AP 4000U + #define LCRPID_TUNE_REQU_ZN_DIST 3000U + #define LCRSLIMPID_REQU_ZN_DIST 3000U + #define LCRPID_TUNE_REQU_CHR_DIST_OS 2000U + #define LCRSLIMPID_REQU_CHR_DIST_OS 2000U + #define LCRPID_TUNE_REQU_CHR_DIST_AP 1000U + #define LCRSLIMPID_REQU_CHR_DIST_AP 1000U + #define LCRSLIMPID_REQU_P 300U + #define LCRPID_TUNE_REQU_P 300U + #define LCRSLIMPID_REQU_PI 200U + #define LCRPID_TUNE_REQU_PI 200U + #define LCRTEMP_STEP_DONE 130U + #define LCRTEMP_STEP_PID_DONE 125U + #define LCRTEMP_STEP_PID_DONE_COOLONLY 122U + #define LCRTEMP_STEP_COOL 120U + #define LCRPID_TUNE_ADDINFO_OSC_PERIOD 111U + #define LCRTEMP_STEP_START_COOL 110U + #define LCRTEMP_STEP_WAIT_COOLONLY 105U + #define LCRPID_MODE_FREEZE_JOLTFREE 105U + #define LCRPID_MODE_CLOSE_JOLTFREE 104U + #define LCRPID_MODE_OPEN_JOLTFREE 103U + #define LCRPID_MODE_MAN_JOLTFREE 102U + #define LCRTEMP_STEP_WAIT_COOL 100U + #define LCRPID_TUNE_REQU_PID 100U + #define LCRSLIMPID_REQU_PID 100U + #define LCRTEMP_STEP_PID_COOL 90U + #define LCRTEMP_STEP_PID 80U + #define LCRTEMP_STEP_FREE 70U + #define LCRTEMP_STEP_START_FREE 60U + #define LCRTEMP_STEP_WAIT_FREE 50U + #define LCRPID_TUNE_STATE_FINISHED 50U + #define LCRPID_TUNE_STATE_RESET_CNTL 49U + #define LCRPID_TUNE_STATE_CALC_PARA 45U + #define LCRTEMP_STEP_PID_FREE 40U + #define LCRTEMP_STEP_HEAT 30U + #define LCRPID_TUNE_STATE_STEP_WAITEQ2 22U + #define LCRPID_TUNE_STATE_STEP_MAXGRAD 21U + #define LCRSLIMPID_REQU_DIR_NEG 20U + #define LCRTEMP_STEP_START_HEAT 20U + #define LCRPID_TUNE_STATE_STEP_WAITEQ1 20U + #define LCRPID_TUNE_REQU_DIR_NEG 20U + #define LCRPID_TUNE_STATE_OSC_CNTLPAR 19U + #define LCRPID_TUNE_STATE_OSC_PERFORM_2 13U + #define LCRPID_TUNE_STATE_OSC_PERFORM_1 12U + #define LCRPID_TUNE_STATE_OSC_SEQ_CNTL 11U + #define LCRTEMP_STEP_WAIT_HEAT 10U + #define LCRSLIMPID_REQU_DIR_POS 10U + #define LCRPID_TUNE_STATE_OSCILLATE 10U + #define LCRPID_TUNE_REQU_DIR_POS 10U + #define LCRDBLPID_MODE_TUNE_Y2 9U + #define LCRDBLPID_MODE_TUNE_Y1 8U + #define LCRDBLPID_MODE_TUNE_6 7U + #define LCRDBLPID_MODE_TUNE_4 6U + #define LCRPID_FBK_MODE_SET_YI 5U + #define LCRPID_MODE_FREEZE 5U + #define LCRTEMP_STEP_WAIT 5U + #define LCRSLIMPID_REQU_WRITE_PARAS 4U + #define LCRPID_MODE_CLOSE 4U + #define LCRPID_FBK_MODE_LIMIT_YI 4U + #define LCRDBLPID_TSTATE_ERROR 4U + #define LCRPID_FBK_MODE_EXT_SELECTOR 3U + #define LCRSLIMPID_REQU_READ_PARAS 3U + #define LCRDBLPID_TSTATE_FINISHED 3U + #define LCRPID_MODE_OPEN 3U + #define LCRPID_TUNE_REQU_STEPRESPONSE 2U + #define LCRPID_FBK_MODE_EXTERN 2U + #define LCRPID_MODE_MAN 2U + #define LCRSLIMPID_REQU_STEPRESPONSE 2U + #define LCRPID_D_MODE_E 2U + #define LCRDBLPID_TSTATE_Y2 2U + #define LCRTEMPPID_MODE_MAN 2U + #define LCRPID_DEADBAND_MODE_STANDARD_I 2U + #define LCRSLIMPID_REQU_OSCILLATE 1U + #define LCRTEMP_COOL 1U + #define LCRTEMP_PT2 1U + #define LCRTEMP_HYST_MODE_JOLTFREE 1U + #define LCRTEMPPID_MODE_AUTO 1U + #define LCRPID_TUNE_REQU_OSCILLATE 1U + #define LCRDBLPID_TSTATE_Y1 1U + #define LCRPID_FBK_MODE_INTERN 1U + #define LCRPID_DEADBAND_MODE_STANDARD 1U + #define LCRPID_D_MODE_X 1U + #define LCRPID_MODE_AUTO 1U + #define LCRTEMPTune_MODE_EXP 1U + #define LCRPID_TUNE_REQU_OFF 0U + #define LCRDBLPID_TSTATE_OFF 0U + #define LCRTEMPTune_MODE_DEF 0U + #define LCRTEMP_PT1 0U + #define LCRSLIMPID_REQU_OFF 0U + #define LCRPID_TUNE_STATE_READY 0U + #define LCRPID_MODE_OFF 0U + #define LCRTEMP_HEAT 0U + #define LCRPID_DEADBAND_MODE_ZERO 0U +#else + #ifndef _GLOBAL_CONST + #define _GLOBAL_CONST _WEAK const + #endif + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_5; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_5; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_4; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_4; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_3; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_3; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_ERROR; + _GLOBAL_CONST unsigned short LCR_ERR_DISABLED; + _GLOBAL_CONST unsigned short LCR_ERR_PT2O_TF_NEG_ZERO; + _GLOBAL_CONST unsigned short LCR_ERR_PT2O_D_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_DT_IGNORED; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_INVALID_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_INVALID_MODE; + _GLOBAL_CONST unsigned short LCR_WARN_PT2O_TF_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_ASYNC; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_DT_HIGH; + _GLOBAL_CONST unsigned short LCR_ERR_SCHEDULE_N; + _GLOBAL_CONST unsigned short LCR_ERR_SCHEDULE_P; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_NO_TALT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_TKNICK; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_TASKTIME_0; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_ILLEGALMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_WR_PTR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_WR_PARA; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_WR_TSET; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_WR_PTR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_POINTER; + _GLOBAL_CONST unsigned short LCR_ERR_LCRDBLPID_DX_DT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRDBLPID_WX_LOW; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_CONTROL_VAR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_INVALID_REQU; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_FBKMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DYMAX; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PARADAT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_IDENT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRMovAvgFlt_BASE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRIntegrate_TN; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_3; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_3; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_2; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_2; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTT_TT_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT12_T2_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT12_T1_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRCurveByPoints_TABLE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DEADBAND; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_WX_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DEADBAND_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_W_CHANGED; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_TIMEOUT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_PARAMETER; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_ABORT; + _GLOBAL_CONST unsigned short LCR_ERR_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRContinServo_TIMPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRContinServo_TCHANGE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRRamp_DYUP_DYDOWN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TPERIOD; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TMINPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT1_T; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TV; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TF; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KW; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KP; + _GLOBAL_CONST unsigned short LCR_ERROR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KFBK; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPPID_WR_PARA; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_WR_BASE; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_WR_PARA; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_HEAT_TP; + _GLOBAL_CONST unsigned short LCR_WARN_LCRDBLPID_TUNE_CHANGE; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_MEM; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_YMAN_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_A_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_Tx_DT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPIDTune_CYCLETIME; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_YFBK_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_I_MINLIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_I_MAXLIMIT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_1; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_1; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_REF_OS; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_REF_OS; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_REF_AP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_REF_AP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_ZN_DIST; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_ZN_DIST; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_DIST_OS; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_DIST_OS; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_DIST_AP; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_DIST_AP; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_P; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_P; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PI; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PI; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_DONE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_DONE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_DONE_COOLONLY; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_COOL; + _GLOBAL_CONST unsigned short LCRPID_TUNE_ADDINFO_OSC_PERIOD; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_COOL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_COOLONLY; + _GLOBAL_CONST unsigned char LCRPID_MODE_FREEZE_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_CLOSE_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_OPEN_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_MAN_JOLTFREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_COOL; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PID; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PID; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_COOL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_FREE; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_FINISHED; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_RESET_CNTL; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_CALC_PARA; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_HEAT; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_WAITEQ2; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_MAXGRAD; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_DIR_NEG; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_HEAT; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_WAITEQ1; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_DIR_NEG; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_CNTLPAR; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_PERFORM_2; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_PERFORM_1; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_SEQ_CNTL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_HEAT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_DIR_POS; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSCILLATE; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_DIR_POS; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_Y2; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_Y1; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_6; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_4; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_SET_YI; + _GLOBAL_CONST unsigned char LCRPID_MODE_FREEZE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_WRITE_PARAS; + _GLOBAL_CONST unsigned char LCRPID_MODE_CLOSE; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_LIMIT_YI; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_ERROR; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_EXT_SELECTOR; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_READ_PARAS; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_FINISHED; + _GLOBAL_CONST unsigned char LCRPID_MODE_OPEN; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_STEPRESPONSE; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_EXTERN; + _GLOBAL_CONST unsigned char LCRPID_MODE_MAN; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_STEPRESPONSE; + _GLOBAL_CONST unsigned char LCRPID_D_MODE_E; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_Y2; + _GLOBAL_CONST unsigned long LCRTEMPPID_MODE_MAN; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_STANDARD_I; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSCILLATE; + _GLOBAL_CONST unsigned char LCRTEMP_COOL; + _GLOBAL_CONST unsigned char LCRTEMP_PT2; + _GLOBAL_CONST unsigned char LCRTEMP_HYST_MODE_JOLTFREE; + _GLOBAL_CONST unsigned long LCRTEMPPID_MODE_AUTO; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSCILLATE; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_Y1; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_INTERN; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_STANDARD; + _GLOBAL_CONST unsigned char LCRPID_D_MODE_X; + _GLOBAL_CONST unsigned char LCRPID_MODE_AUTO; + _GLOBAL_CONST unsigned long LCRTEMPTune_MODE_EXP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OFF; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_OFF; + _GLOBAL_CONST unsigned long LCRTEMPTune_MODE_DEF; + _GLOBAL_CONST unsigned char LCRTEMP_PT1; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OFF; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_READY; + _GLOBAL_CONST unsigned char LCRPID_MODE_OFF; + _GLOBAL_CONST unsigned char LCRTEMP_HEAT; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_ZERO; +#endif + + + + +/* Datatypes and datatypes of function blocks */ +typedef struct lcrCurveByPoints_TabEntry_type +{ float x; + float y; +} lcrCurveByPoints_TabEntry_type; + +typedef struct lcrdblpid_par_typ +{ float Y_max; + float Y_min; + signed short K_fact; + float Kp; + float Tn; + float Tv; +} lcrdblpid_par_typ; + +typedef struct lcrpid_tune_osc_options_typ +{ float osc_minAmplitude; + float Q_min; +} lcrpid_tune_osc_options_typ; + +typedef struct lcrpid_tune_step_options_typ +{ float eqDeltaX; + float eqDeltaWX; + float eqDeltat; + float evalDeltaX; + unsigned short evalNfilter; + unsigned short exitNotMaxdXCount; + float exitdXRatio; +} lcrpid_tune_step_options_typ; + +typedef struct lcrdblpid_tune_typ +{ signed short P1_manualAdjust; + signed short I1_manualAdjust; + signed short D1_manualAdjust; + signed short P2_manualAdjust; + signed short I2_manualAdjust; + signed short D2_manualAdjust; + float X_min; + float X_max; + float X0; + float de_min; + float Y0; + float Y1step; + float Y2step; + unsigned long tuneY1_opt; + unsigned long tuneY2_opt; + unsigned char tune_first; + float hyst; + float measDelta; + struct lcrpid_tune_osc_options_typ osc_opt; + struct lcrpid_tune_step_options_typ step_opt; +} lcrdblpid_tune_typ; + +typedef struct lcrpid_internal_typ +{ unsigned short size; + plcbit valid; + float WX_max; + float WX_min; + plcbit invert; + float deadband; + unsigned char deadband_mode; + float dY_max; + float Kp; + float Kp_Tn; + float Tv_Tf; + float Tf_reciproc; + float Kw; + float Kfbk_Kp; + float Kfbk_Kp_max; + unsigned char fbk_mode; + unsigned char d_mode; + unsigned char force_mode; + float Y_force; + float W; + float X; + unsigned char pid_init; + signed long Yp1; + signed long Yp2; + signed long dYi1; + signed long dYi2; + signed long Yi1; + signed long Yi2; + float dt_Tf; + signed long a11; + signed long a12; + signed long a21; + signed long a22; + signed long Yd1; + signed long Yd2; + signed long Ytotal1; + signed long Ytotal2; + signed long Ylim1; + signed long Ylim2; + signed long Y1; + signed long Y2; + float deltaY_fbk; + float e_fbk; +} lcrpid_internal_typ; + +typedef struct lcrpid_procPar_typ +{ unsigned short size; + plcbit valid; + plcbit stepResp_valid; + float stepResp_v; + float stepResp_t_u; + float stepResp_t_g; + plcbit osc_valid; + float osc_amplitudeRatio; + float osc_tPeriod; + plcbit force_params; + float Kp; + float Kp_tune; + float Tn; + float Tn_tune; + float Tv; + float Tv_tune; +} lcrpid_procPar_typ; + +typedef struct lcrpid_old_typ +{ struct lcrpid_procPar_typ processPar; + signed short P_manualAdjust; + signed short I_manualAdjust; + signed short D_manualAdjust; + float Y_min; + float Y_max; + float dY_max; + float Tf_Tv; + float Kw; + float Kfbk; + float deadband; + float W; + unsigned long request; + unsigned char fbk_mode; + unsigned char d_mode; + plcbit invert; + plcbit enable; +} lcrpid_old_typ; + +typedef struct lcrpid_osc_val_typ +{ float X; + float t; +} lcrpid_osc_val_typ; + +typedef struct lcrpid_osc_per_typ +{ struct lcrpid_osc_val_typ max; + struct lcrpid_osc_val_typ min; +} lcrpid_osc_per_typ; + +typedef struct lcrpid_tune_addpar_typ +{ float t_max_tune; + float WX_min; + float WX_max; + float dY_max; + float Tf_Tv; + float Kw; + float Kfbk; + unsigned char fbk_mode; + unsigned char d_mode; + float deadband; + unsigned char deadband_mode; + plcbit invert; +} lcrpid_tune_addpar_typ; + +typedef struct lcrpid_tune_osc_typ +{ struct lcrpid_tune_osc_options_typ options; + unsigned short oscPhase; + signed char dir; + plcbit enHi; + plcbit enLo; + float Y_hi; + float Y_lo; + unsigned short i_maxPeriod; + unsigned short i_period; + float X_ampl; + float X_avg; + float X_min_avg; + float X_max_avg; + float Y_avg; + float deltaY; + float t_Ylohi[5]; + float t_Yhilo[5]; + float Q_act; + float a_wx; + float amplitudeRatio; + float Ku; + float tPeriod; + struct lcrpid_osc_per_typ period[5]; +} lcrpid_tune_osc_typ; + +typedef struct lcrpid_tune_step_typ +{ struct lcrpid_tune_step_options_typ options; + float Y0; + float Y1; + float t_jump; + float W; + float X0; + float Xmax; + float Xmin; + float Xfiltered; + plcbit deltaXok; + plcbit deltaWXok; + float eqTime; + signed char dir; + float deltaX; + float X1; + float t1; + plcbit t1set; + float dX_dt; + float dX_dt_max; + float XmaxGrad; + float maxX1; + float maxX2; + float maxt1; + float maxt2; + float tmaxGrad; + float gainFactor; + float deadTime; + float riseTime; + unsigned short notMaxCount; + float gradientRatio; +} lcrpid_tune_step_typ; + +typedef struct lcrpt2o_Internal_typ +{ signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + float V_old; + float D_old; + float Tf_old; + unsigned char Set_y_old; + unsigned char Set_y_2; + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + unsigned long x2_dbl_1; + unsigned long x2_dbl_2; + unsigned long Sqrt_D_1_dbl_1; + unsigned long Sqrt_D_1_dbl_2; + unsigned long Ts_Tf_dbl_1; + unsigned long Ts_Tf_dbl_2; + unsigned long Exp_D_Ts_Tf_dbl_1; + unsigned long Exp_D_Ts_Tf_dbl_2; + unsigned long a0_dbl_1; + unsigned long a0_dbl_2; + unsigned long a1_dbl_1; + unsigned long a1_dbl_2; + unsigned long b0_dbl_1; + unsigned long b0_dbl_2; + unsigned long b1_dbl_1; + unsigned long b1_dbl_2; + unsigned long Bootkey; +} lcrpt2o_Internal_typ; + +typedef struct LCRPWM +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_min_pulse; + float t_period; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float t_on; + float t_off; + /* VAR (analog) */ + signed long cnt_terron_1; + signed long cnt_terron_2; + signed long cnt_terroff_1; + signed long cnt_terroff_2; + signed long cnt_t_pulse_1; + signed long cnt_t_pulse_2; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR_OUTPUT (digital) */ + plcbit pulse; + /* VAR (digital) */ + plcbit corr; +} LCRPWM_typ; + +typedef struct lcrschedule_add_typ +{ float periodTime; + float onTime; + float t_on_intern; + float bcOnTime; + unsigned short sortIndex; + struct LCRPWM fbkPWM; + plcbit flagDelay; +} lcrschedule_add_typ; + +typedef struct lcrschedule_par_typ +{ float P; + float X; + plcbit pulse; + float Pout; + plcbit lim; + struct lcrschedule_add_typ Internal; +} lcrschedule_par_typ; + +typedef struct lcrslimpid_par_typ +{ float Y_max; + float Y_min; + float Kp; + float Tn; + float Tv; + float Kfbk; +} lcrslimpid_par_typ; + +typedef struct lcrtemp_add_typ +{ float mem01; + float mem02; + float mem10; + float mem20; + float exp_mem; + float cnt01; + float cnt02; + float cnt10; + float cnt20; + float cnt03; + float cnt30; + float cnt00; + float t_ignore_dT_heat; + float t_ignore_dT_free; + float t_ignore_dT_cool; + float yMin; + float yMax; + unsigned long reserved3; + unsigned long reserved4; + plcbit reserved5; + plcbit reserved6; +} lcrtemp_add_typ; + +typedef struct lcrtemp_pid_internal_typ +{ plcbit enable_cooling; + plcbit disable_heating; + float hyst; + float delay; + float Kw; + float Kfbk; + float Kp_h; + float Tn_h; + float Tv_h; + float Kp_c; + float Tn_c; + float Tv_c; + float dynGeneral; + float dynHeat; + float dynCool; + float mem01; + float mem02; + float mem10; + float mem20; + float exp_mem; + float yMin; + float yMax; +} lcrtemp_pid_internal_typ; + +typedef struct lcrtemp_pid_opt_typ +{ float Kp_h; + float Tn_h; + float Tv_h; + float Tf_h; + float Kp_c; + float Tn_c; + float Tv_c; + float Tf_c; + float dynGeneral; + float dynHeat; + float dynCool; +} lcrtemp_pid_opt_typ; + +typedef struct lcrtemp_pid_set_typ +{ float hyst; + unsigned char hyst_mode; + float delay; + float Kw; + float Kfbk; +} lcrtemp_pid_set_typ; + +typedef struct lcrtemp_tune_set_typ +{ unsigned long mode; + float Temp_amb; + float dRatio_heat; + float cnt_tp_heat; + float delta_T_heat; + float dT_min_heat; + float dRatio_free; + float cnt_tp_free; + float delta_T_free; + float dT_min_free; + float dRatio_cool; + float cnt_tp_cool; + float delta_T_cool; + float dT_min_cool; + float delta_T_sync_heat; + float delta_dT_sync_heat; + float cnt_wait_heat; + float delta_T_sync_free; + float delta_dT_sync_free; + float cnt_wait_free; + float delta_T_sync_cool; + float delta_dT_sync_cool; + float cnt_wait_cool; + float filter_base_T; + float delta_T_sync_stop; + float Y_heat_tune; +} lcrtemp_tune_set_typ; + +typedef struct lcrtemp_set_typ +{ plcbit enable_cooling; + plcbit disable_heating; + struct lcrtemp_pid_opt_typ PIDpara; + struct lcrtemp_tune_set_typ TuneSet; + struct lcrtemp_pid_set_typ PIDSet; + struct lcrtemp_add_typ Internal; +} lcrtemp_set_typ; + +typedef struct lcrtemp_tune_internal_typ +{ plcbit cool_tuning; + plcbit disable_heating; + unsigned long mode; + float Temp_amb; + float dRatio_heat; + float cnt_tp_heat; + float delta_T_heat; + float dT_min_heat; + float dRatio_free; + float cnt_tp_free; + float delta_T_free; + float dT_min_free; + float dRatio_cool; + float cnt_tp_cool; + float delta_T_cool; + float dT_min_cool; + float delta_T_sync_heat; + float delta_dT_sync_heat; + float cnt_wait_heat; + float delta_T_sync_free; + float delta_dT_sync_free; + float cnt_wait_free; + float delta_T_sync_cool; + float delta_dT_sync_cool; + float cnt_wait_cool; + float filter_base_T; + float t_ignore_dT_heat; + float t_ignore_dT_free; + float t_ignore_dT_cool; + float delta_T_sync_stop; +} lcrtemp_tune_internal_typ; + +typedef struct LCRScal +{ + /* VAR_INPUT (analog) */ + float x; + float x1; + float y1; + float x2; + float y2; + /* VAR_OUTPUT (analog) */ + float y; +} LCRScal_typ; + +typedef struct LCRPID +{ + /* VAR_INPUT (analog) */ + unsigned long ident; + float W; + float X; + float Y_max; + float Y_min; + float A; + float Y_man; + float Y_fbk; + unsigned char mode; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float e; + float Y; + float Yp; + float Yi; + float Yd; + /* VAR (analog) */ + float Yi_set; + float Yi_min; + float Yi_max; + float Yi_minInternal; + float Yi_maxInternal; + float Tv_Tf_old; + float e_old; + unsigned short deadband_state; + struct SysInfo sysinfo_inst; + struct LCRScal scal_inst; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short musecs_old; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit hold_I; + /* VAR (digital) */ + plcbit Set_Yi; + plcbit force_Yi; + plcbit joltFreeDoneLowerLim; + plcbit joltFreeDoneUpperLim; + plcbit enable_old; +} LCRPID_typ; + +typedef struct LCRCurveByPoints +{ + /* VAR_INPUT (analog) */ + float x; + unsigned short NoOfPoints; + struct lcrCurveByPoints_TabEntry_type* ptr_table; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed short i_tab; + unsigned short iterations; + struct LCRScal scal1; +} LCRCurveByPoints_typ; + +typedef struct LCRPIDpara +{ + /* VAR_INPUT (analog) */ + float WX_max; + float WX_min; + float deadband; + unsigned char deadband_mode; + float dY_max; + float Kp; + float Tn; + float Tv; + float Tf; + float Kw; + float Kfbk; + unsigned char fbk_mode; + unsigned char d_mode; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long ident; + /* VAR (analog) */ + struct lcrpid_internal_typ internal_data; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit enter; + plcbit invert; +} LCRPIDpara_typ; + +typedef struct LCRContinServo +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_impulse; + float t_change_up; + float t_change_down; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float hysteresis_up; + float hysteresis_down; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long t_cnt_1; + signed long t_cnt_2; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysInfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit ref; + /* VAR_OUTPUT (digital) */ + plcbit up; + plcbit down; + plcbit refOk; + /* VAR (digital) */ + plcbit enable_old; + plcbit ref_old; +} LCRContinServo_typ; + +typedef struct LCRPT1 +{ + /* VAR_INPUT (analog) */ + float x; + float t; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; +} LCRPT1_typ; + +typedef struct LCRRamp +{ + /* VAR_INPUT (analog) */ + float x; + float dy_up; + float dy_down; + float y_max; + float y_min; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed long y_dbl_1; + signed long y_dbl_2; + unsigned long timestore1; + unsigned long timestore2; + unsigned long getDtForceOff; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR_OUTPUT (digital) */ + plcbit x_reached; + plcbit max_limit; + plcbit min_limit; +} LCRRamp_typ; + +typedef struct LCRIntegrate +{ + /* VAR_INPUT (analog) */ + float x; + float tn; + float y_max; + float y_min; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR_OUTPUT (digital) */ + plcbit max_limit; + plcbit min_limit; +} LCRIntegrate_typ; + +typedef struct LCRLimit +{ + /* VAR_INPUT (analog) */ + float in; + signed long max_value; + signed long min_value; + /* VAR_OUTPUT (analog) */ + unsigned short status; + signed long out; + /* VAR_OUTPUT (digital) */ + plcbit max_limit; + plcbit min_limit; +} LCRLimit_typ; + +typedef struct LCRLimScal +{ + /* VAR_INPUT (analog) */ + float x; + float x1; + float y1; + float x2; + float y2; + /* VAR_OUTPUT (analog) */ + float y; +} LCRLimScal_typ; + +typedef struct LCRMovAvgFlt +{ + /* VAR_INPUT (analog) */ + float x; + unsigned short base; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed long sum_old_dbl_1; + signed long sum_old_dbl_2; + unsigned long p_xold; + unsigned short i_xold; + unsigned short base_old; + unsigned long bootkey_old; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRMovAvgFlt_typ; + +typedef struct LCRTimeBasedOnOff +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float timpulse; + float tchange_up; + float tchange_down; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float hysteresis_up; + float hysteresis_down; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long t_cnt_1; + signed long t_cnt_2; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysInfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit ref; + /* VAR_OUTPUT (digital) */ + plcbit up; + plcbit down; + plcbit refOk; + /* VAR (digital) */ + plcbit enable_old; + plcbit ref_old; +} LCRTimeBasedOnOff_typ; + +typedef struct LCRDifferentiate +{ + /* VAR_INPUT (analog) */ + float x; + float tv; + float tf; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + struct SysInfo sysinfo_inst; + signed long a11; + signed long a12; + signed long a21; + signed long a22; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRDifferentiate_typ; + +typedef struct LCRPIDTune +{ + /* VAR_INPUT (analog) */ + float Y_min; + float Y_max; + float Y0; + float Y1; + float X0; + float X_min; + float X_max; + signed short P_manualAdjust; + signed short I_manualAdjust; + signed short D_manualAdjust; + unsigned long request; + struct lcrpid_tune_addpar_typ* pAddPar; + struct lcrpid_tune_osc_options_typ* pOptions_osc; + struct lcrpid_tune_step_options_typ* pOptions_step; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned short addInfo; + unsigned long ident; + unsigned short state; + /* VAR (analog) */ + float t_autotune; + unsigned short status_tmp; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + float e; + float e_minAmp; + float e_old_up; + float e_old_down; + float e_old; + struct SysInfo sysinfo_inst; + struct LCRMovAvgFlt MovAvgFlt_inst; + struct lcrpid_old_typ old; + struct lcrpid_procPar_typ processPar; + struct lcrpid_internal_typ internal_data; + struct lcrpid_tune_addpar_typ addPar; + struct lcrpid_tune_osc_typ oscillation; + struct lcrpid_tune_step_typ stepresponse; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit okToStep; + /* VAR_OUTPUT (digital) */ + plcbit rdyToStep; + /* VAR (digital) */ + plcbit curveDown; + plcbit curveUp; +} LCRPIDTune_typ; + +typedef struct LCRSlimPID +{ + /* VAR_INPUT (analog) */ + float W; + float X; + unsigned long request; + struct lcrslimpid_par_typ* pPar; + /* VAR_OUTPUT (analog) */ + float e; + float Y; + unsigned short status; + unsigned short addInfo; + /* VAR (analog) */ + struct LCRMovAvgFlt MovAvgFlt_inst; + struct LCRPIDTune PIDTune_inst; + struct LCRPID PID_inst; + unsigned long requ_old; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRSlimPID_typ; + +typedef struct LCRPFM +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_pulse; + float t_pause; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR (analog) */ + float area; + float area_c; + float range; + float last; + float tpls; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR_OUTPUT (digital) */ + plcbit pulse; + /* VAR (digital) */ + plcbit enable_old; +} LCRPFM_typ; + +typedef struct LCRTt +{ + /* VAR_INPUT (analog) */ + signed long Tt; + float x; + float y_set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + signed long Ts; + signed long Tt_Max; + float* pRingBuf; + float* pBuf_OutIn; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR (digital) */ + plcbit enable_old; +} LCRTt_typ; + +typedef struct LCRPT2 +{ + /* VAR_INPUT (analog) */ + float V; + float T1; + float T2; + float x; + float y_set; + unsigned char set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + unsigned long x2_dbl_1; + unsigned long x2_dbl_2; + signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT2_typ; + +typedef struct LCRSimModExt +{ + /* VAR_INPUT (analog) */ + signed long Tt_h; + signed long Tt_c; + float k_h; + float k_c; + float PT2_T1; + float PT2_T2; + float Temp_amb; + float Temp_c; + float Alpha_h; + float Alpha_c; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + struct LCRTt Tt_heat; + struct LCRTt Tt_cool; + float k_h_intern; + float k_c_intern; + struct LCRPT2 PT2; + float y_c; + float y_end; + float y_h; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRSimModExt_typ; + +typedef struct LCRPT1e +{ + /* VAR_INPUT (analog) */ + float V; + float T1; + float x; + float y_set; + unsigned char set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT1e_typ; + +typedef struct LCRDblActPID +{ + /* VAR_INPUT (analog) */ + float W; + float X; + float Y_man; + unsigned char mode; + struct lcrdblpid_par_typ* pPar1; + struct lcrdblpid_par_typ* pPar2; + struct lcrpid_tune_addpar_typ* pAddPar; + struct lcrdblpid_tune_typ* pOpt; + /* VAR_OUTPUT (analog) */ + float e; + float Y1; + float Y2; + unsigned short status; + unsigned char tuneState; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDTune tune; + struct SysInfo sysinfo_inst; + float gradient; + float Y_avg; + unsigned long tcnt_1; + unsigned long tcnt_2; + float Tmeas; + float y_lim_old; + float p_fact; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + unsigned char use_par; + unsigned char meas; + unsigned char mode_old; + unsigned char tune_step; + unsigned char tune_grad; + unsigned char tune_2nd; + unsigned char invert; + unsigned char counter_state; + unsigned char mode_int; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit hold_I; + plcbit okToStep; + /* VAR_OUTPUT (digital) */ + plcbit rdyToStep; + /* VAR (digital) */ + plcbit enable_old; +} LCRDblActPID_typ; + +typedef struct LCRMinMax +{ + /* VAR_INPUT (analog) */ + float in; + /* VAR_OUTPUT (analog) */ + float out_min; + float out_max; + /* VAR_INPUT (digital) */ + plcbit reset; +} LCRMinMax_typ; + +typedef struct LCRTempPID +{ + /* VAR_INPUT (analog) */ + float Temp_set; + float Temp; + float Y_man; + unsigned long mode; + struct lcrtemp_set_typ* pSettings; + /* VAR_OUTPUT (analog) */ + float y_heat; + float y_cool; + unsigned short status; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDpara pid_para; + float Temp_set_delay; + float Temp_set_int; + float TempSetOld; + float delayCnt; + signed char stateOld; + signed char state; + float a; + struct SysInfo sysinfo_inst; + unsigned char para_check_done; + struct lcrtemp_pid_internal_typ internal_para; + float dbl_dt; + float tAlt; + float altTime; + float tKnick; + float fAlt; + float a_alt; + float a_e; + float a_internal; + float Temp_set_int_old1; + float Temp_set_int_old2; + float Temp_set_int_old3; + unsigned long mode_old; + unsigned long timestore1; + unsigned long timestore2; + float yManInternal; + unsigned long timeCnt; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit update; + /* VAR (digital) */ + plcbit delayFlag; + plcbit enable_old; + plcbit altActive; + plcbit err_flag; +} LCRTempPID_typ; + +typedef struct LCRPT2o +{ + /* VAR_INPUT (analog) */ + float V; + float D; + float Tf; + float u; + unsigned char Set_y; + float y_set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + struct lcrpt2o_Internal_typ Internal; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT2o_typ; + +typedef struct LCRTempTune +{ + /* VAR_INPUT (analog) */ + float Temp_set; + float Temp; + struct lcrtemp_set_typ* pSettings; + /* VAR_OUTPUT (analog) */ + float y_heat; + float y_cool; + unsigned short status; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDpara pid_para; + struct LCRDifferentiate DT2; + struct LCRPT2o pt2; + float Temp_flt; + unsigned short step; + float t; + float Temp_start; + float mem00; + float cnt02; + float cnt33; + float cnt20; + float pem01; + float pem33; + float pem10; + float pem02; + float pem44; + float pem20; + float tol01; + float tol10; + float tol02; + float tol20; + float tol22; + float Temp_old; + float delta_Temp; + unsigned long tcnt_1; + unsigned long tcnt_2; + unsigned long tcnt_dT_1; + unsigned long tcnt_dT_2; + struct SysInfo sysinfo_inst; + float Temp_set_internal; + float timecounter; + struct lcrtemp_tune_internal_typ internal_para; + float dbl_dt; + unsigned long call_counter; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + float timer2; + unsigned short waitCounter; + float Y_heat_tune_intern; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit start; + plcbit okToHeat; + plcbit okToFree; + plcbit okToFreeEnd; + plcbit okToCool; + plcbit okToCoolEnd; + /* VAR_OUTPUT (digital) */ + plcbit rdyToHeat; + plcbit rdyToFree; + plcbit rdyToFreeEnd; + plcbit rdyToCool; + plcbit rdyToCoolEnd; + plcbit done; + plcbit busy; + /* VAR (digital) */ + plcbit enable_old; +} LCRTempTune_typ; + +typedef struct LCRSchedulePWM +{ + /* VAR_INPUT (analog) */ + float Pmax; + unsigned short n; + unsigned long pPar; + float min_value; + float max_value; + float t_min_pulse; + float t_period; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR (analog) */ + struct SysInfo sysinfo_inst; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short numberUnits; + unsigned short limFact; + float Pact; + float Pman; + float intern0[6]; + struct lcrschedule_par_typ* in; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; + plcbit cmd_delay; + plcbit err_flag; + plcbit limAll; +} LCRSchedulePWM_typ; + + + +/* Prototyping of functions and function blocks */ +_BUR_PUBLIC void LCRPID(struct LCRPID* inst); +_BUR_PUBLIC void LCRScal(struct LCRScal* inst); +_BUR_PUBLIC void LCRCurveByPoints(struct LCRCurveByPoints* inst); +_BUR_PUBLIC void LCRPIDpara(struct LCRPIDpara* inst); +_BUR_PUBLIC void LCRContinServo(struct LCRContinServo* inst); +_BUR_PUBLIC void LCRPT1(struct LCRPT1* inst); +_BUR_PUBLIC void LCRRamp(struct LCRRamp* inst); +_BUR_PUBLIC void LCRIntegrate(struct LCRIntegrate* inst); +_BUR_PUBLIC void LCRLimit(struct LCRLimit* inst); +_BUR_PUBLIC void LCRLimScal(struct LCRLimScal* inst); +_BUR_PUBLIC void LCRPWM(struct LCRPWM* inst); +_BUR_PUBLIC void LCRMovAvgFlt(struct LCRMovAvgFlt* inst); +_BUR_PUBLIC void LCRTimeBasedOnOff(struct LCRTimeBasedOnOff* inst); +_BUR_PUBLIC void LCRDifferentiate(struct LCRDifferentiate* inst); +_BUR_PUBLIC void LCRSlimPID(struct LCRSlimPID* inst); +_BUR_PUBLIC void LCRPIDTune(struct LCRPIDTune* inst); +_BUR_PUBLIC void LCRPFM(struct LCRPFM* inst); +_BUR_PUBLIC void LCRSimModExt(struct LCRSimModExt* inst); +_BUR_PUBLIC void LCRTt(struct LCRTt* inst); +_BUR_PUBLIC void LCRPT2(struct LCRPT2* inst); +_BUR_PUBLIC void LCRPT1e(struct LCRPT1e* inst); +_BUR_PUBLIC void LCRDblActPID(struct LCRDblActPID* inst); +_BUR_PUBLIC void LCRMinMax(struct LCRMinMax* inst); +_BUR_PUBLIC void LCRTempPID(struct LCRTempPID* inst); +_BUR_PUBLIC void LCRTempTune(struct LCRTempTune* inst); +_BUR_PUBLIC void LCRPT2o(struct LCRPT2o* inst); +_BUR_PUBLIC void LCRSchedulePWM(struct LCRSchedulePWM* inst); + + +#ifdef __cplusplus +}; +#endif +#endif /* _LOOPCONR_ */ + diff --git a/Logical/Libraries/LoopConR/SG4/Arm/LoopConR.br b/Logical/Libraries/LoopConR/SG4/Arm/LoopConR.br new file mode 100644 index 0000000..04fe924 Binary files /dev/null and b/Logical/Libraries/LoopConR/SG4/Arm/LoopConR.br differ diff --git a/Logical/Libraries/LoopConR/SG4/Arm/libLoopConR.a b/Logical/Libraries/LoopConR/SG4/Arm/libLoopConR.a new file mode 100644 index 0000000..d1881dc Binary files /dev/null and b/Logical/Libraries/LoopConR/SG4/Arm/libLoopConR.a differ diff --git a/Logical/Libraries/LoopConR/SG4/LoopConR.br b/Logical/Libraries/LoopConR/SG4/LoopConR.br new file mode 100644 index 0000000..d5f3c10 Binary files /dev/null and b/Logical/Libraries/LoopConR/SG4/LoopConR.br differ diff --git a/Logical/Libraries/LoopConR/SG4/LoopConR.h b/Logical/Libraries/LoopConR/SG4/LoopConR.h new file mode 100644 index 0000000..e88fcf4 --- /dev/null +++ b/Logical/Libraries/LoopConR/SG4/LoopConR.h @@ -0,0 +1,1677 @@ +/* Automation Studio generated header file */ +/* Do not edit ! */ +/* LoopConR 4.10.2 */ + +#ifndef _LOOPCONR_ +#define _LOOPCONR_ +#ifdef __cplusplus +extern "C" +{ +#endif +#ifndef _LoopConR_VERSION +#define _LoopConR_VERSION 4.10.2 +#endif + +#include + +#ifndef _BUR_PUBLIC +#define _BUR_PUBLIC +#endif +#ifdef _SG4 + #include "sys_lib.h" + #include "brsystem.h" +#endif +#ifdef _SG3 + #include "sys_lib.h" + #include "brsystem.h" +#endif +#ifdef _SGC + #include "sys_lib.h" + #include "brsystem.h" +#endif + +/* Constants */ +#ifdef _REPLACE_CONST + #define LCRPID_TUNE_REQU_PER_5 500000U + #define LCRSLIMPID_REQU_PER_5 500000U + #define LCRSLIMPID_REQU_PER_4 400000U + #define LCRPID_TUNE_REQU_PER_4 400000U + #define LCRPID_TUNE_REQU_PER_3 300000U + #define LCRSLIMPID_REQU_PER_3 300000U + #define LCRTEMP_STEP_ERROR 65535U + #define LCR_ERR_DISABLED 65534U + #define LCR_ERR_PT2O_TF_NEG_ZERO 33154U + #define LCR_ERR_PT2O_D_NEG 33153U + #define LCR_ERR_LCRTEMPTune_DT_IGNORED 33152U + #define LCR_ERR_LCRTEMPPID_INVALID_MODE 33151U + #define LCR_ERR_LCRTEMPTune_INVALID_MODE 33150U + #define LCR_WARN_PT2O_TF_TS 33102U + #define LCR_WARN_LCRTEMPTune_ASYNC 33101U + #define LCR_WARN_LCRTEMPTune_DT_HIGH 33100U + #define LCR_ERR_SCHEDULE_N 31574U + #define LCR_ERR_SCHEDULE_P 31573U + #define LCR_ERR_LCRTEMPPID_NO_TALT 31572U + #define LCR_ERR_LCRTEMPPID_TKNICK 31571U + #define LCR_ERR_LCRTEMPTune_TASKTIME_0 31570U + #define LCR_ERR_LCRTEMPPID_ILLEGALMODE 31569U + #define LCR_ERR_LCRTEMPPID_WR_PTR 31568U + #define LCR_ERR_LCRTEMPPID_WR_PARA 31567U + #define LCR_ERR_LCRTEMPTune_WR_TSET 31567U + #define LCR_ERR_LCRTEMPTune_WR_PTR 31566U + #define LCR_ERR_LCRPIDTune_MAXMIN 31564U + #define LCR_ERR_POINTER 31563U + #define LCR_ERR_LCRDBLPID_DX_DT 31562U + #define LCR_ERR_LCRDBLPID_WX_LOW 31561U + #define LCR_ERR_LCRPIDTune_CONTROL_VAR 31560U + #define LCR_ERR_LCRPIDTune_INVALID_REQU 31559U + #define LCR_ERR_LCRPID_PAR_FBKMODE 31558U + #define LCR_ERR_LCRPID_PAR_DYMAX 31557U + #define LCR_ERR_LCRPID_PAR_DMODE 31556U + #define LCR_ERR_LCRPID_PARADAT 31554U + #define LCR_ERR_LCRPID_MODE 31553U + #define LCR_ERR_LCRPID_IDENT 31552U + #define LCR_ERR_LCRMovAvgFlt_BASE 31551U + #define LCR_ERR_LCRIntegrate_TN 31550U + #define LCRPID_TUNE_REQU_OSC_3 30000U + #define LCRSLIMPID_REQU_OSC_3 30000U + #define LCRPID_TUNE_REQU_OSC_2 20000U + #define LCRSLIMPID_REQU_OSC_2 20000U + #define LCR_ERR_LCRTT_TT_NEG 12048U + #define LCR_ERR_LCRPT12_T2_NEG 12047U + #define LCR_ERR_LCRPT12_T1_NEG 12046U + #define LCR_ERR_LCRCurveByPoints_TABLE 12045U + #define LCR_ERR_LCRPID_PAR_DEADBAND 12044U + #define LCR_ERR_LCRPID_PAR_WX_MAXMIN 12043U + #define LCR_ERR_LCRPID_PAR_DEADBAND_MODE 12042U + #define LCR_ERR_LCRPIDTune_W_CHANGED 12041U + #define LCR_ERR_LCRPIDTune_TIMEOUT 12040U + #define LCR_ERR_LCRPIDTune_PARAMETER 12039U + #define LCR_ERR_LCRPIDTune_ABORT 12038U + #define LCR_ERR_MAXMIN 12037U + #define LCR_ERR_LCRContinServo_TIMPULSE 12036U + #define LCR_ERR_LCRContinServo_TCHANGE 12035U + #define LCR_ERR_LCRRamp_DYUP_DYDOWN 12034U + #define LCR_ERR_LCRPWM_TPERIOD 12033U + #define LCR_ERR_LCRPWM_TPULSE 12033U + #define LCR_ERR_LCRPWM_TMINPULSE 12032U + #define LCR_ERR_LCRPT1_T 12031U + #define LCR_ERR_LCRPID_PAR_TV 12030U + #define LCR_ERR_LCRPID_PAR_TN 12029U + #define LCR_ERR_LCRPID_PAR_TF 12028U + #define LCR_ERR_LCRPID_PAR_KW 12027U + #define LCR_ERR_LCRPID_PAR_KP 12026U + #define LCR_ERROR 12025U + #define LCR_ERR_LCRPID_PAR_KFBK 12025U + #define LCR_WARN_LCRTEMPPID_WR_PARA 12024U + #define LCR_WARN_LCRTEMPTune_WR_BASE 12023U + #define LCR_WARN_LCRTEMPTune_WR_PARA 12022U + #define LCR_WARN_LCRTEMPTune_HEAT_TP 12021U + #define LCR_WARN_LCRDBLPID_TUNE_CHANGE 12019U + #define LCR_WARN_LCRTT_MEM 12018U + #define LCR_WARN_LCRTT_TT_INT 12017U + #define LCR_WARN_LCRTT_TT_TS 12016U + #define LCR_WARN_LCRTT_TT_ZERO 12015U + #define LCR_WARN_LCRPT12_T2_INT 12014U + #define LCR_WARN_LCRPT12_T2_TS 12013U + #define LCR_WARN_LCRPT12_T2_ZERO 12012U + #define LCR_WARN_LCRPT12_T1_INT 12011U + #define LCR_WARN_LCRPT12_T1_TS 12010U + #define LCR_WARN_LCRPID_YMAN_LIMIT 12009U + #define LCR_WARN_LCRPID_A_LIMIT 12008U + #define LCR_WARN_Tx_DT 12007U + #define LCR_WARN_LCRPT12_T1_ZERO 12005U + #define LCR_WARN_LCRPIDTune_CYCLETIME 12004U + #define LCR_WARN_LCRPID_YFBK_LIMIT 12003U + #define LCR_WARN_LCRPID_I_MINLIMIT 12002U + #define LCR_WARN_LCRPID_I_MAXLIMIT 12001U + #define LCRSLIMPID_REQU_OSC_1 10000U + #define LCRPID_TUNE_REQU_OSC_1 10000U + #define LCRSLIMPID_REQU_CHR_REF_OS 5000U + #define LCRPID_TUNE_REQU_CHR_REF_OS 5000U + #define LCRSLIMPID_REQU_CHR_REF_AP 4000U + #define LCRPID_TUNE_REQU_CHR_REF_AP 4000U + #define LCRPID_TUNE_REQU_ZN_DIST 3000U + #define LCRSLIMPID_REQU_ZN_DIST 3000U + #define LCRPID_TUNE_REQU_CHR_DIST_OS 2000U + #define LCRSLIMPID_REQU_CHR_DIST_OS 2000U + #define LCRPID_TUNE_REQU_CHR_DIST_AP 1000U + #define LCRSLIMPID_REQU_CHR_DIST_AP 1000U + #define LCRSLIMPID_REQU_P 300U + #define LCRPID_TUNE_REQU_P 300U + #define LCRSLIMPID_REQU_PI 200U + #define LCRPID_TUNE_REQU_PI 200U + #define LCRTEMP_STEP_DONE 130U + #define LCRTEMP_STEP_PID_DONE 125U + #define LCRTEMP_STEP_PID_DONE_COOLONLY 122U + #define LCRTEMP_STEP_COOL 120U + #define LCRPID_TUNE_ADDINFO_OSC_PERIOD 111U + #define LCRTEMP_STEP_START_COOL 110U + #define LCRTEMP_STEP_WAIT_COOLONLY 105U + #define LCRPID_MODE_FREEZE_JOLTFREE 105U + #define LCRPID_MODE_CLOSE_JOLTFREE 104U + #define LCRPID_MODE_OPEN_JOLTFREE 103U + #define LCRPID_MODE_MAN_JOLTFREE 102U + #define LCRTEMP_STEP_WAIT_COOL 100U + #define LCRPID_TUNE_REQU_PID 100U + #define LCRSLIMPID_REQU_PID 100U + #define LCRTEMP_STEP_PID_COOL 90U + #define LCRTEMP_STEP_PID 80U + #define LCRTEMP_STEP_FREE 70U + #define LCRTEMP_STEP_START_FREE 60U + #define LCRTEMP_STEP_WAIT_FREE 50U + #define LCRPID_TUNE_STATE_FINISHED 50U + #define LCRPID_TUNE_STATE_RESET_CNTL 49U + #define LCRPID_TUNE_STATE_CALC_PARA 45U + #define LCRTEMP_STEP_PID_FREE 40U + #define LCRTEMP_STEP_HEAT 30U + #define LCRPID_TUNE_STATE_STEP_WAITEQ2 22U + #define LCRPID_TUNE_STATE_STEP_MAXGRAD 21U + #define LCRSLIMPID_REQU_DIR_NEG 20U + #define LCRTEMP_STEP_START_HEAT 20U + #define LCRPID_TUNE_STATE_STEP_WAITEQ1 20U + #define LCRPID_TUNE_REQU_DIR_NEG 20U + #define LCRPID_TUNE_STATE_OSC_CNTLPAR 19U + #define LCRPID_TUNE_STATE_OSC_PERFORM_2 13U + #define LCRPID_TUNE_STATE_OSC_PERFORM_1 12U + #define LCRPID_TUNE_STATE_OSC_SEQ_CNTL 11U + #define LCRTEMP_STEP_WAIT_HEAT 10U + #define LCRSLIMPID_REQU_DIR_POS 10U + #define LCRPID_TUNE_STATE_OSCILLATE 10U + #define LCRPID_TUNE_REQU_DIR_POS 10U + #define LCRDBLPID_MODE_TUNE_Y2 9U + #define LCRDBLPID_MODE_TUNE_Y1 8U + #define LCRDBLPID_MODE_TUNE_6 7U + #define LCRDBLPID_MODE_TUNE_4 6U + #define LCRPID_FBK_MODE_SET_YI 5U + #define LCRPID_MODE_FREEZE 5U + #define LCRTEMP_STEP_WAIT 5U + #define LCRSLIMPID_REQU_WRITE_PARAS 4U + #define LCRPID_MODE_CLOSE 4U + #define LCRPID_FBK_MODE_LIMIT_YI 4U + #define LCRDBLPID_TSTATE_ERROR 4U + #define LCRPID_FBK_MODE_EXT_SELECTOR 3U + #define LCRSLIMPID_REQU_READ_PARAS 3U + #define LCRDBLPID_TSTATE_FINISHED 3U + #define LCRPID_MODE_OPEN 3U + #define LCRPID_TUNE_REQU_STEPRESPONSE 2U + #define LCRPID_FBK_MODE_EXTERN 2U + #define LCRPID_MODE_MAN 2U + #define LCRSLIMPID_REQU_STEPRESPONSE 2U + #define LCRPID_D_MODE_E 2U + #define LCRDBLPID_TSTATE_Y2 2U + #define LCRTEMPPID_MODE_MAN 2U + #define LCRPID_DEADBAND_MODE_STANDARD_I 2U + #define LCRSLIMPID_REQU_OSCILLATE 1U + #define LCRTEMP_COOL 1U + #define LCRTEMP_PT2 1U + #define LCRTEMP_HYST_MODE_JOLTFREE 1U + #define LCRTEMPPID_MODE_AUTO 1U + #define LCRPID_TUNE_REQU_OSCILLATE 1U + #define LCRDBLPID_TSTATE_Y1 1U + #define LCRPID_FBK_MODE_INTERN 1U + #define LCRPID_DEADBAND_MODE_STANDARD 1U + #define LCRPID_D_MODE_X 1U + #define LCRPID_MODE_AUTO 1U + #define LCRTEMPTune_MODE_EXP 1U + #define LCRPID_TUNE_REQU_OFF 0U + #define LCRDBLPID_TSTATE_OFF 0U + #define LCRTEMPTune_MODE_DEF 0U + #define LCRTEMP_PT1 0U + #define LCRSLIMPID_REQU_OFF 0U + #define LCRPID_TUNE_STATE_READY 0U + #define LCRPID_MODE_OFF 0U + #define LCRTEMP_HEAT 0U + #define LCRPID_DEADBAND_MODE_ZERO 0U +#else + #ifndef _GLOBAL_CONST + #define _GLOBAL_CONST _WEAK const + #endif + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_5; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_5; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_4; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_4; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_3; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_3; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_ERROR; + _GLOBAL_CONST unsigned short LCR_ERR_DISABLED; + _GLOBAL_CONST unsigned short LCR_ERR_PT2O_TF_NEG_ZERO; + _GLOBAL_CONST unsigned short LCR_ERR_PT2O_D_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_DT_IGNORED; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_INVALID_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_INVALID_MODE; + _GLOBAL_CONST unsigned short LCR_WARN_PT2O_TF_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_ASYNC; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_DT_HIGH; + _GLOBAL_CONST unsigned short LCR_ERR_SCHEDULE_N; + _GLOBAL_CONST unsigned short LCR_ERR_SCHEDULE_P; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_NO_TALT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_TKNICK; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_TASKTIME_0; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_ILLEGALMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_WR_PTR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_WR_PARA; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_WR_TSET; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_WR_PTR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_POINTER; + _GLOBAL_CONST unsigned short LCR_ERR_LCRDBLPID_DX_DT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRDBLPID_WX_LOW; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_CONTROL_VAR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_INVALID_REQU; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_FBKMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DYMAX; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PARADAT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_IDENT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRMovAvgFlt_BASE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRIntegrate_TN; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_3; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_3; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_2; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_2; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTT_TT_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT12_T2_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT12_T1_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRCurveByPoints_TABLE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DEADBAND; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_WX_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DEADBAND_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_W_CHANGED; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_TIMEOUT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_PARAMETER; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_ABORT; + _GLOBAL_CONST unsigned short LCR_ERR_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRContinServo_TIMPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRContinServo_TCHANGE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRRamp_DYUP_DYDOWN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TPERIOD; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TMINPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT1_T; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TV; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TF; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KW; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KP; + _GLOBAL_CONST unsigned short LCR_ERROR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KFBK; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPPID_WR_PARA; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_WR_BASE; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_WR_PARA; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_HEAT_TP; + _GLOBAL_CONST unsigned short LCR_WARN_LCRDBLPID_TUNE_CHANGE; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_MEM; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_YMAN_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_A_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_Tx_DT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPIDTune_CYCLETIME; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_YFBK_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_I_MINLIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_I_MAXLIMIT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_1; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_1; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_REF_OS; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_REF_OS; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_REF_AP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_REF_AP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_ZN_DIST; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_ZN_DIST; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_DIST_OS; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_DIST_OS; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_DIST_AP; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_DIST_AP; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_P; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_P; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PI; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PI; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_DONE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_DONE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_DONE_COOLONLY; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_COOL; + _GLOBAL_CONST unsigned short LCRPID_TUNE_ADDINFO_OSC_PERIOD; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_COOL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_COOLONLY; + _GLOBAL_CONST unsigned char LCRPID_MODE_FREEZE_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_CLOSE_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_OPEN_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_MAN_JOLTFREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_COOL; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PID; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PID; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_COOL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_FREE; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_FINISHED; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_RESET_CNTL; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_CALC_PARA; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_HEAT; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_WAITEQ2; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_MAXGRAD; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_DIR_NEG; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_HEAT; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_WAITEQ1; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_DIR_NEG; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_CNTLPAR; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_PERFORM_2; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_PERFORM_1; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_SEQ_CNTL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_HEAT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_DIR_POS; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSCILLATE; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_DIR_POS; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_Y2; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_Y1; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_6; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_4; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_SET_YI; + _GLOBAL_CONST unsigned char LCRPID_MODE_FREEZE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_WRITE_PARAS; + _GLOBAL_CONST unsigned char LCRPID_MODE_CLOSE; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_LIMIT_YI; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_ERROR; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_EXT_SELECTOR; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_READ_PARAS; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_FINISHED; + _GLOBAL_CONST unsigned char LCRPID_MODE_OPEN; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_STEPRESPONSE; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_EXTERN; + _GLOBAL_CONST unsigned char LCRPID_MODE_MAN; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_STEPRESPONSE; + _GLOBAL_CONST unsigned char LCRPID_D_MODE_E; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_Y2; + _GLOBAL_CONST unsigned long LCRTEMPPID_MODE_MAN; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_STANDARD_I; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSCILLATE; + _GLOBAL_CONST unsigned char LCRTEMP_COOL; + _GLOBAL_CONST unsigned char LCRTEMP_PT2; + _GLOBAL_CONST unsigned char LCRTEMP_HYST_MODE_JOLTFREE; + _GLOBAL_CONST unsigned long LCRTEMPPID_MODE_AUTO; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSCILLATE; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_Y1; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_INTERN; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_STANDARD; + _GLOBAL_CONST unsigned char LCRPID_D_MODE_X; + _GLOBAL_CONST unsigned char LCRPID_MODE_AUTO; + _GLOBAL_CONST unsigned long LCRTEMPTune_MODE_EXP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OFF; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_OFF; + _GLOBAL_CONST unsigned long LCRTEMPTune_MODE_DEF; + _GLOBAL_CONST unsigned char LCRTEMP_PT1; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OFF; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_READY; + _GLOBAL_CONST unsigned char LCRPID_MODE_OFF; + _GLOBAL_CONST unsigned char LCRTEMP_HEAT; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_ZERO; +#endif + + + + +/* Datatypes and datatypes of function blocks */ +typedef struct lcrCurveByPoints_TabEntry_type +{ float x; + float y; +} lcrCurveByPoints_TabEntry_type; + +typedef struct lcrdblpid_par_typ +{ float Y_max; + float Y_min; + signed short K_fact; + float Kp; + float Tn; + float Tv; +} lcrdblpid_par_typ; + +typedef struct lcrpid_tune_osc_options_typ +{ float osc_minAmplitude; + float Q_min; +} lcrpid_tune_osc_options_typ; + +typedef struct lcrpid_tune_step_options_typ +{ float eqDeltaX; + float eqDeltaWX; + float eqDeltat; + float evalDeltaX; + unsigned short evalNfilter; + unsigned short exitNotMaxdXCount; + float exitdXRatio; +} lcrpid_tune_step_options_typ; + +typedef struct lcrdblpid_tune_typ +{ signed short P1_manualAdjust; + signed short I1_manualAdjust; + signed short D1_manualAdjust; + signed short P2_manualAdjust; + signed short I2_manualAdjust; + signed short D2_manualAdjust; + float X_min; + float X_max; + float X0; + float de_min; + float Y0; + float Y1step; + float Y2step; + unsigned long tuneY1_opt; + unsigned long tuneY2_opt; + unsigned char tune_first; + float hyst; + float measDelta; + struct lcrpid_tune_osc_options_typ osc_opt; + struct lcrpid_tune_step_options_typ step_opt; +} lcrdblpid_tune_typ; + +typedef struct lcrpid_internal_typ +{ unsigned short size; + plcbit valid; + float WX_max; + float WX_min; + plcbit invert; + float deadband; + unsigned char deadband_mode; + float dY_max; + float Kp; + float Kp_Tn; + float Tv_Tf; + float Tf_reciproc; + float Kw; + float Kfbk_Kp; + float Kfbk_Kp_max; + unsigned char fbk_mode; + unsigned char d_mode; + unsigned char force_mode; + float Y_force; + float W; + float X; + unsigned char pid_init; + signed long Yp1; + signed long Yp2; + signed long dYi1; + signed long dYi2; + signed long Yi1; + signed long Yi2; + float dt_Tf; + signed long a11; + signed long a12; + signed long a21; + signed long a22; + signed long Yd1; + signed long Yd2; + signed long Ytotal1; + signed long Ytotal2; + signed long Ylim1; + signed long Ylim2; + signed long Y1; + signed long Y2; + float deltaY_fbk; + float e_fbk; +} lcrpid_internal_typ; + +typedef struct lcrpid_procPar_typ +{ unsigned short size; + plcbit valid; + plcbit stepResp_valid; + float stepResp_v; + float stepResp_t_u; + float stepResp_t_g; + plcbit osc_valid; + float osc_amplitudeRatio; + float osc_tPeriod; + plcbit force_params; + float Kp; + float Kp_tune; + float Tn; + float Tn_tune; + float Tv; + float Tv_tune; +} lcrpid_procPar_typ; + +typedef struct lcrpid_old_typ +{ struct lcrpid_procPar_typ processPar; + signed short P_manualAdjust; + signed short I_manualAdjust; + signed short D_manualAdjust; + float Y_min; + float Y_max; + float dY_max; + float Tf_Tv; + float Kw; + float Kfbk; + float deadband; + float W; + unsigned long request; + unsigned char fbk_mode; + unsigned char d_mode; + plcbit invert; + plcbit enable; +} lcrpid_old_typ; + +typedef struct lcrpid_osc_val_typ +{ float X; + float t; +} lcrpid_osc_val_typ; + +typedef struct lcrpid_osc_per_typ +{ struct lcrpid_osc_val_typ max; + struct lcrpid_osc_val_typ min; +} lcrpid_osc_per_typ; + +typedef struct lcrpid_tune_addpar_typ +{ float t_max_tune; + float WX_min; + float WX_max; + float dY_max; + float Tf_Tv; + float Kw; + float Kfbk; + unsigned char fbk_mode; + unsigned char d_mode; + float deadband; + unsigned char deadband_mode; + plcbit invert; +} lcrpid_tune_addpar_typ; + +typedef struct lcrpid_tune_osc_typ +{ struct lcrpid_tune_osc_options_typ options; + unsigned short oscPhase; + signed char dir; + plcbit enHi; + plcbit enLo; + float Y_hi; + float Y_lo; + unsigned short i_maxPeriod; + unsigned short i_period; + float X_ampl; + float X_avg; + float X_min_avg; + float X_max_avg; + float Y_avg; + float deltaY; + float t_Ylohi[5]; + float t_Yhilo[5]; + float Q_act; + float a_wx; + float amplitudeRatio; + float Ku; + float tPeriod; + struct lcrpid_osc_per_typ period[5]; +} lcrpid_tune_osc_typ; + +typedef struct lcrpid_tune_step_typ +{ struct lcrpid_tune_step_options_typ options; + float Y0; + float Y1; + float t_jump; + float W; + float X0; + float Xmax; + float Xmin; + float Xfiltered; + plcbit deltaXok; + plcbit deltaWXok; + float eqTime; + signed char dir; + float deltaX; + float X1; + float t1; + plcbit t1set; + float dX_dt; + float dX_dt_max; + float XmaxGrad; + float maxX1; + float maxX2; + float maxt1; + float maxt2; + float tmaxGrad; + float gainFactor; + float deadTime; + float riseTime; + unsigned short notMaxCount; + float gradientRatio; +} lcrpid_tune_step_typ; + +typedef struct lcrpt2o_Internal_typ +{ signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + float V_old; + float D_old; + float Tf_old; + unsigned char Set_y_old; + unsigned char Set_y_2; + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + unsigned long x2_dbl_1; + unsigned long x2_dbl_2; + unsigned long Sqrt_D_1_dbl_1; + unsigned long Sqrt_D_1_dbl_2; + unsigned long Ts_Tf_dbl_1; + unsigned long Ts_Tf_dbl_2; + unsigned long Exp_D_Ts_Tf_dbl_1; + unsigned long Exp_D_Ts_Tf_dbl_2; + unsigned long a0_dbl_1; + unsigned long a0_dbl_2; + unsigned long a1_dbl_1; + unsigned long a1_dbl_2; + unsigned long b0_dbl_1; + unsigned long b0_dbl_2; + unsigned long b1_dbl_1; + unsigned long b1_dbl_2; + unsigned long Bootkey; +} lcrpt2o_Internal_typ; + +typedef struct LCRPWM +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_min_pulse; + float t_period; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float t_on; + float t_off; + /* VAR (analog) */ + signed long cnt_terron_1; + signed long cnt_terron_2; + signed long cnt_terroff_1; + signed long cnt_terroff_2; + signed long cnt_t_pulse_1; + signed long cnt_t_pulse_2; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR_OUTPUT (digital) */ + plcbit pulse; + /* VAR (digital) */ + plcbit corr; +} LCRPWM_typ; + +typedef struct lcrschedule_add_typ +{ float periodTime; + float onTime; + float t_on_intern; + float bcOnTime; + unsigned short sortIndex; + struct LCRPWM fbkPWM; + plcbit flagDelay; +} lcrschedule_add_typ; + +typedef struct lcrschedule_par_typ +{ float P; + float X; + plcbit pulse; + float Pout; + plcbit lim; + struct lcrschedule_add_typ Internal; +} lcrschedule_par_typ; + +typedef struct lcrslimpid_par_typ +{ float Y_max; + float Y_min; + float Kp; + float Tn; + float Tv; + float Kfbk; +} lcrslimpid_par_typ; + +typedef struct lcrtemp_add_typ +{ float mem01; + float mem02; + float mem10; + float mem20; + float exp_mem; + float cnt01; + float cnt02; + float cnt10; + float cnt20; + float cnt03; + float cnt30; + float cnt00; + float t_ignore_dT_heat; + float t_ignore_dT_free; + float t_ignore_dT_cool; + float yMin; + float yMax; + unsigned long reserved3; + unsigned long reserved4; + plcbit reserved5; + plcbit reserved6; +} lcrtemp_add_typ; + +typedef struct lcrtemp_pid_internal_typ +{ plcbit enable_cooling; + plcbit disable_heating; + float hyst; + float delay; + float Kw; + float Kfbk; + float Kp_h; + float Tn_h; + float Tv_h; + float Kp_c; + float Tn_c; + float Tv_c; + float dynGeneral; + float dynHeat; + float dynCool; + float mem01; + float mem02; + float mem10; + float mem20; + float exp_mem; + float yMin; + float yMax; +} lcrtemp_pid_internal_typ; + +typedef struct lcrtemp_pid_opt_typ +{ float Kp_h; + float Tn_h; + float Tv_h; + float Tf_h; + float Kp_c; + float Tn_c; + float Tv_c; + float Tf_c; + float dynGeneral; + float dynHeat; + float dynCool; +} lcrtemp_pid_opt_typ; + +typedef struct lcrtemp_pid_set_typ +{ float hyst; + unsigned char hyst_mode; + float delay; + float Kw; + float Kfbk; +} lcrtemp_pid_set_typ; + +typedef struct lcrtemp_tune_set_typ +{ unsigned long mode; + float Temp_amb; + float dRatio_heat; + float cnt_tp_heat; + float delta_T_heat; + float dT_min_heat; + float dRatio_free; + float cnt_tp_free; + float delta_T_free; + float dT_min_free; + float dRatio_cool; + float cnt_tp_cool; + float delta_T_cool; + float dT_min_cool; + float delta_T_sync_heat; + float delta_dT_sync_heat; + float cnt_wait_heat; + float delta_T_sync_free; + float delta_dT_sync_free; + float cnt_wait_free; + float delta_T_sync_cool; + float delta_dT_sync_cool; + float cnt_wait_cool; + float filter_base_T; + float delta_T_sync_stop; + float Y_heat_tune; +} lcrtemp_tune_set_typ; + +typedef struct lcrtemp_set_typ +{ plcbit enable_cooling; + plcbit disable_heating; + struct lcrtemp_pid_opt_typ PIDpara; + struct lcrtemp_tune_set_typ TuneSet; + struct lcrtemp_pid_set_typ PIDSet; + struct lcrtemp_add_typ Internal; +} lcrtemp_set_typ; + +typedef struct lcrtemp_tune_internal_typ +{ plcbit cool_tuning; + plcbit disable_heating; + unsigned long mode; + float Temp_amb; + float dRatio_heat; + float cnt_tp_heat; + float delta_T_heat; + float dT_min_heat; + float dRatio_free; + float cnt_tp_free; + float delta_T_free; + float dT_min_free; + float dRatio_cool; + float cnt_tp_cool; + float delta_T_cool; + float dT_min_cool; + float delta_T_sync_heat; + float delta_dT_sync_heat; + float cnt_wait_heat; + float delta_T_sync_free; + float delta_dT_sync_free; + float cnt_wait_free; + float delta_T_sync_cool; + float delta_dT_sync_cool; + float cnt_wait_cool; + float filter_base_T; + float t_ignore_dT_heat; + float t_ignore_dT_free; + float t_ignore_dT_cool; + float delta_T_sync_stop; +} lcrtemp_tune_internal_typ; + +typedef struct LCRScal +{ + /* VAR_INPUT (analog) */ + float x; + float x1; + float y1; + float x2; + float y2; + /* VAR_OUTPUT (analog) */ + float y; +} LCRScal_typ; + +typedef struct LCRPID +{ + /* VAR_INPUT (analog) */ + unsigned long ident; + float W; + float X; + float Y_max; + float Y_min; + float A; + float Y_man; + float Y_fbk; + unsigned char mode; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float e; + float Y; + float Yp; + float Yi; + float Yd; + /* VAR (analog) */ + float Yi_set; + float Yi_min; + float Yi_max; + float Yi_minInternal; + float Yi_maxInternal; + float Tv_Tf_old; + float e_old; + unsigned short deadband_state; + struct SysInfo sysinfo_inst; + struct LCRScal scal_inst; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short musecs_old; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit hold_I; + /* VAR (digital) */ + plcbit Set_Yi; + plcbit force_Yi; + plcbit joltFreeDoneLowerLim; + plcbit joltFreeDoneUpperLim; + plcbit enable_old; +} LCRPID_typ; + +typedef struct LCRCurveByPoints +{ + /* VAR_INPUT (analog) */ + float x; + unsigned short NoOfPoints; + struct lcrCurveByPoints_TabEntry_type* ptr_table; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed short i_tab; + unsigned short iterations; + struct LCRScal scal1; +} LCRCurveByPoints_typ; + +typedef struct LCRPIDpara +{ + /* VAR_INPUT (analog) */ + float WX_max; + float WX_min; + float deadband; + unsigned char deadband_mode; + float dY_max; + float Kp; + float Tn; + float Tv; + float Tf; + float Kw; + float Kfbk; + unsigned char fbk_mode; + unsigned char d_mode; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long ident; + /* VAR (analog) */ + struct lcrpid_internal_typ internal_data; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit enter; + plcbit invert; +} LCRPIDpara_typ; + +typedef struct LCRContinServo +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_impulse; + float t_change_up; + float t_change_down; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float hysteresis_up; + float hysteresis_down; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long t_cnt_1; + signed long t_cnt_2; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysInfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit ref; + /* VAR_OUTPUT (digital) */ + plcbit up; + plcbit down; + plcbit refOk; + /* VAR (digital) */ + plcbit enable_old; + plcbit ref_old; +} LCRContinServo_typ; + +typedef struct LCRPT1 +{ + /* VAR_INPUT (analog) */ + float x; + float t; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; +} LCRPT1_typ; + +typedef struct LCRRamp +{ + /* VAR_INPUT (analog) */ + float x; + float dy_up; + float dy_down; + float y_max; + float y_min; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed long y_dbl_1; + signed long y_dbl_2; + unsigned long timestore1; + unsigned long timestore2; + unsigned long getDtForceOff; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR_OUTPUT (digital) */ + plcbit x_reached; + plcbit max_limit; + plcbit min_limit; +} LCRRamp_typ; + +typedef struct LCRIntegrate +{ + /* VAR_INPUT (analog) */ + float x; + float tn; + float y_max; + float y_min; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR_OUTPUT (digital) */ + plcbit max_limit; + plcbit min_limit; +} LCRIntegrate_typ; + +typedef struct LCRLimit +{ + /* VAR_INPUT (analog) */ + float in; + signed long max_value; + signed long min_value; + /* VAR_OUTPUT (analog) */ + unsigned short status; + signed long out; + /* VAR_OUTPUT (digital) */ + plcbit max_limit; + plcbit min_limit; +} LCRLimit_typ; + +typedef struct LCRLimScal +{ + /* VAR_INPUT (analog) */ + float x; + float x1; + float y1; + float x2; + float y2; + /* VAR_OUTPUT (analog) */ + float y; +} LCRLimScal_typ; + +typedef struct LCRMovAvgFlt +{ + /* VAR_INPUT (analog) */ + float x; + unsigned short base; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed long sum_old_dbl_1; + signed long sum_old_dbl_2; + unsigned long p_xold; + unsigned short i_xold; + unsigned short base_old; + unsigned long bootkey_old; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRMovAvgFlt_typ; + +typedef struct LCRTimeBasedOnOff +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float timpulse; + float tchange_up; + float tchange_down; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float hysteresis_up; + float hysteresis_down; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long t_cnt_1; + signed long t_cnt_2; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysInfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit ref; + /* VAR_OUTPUT (digital) */ + plcbit up; + plcbit down; + plcbit refOk; + /* VAR (digital) */ + plcbit enable_old; + plcbit ref_old; +} LCRTimeBasedOnOff_typ; + +typedef struct LCRDifferentiate +{ + /* VAR_INPUT (analog) */ + float x; + float tv; + float tf; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + struct SysInfo sysinfo_inst; + signed long a11; + signed long a12; + signed long a21; + signed long a22; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRDifferentiate_typ; + +typedef struct LCRPIDTune +{ + /* VAR_INPUT (analog) */ + float Y_min; + float Y_max; + float Y0; + float Y1; + float X0; + float X_min; + float X_max; + signed short P_manualAdjust; + signed short I_manualAdjust; + signed short D_manualAdjust; + unsigned long request; + struct lcrpid_tune_addpar_typ* pAddPar; + struct lcrpid_tune_osc_options_typ* pOptions_osc; + struct lcrpid_tune_step_options_typ* pOptions_step; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned short addInfo; + unsigned long ident; + unsigned short state; + /* VAR (analog) */ + float t_autotune; + unsigned short status_tmp; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + float e; + float e_minAmp; + float e_old_up; + float e_old_down; + float e_old; + struct SysInfo sysinfo_inst; + struct LCRMovAvgFlt MovAvgFlt_inst; + struct lcrpid_old_typ old; + struct lcrpid_procPar_typ processPar; + struct lcrpid_internal_typ internal_data; + struct lcrpid_tune_addpar_typ addPar; + struct lcrpid_tune_osc_typ oscillation; + struct lcrpid_tune_step_typ stepresponse; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit okToStep; + /* VAR_OUTPUT (digital) */ + plcbit rdyToStep; + /* VAR (digital) */ + plcbit curveDown; + plcbit curveUp; +} LCRPIDTune_typ; + +typedef struct LCRSlimPID +{ + /* VAR_INPUT (analog) */ + float W; + float X; + unsigned long request; + struct lcrslimpid_par_typ* pPar; + /* VAR_OUTPUT (analog) */ + float e; + float Y; + unsigned short status; + unsigned short addInfo; + /* VAR (analog) */ + struct LCRMovAvgFlt MovAvgFlt_inst; + struct LCRPIDTune PIDTune_inst; + struct LCRPID PID_inst; + unsigned long requ_old; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRSlimPID_typ; + +typedef struct LCRPFM +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_pulse; + float t_pause; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR (analog) */ + float area; + float area_c; + float range; + float last; + float tpls; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR_OUTPUT (digital) */ + plcbit pulse; + /* VAR (digital) */ + plcbit enable_old; +} LCRPFM_typ; + +typedef struct LCRTt +{ + /* VAR_INPUT (analog) */ + signed long Tt; + float x; + float y_set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + signed long Ts; + signed long Tt_Max; + float* pRingBuf; + float* pBuf_OutIn; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR (digital) */ + plcbit enable_old; +} LCRTt_typ; + +typedef struct LCRPT2 +{ + /* VAR_INPUT (analog) */ + float V; + float T1; + float T2; + float x; + float y_set; + unsigned char set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + unsigned long x2_dbl_1; + unsigned long x2_dbl_2; + signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT2_typ; + +typedef struct LCRSimModExt +{ + /* VAR_INPUT (analog) */ + signed long Tt_h; + signed long Tt_c; + float k_h; + float k_c; + float PT2_T1; + float PT2_T2; + float Temp_amb; + float Temp_c; + float Alpha_h; + float Alpha_c; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + struct LCRTt Tt_heat; + struct LCRTt Tt_cool; + float k_h_intern; + float k_c_intern; + struct LCRPT2 PT2; + float y_c; + float y_end; + float y_h; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRSimModExt_typ; + +typedef struct LCRPT1e +{ + /* VAR_INPUT (analog) */ + float V; + float T1; + float x; + float y_set; + unsigned char set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT1e_typ; + +typedef struct LCRDblActPID +{ + /* VAR_INPUT (analog) */ + float W; + float X; + float Y_man; + unsigned char mode; + struct lcrdblpid_par_typ* pPar1; + struct lcrdblpid_par_typ* pPar2; + struct lcrpid_tune_addpar_typ* pAddPar; + struct lcrdblpid_tune_typ* pOpt; + /* VAR_OUTPUT (analog) */ + float e; + float Y1; + float Y2; + unsigned short status; + unsigned char tuneState; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDTune tune; + struct SysInfo sysinfo_inst; + float gradient; + float Y_avg; + unsigned long tcnt_1; + unsigned long tcnt_2; + float Tmeas; + float y_lim_old; + float p_fact; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + unsigned char use_par; + unsigned char meas; + unsigned char mode_old; + unsigned char tune_step; + unsigned char tune_grad; + unsigned char tune_2nd; + unsigned char invert; + unsigned char counter_state; + unsigned char mode_int; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit hold_I; + plcbit okToStep; + /* VAR_OUTPUT (digital) */ + plcbit rdyToStep; + /* VAR (digital) */ + plcbit enable_old; +} LCRDblActPID_typ; + +typedef struct LCRMinMax +{ + /* VAR_INPUT (analog) */ + float in; + /* VAR_OUTPUT (analog) */ + float out_min; + float out_max; + /* VAR_INPUT (digital) */ + plcbit reset; +} LCRMinMax_typ; + +typedef struct LCRTempPID +{ + /* VAR_INPUT (analog) */ + float Temp_set; + float Temp; + float Y_man; + unsigned long mode; + struct lcrtemp_set_typ* pSettings; + /* VAR_OUTPUT (analog) */ + float y_heat; + float y_cool; + unsigned short status; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDpara pid_para; + float Temp_set_delay; + float Temp_set_int; + float TempSetOld; + float delayCnt; + signed char stateOld; + signed char state; + float a; + struct SysInfo sysinfo_inst; + unsigned char para_check_done; + struct lcrtemp_pid_internal_typ internal_para; + float dbl_dt; + float tAlt; + float altTime; + float tKnick; + float fAlt; + float a_alt; + float a_e; + float a_internal; + float Temp_set_int_old1; + float Temp_set_int_old2; + float Temp_set_int_old3; + unsigned long mode_old; + unsigned long timestore1; + unsigned long timestore2; + float yManInternal; + unsigned long timeCnt; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit update; + /* VAR (digital) */ + plcbit delayFlag; + plcbit enable_old; + plcbit altActive; + plcbit err_flag; +} LCRTempPID_typ; + +typedef struct LCRPT2o +{ + /* VAR_INPUT (analog) */ + float V; + float D; + float Tf; + float u; + unsigned char Set_y; + float y_set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + struct lcrpt2o_Internal_typ Internal; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT2o_typ; + +typedef struct LCRTempTune +{ + /* VAR_INPUT (analog) */ + float Temp_set; + float Temp; + struct lcrtemp_set_typ* pSettings; + /* VAR_OUTPUT (analog) */ + float y_heat; + float y_cool; + unsigned short status; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDpara pid_para; + struct LCRDifferentiate DT2; + struct LCRPT2o pt2; + float Temp_flt; + unsigned short step; + float t; + float Temp_start; + float mem00; + float cnt02; + float cnt33; + float cnt20; + float pem01; + float pem33; + float pem10; + float pem02; + float pem44; + float pem20; + float tol01; + float tol10; + float tol02; + float tol20; + float tol22; + float Temp_old; + float delta_Temp; + unsigned long tcnt_1; + unsigned long tcnt_2; + unsigned long tcnt_dT_1; + unsigned long tcnt_dT_2; + struct SysInfo sysinfo_inst; + float Temp_set_internal; + float timecounter; + struct lcrtemp_tune_internal_typ internal_para; + float dbl_dt; + unsigned long call_counter; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + float timer2; + unsigned short waitCounter; + float Y_heat_tune_intern; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit start; + plcbit okToHeat; + plcbit okToFree; + plcbit okToFreeEnd; + plcbit okToCool; + plcbit okToCoolEnd; + /* VAR_OUTPUT (digital) */ + plcbit rdyToHeat; + plcbit rdyToFree; + plcbit rdyToFreeEnd; + plcbit rdyToCool; + plcbit rdyToCoolEnd; + plcbit done; + plcbit busy; + /* VAR (digital) */ + plcbit enable_old; +} LCRTempTune_typ; + +typedef struct LCRSchedulePWM +{ + /* VAR_INPUT (analog) */ + float Pmax; + unsigned short n; + unsigned long pPar; + float min_value; + float max_value; + float t_min_pulse; + float t_period; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR (analog) */ + struct SysInfo sysinfo_inst; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short numberUnits; + unsigned short limFact; + float Pact; + float Pman; + float intern0[6]; + struct lcrschedule_par_typ* in; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; + plcbit cmd_delay; + plcbit err_flag; + plcbit limAll; +} LCRSchedulePWM_typ; + + + +/* Prototyping of functions and function blocks */ +_BUR_PUBLIC void LCRPID(struct LCRPID* inst); +_BUR_PUBLIC void LCRScal(struct LCRScal* inst); +_BUR_PUBLIC void LCRCurveByPoints(struct LCRCurveByPoints* inst); +_BUR_PUBLIC void LCRPIDpara(struct LCRPIDpara* inst); +_BUR_PUBLIC void LCRContinServo(struct LCRContinServo* inst); +_BUR_PUBLIC void LCRPT1(struct LCRPT1* inst); +_BUR_PUBLIC void LCRRamp(struct LCRRamp* inst); +_BUR_PUBLIC void LCRIntegrate(struct LCRIntegrate* inst); +_BUR_PUBLIC void LCRLimit(struct LCRLimit* inst); +_BUR_PUBLIC void LCRLimScal(struct LCRLimScal* inst); +_BUR_PUBLIC void LCRPWM(struct LCRPWM* inst); +_BUR_PUBLIC void LCRMovAvgFlt(struct LCRMovAvgFlt* inst); +_BUR_PUBLIC void LCRTimeBasedOnOff(struct LCRTimeBasedOnOff* inst); +_BUR_PUBLIC void LCRDifferentiate(struct LCRDifferentiate* inst); +_BUR_PUBLIC void LCRSlimPID(struct LCRSlimPID* inst); +_BUR_PUBLIC void LCRPIDTune(struct LCRPIDTune* inst); +_BUR_PUBLIC void LCRPFM(struct LCRPFM* inst); +_BUR_PUBLIC void LCRSimModExt(struct LCRSimModExt* inst); +_BUR_PUBLIC void LCRTt(struct LCRTt* inst); +_BUR_PUBLIC void LCRPT2(struct LCRPT2* inst); +_BUR_PUBLIC void LCRPT1e(struct LCRPT1e* inst); +_BUR_PUBLIC void LCRDblActPID(struct LCRDblActPID* inst); +_BUR_PUBLIC void LCRMinMax(struct LCRMinMax* inst); +_BUR_PUBLIC void LCRTempPID(struct LCRTempPID* inst); +_BUR_PUBLIC void LCRTempTune(struct LCRTempTune* inst); +_BUR_PUBLIC void LCRPT2o(struct LCRPT2o* inst); +_BUR_PUBLIC void LCRSchedulePWM(struct LCRSchedulePWM* inst); + + +#ifdef __cplusplus +}; +#endif +#endif /* _LOOPCONR_ */ + diff --git a/Logical/Libraries/LoopConR/SG4/libLoopConR.a b/Logical/Libraries/LoopConR/SG4/libLoopConR.a new file mode 100644 index 0000000..20ece35 Binary files /dev/null and b/Logical/Libraries/LoopConR/SG4/libLoopConR.a differ diff --git a/Logical/Libraries/LoopConR/SGC/LoopConR.h b/Logical/Libraries/LoopConR/SGC/LoopConR.h new file mode 100644 index 0000000..e88fcf4 --- /dev/null +++ b/Logical/Libraries/LoopConR/SGC/LoopConR.h @@ -0,0 +1,1677 @@ +/* Automation Studio generated header file */ +/* Do not edit ! */ +/* LoopConR 4.10.2 */ + +#ifndef _LOOPCONR_ +#define _LOOPCONR_ +#ifdef __cplusplus +extern "C" +{ +#endif +#ifndef _LoopConR_VERSION +#define _LoopConR_VERSION 4.10.2 +#endif + +#include + +#ifndef _BUR_PUBLIC +#define _BUR_PUBLIC +#endif +#ifdef _SG4 + #include "sys_lib.h" + #include "brsystem.h" +#endif +#ifdef _SG3 + #include "sys_lib.h" + #include "brsystem.h" +#endif +#ifdef _SGC + #include "sys_lib.h" + #include "brsystem.h" +#endif + +/* Constants */ +#ifdef _REPLACE_CONST + #define LCRPID_TUNE_REQU_PER_5 500000U + #define LCRSLIMPID_REQU_PER_5 500000U + #define LCRSLIMPID_REQU_PER_4 400000U + #define LCRPID_TUNE_REQU_PER_4 400000U + #define LCRPID_TUNE_REQU_PER_3 300000U + #define LCRSLIMPID_REQU_PER_3 300000U + #define LCRTEMP_STEP_ERROR 65535U + #define LCR_ERR_DISABLED 65534U + #define LCR_ERR_PT2O_TF_NEG_ZERO 33154U + #define LCR_ERR_PT2O_D_NEG 33153U + #define LCR_ERR_LCRTEMPTune_DT_IGNORED 33152U + #define LCR_ERR_LCRTEMPPID_INVALID_MODE 33151U + #define LCR_ERR_LCRTEMPTune_INVALID_MODE 33150U + #define LCR_WARN_PT2O_TF_TS 33102U + #define LCR_WARN_LCRTEMPTune_ASYNC 33101U + #define LCR_WARN_LCRTEMPTune_DT_HIGH 33100U + #define LCR_ERR_SCHEDULE_N 31574U + #define LCR_ERR_SCHEDULE_P 31573U + #define LCR_ERR_LCRTEMPPID_NO_TALT 31572U + #define LCR_ERR_LCRTEMPPID_TKNICK 31571U + #define LCR_ERR_LCRTEMPTune_TASKTIME_0 31570U + #define LCR_ERR_LCRTEMPPID_ILLEGALMODE 31569U + #define LCR_ERR_LCRTEMPPID_WR_PTR 31568U + #define LCR_ERR_LCRTEMPPID_WR_PARA 31567U + #define LCR_ERR_LCRTEMPTune_WR_TSET 31567U + #define LCR_ERR_LCRTEMPTune_WR_PTR 31566U + #define LCR_ERR_LCRPIDTune_MAXMIN 31564U + #define LCR_ERR_POINTER 31563U + #define LCR_ERR_LCRDBLPID_DX_DT 31562U + #define LCR_ERR_LCRDBLPID_WX_LOW 31561U + #define LCR_ERR_LCRPIDTune_CONTROL_VAR 31560U + #define LCR_ERR_LCRPIDTune_INVALID_REQU 31559U + #define LCR_ERR_LCRPID_PAR_FBKMODE 31558U + #define LCR_ERR_LCRPID_PAR_DYMAX 31557U + #define LCR_ERR_LCRPID_PAR_DMODE 31556U + #define LCR_ERR_LCRPID_PARADAT 31554U + #define LCR_ERR_LCRPID_MODE 31553U + #define LCR_ERR_LCRPID_IDENT 31552U + #define LCR_ERR_LCRMovAvgFlt_BASE 31551U + #define LCR_ERR_LCRIntegrate_TN 31550U + #define LCRPID_TUNE_REQU_OSC_3 30000U + #define LCRSLIMPID_REQU_OSC_3 30000U + #define LCRPID_TUNE_REQU_OSC_2 20000U + #define LCRSLIMPID_REQU_OSC_2 20000U + #define LCR_ERR_LCRTT_TT_NEG 12048U + #define LCR_ERR_LCRPT12_T2_NEG 12047U + #define LCR_ERR_LCRPT12_T1_NEG 12046U + #define LCR_ERR_LCRCurveByPoints_TABLE 12045U + #define LCR_ERR_LCRPID_PAR_DEADBAND 12044U + #define LCR_ERR_LCRPID_PAR_WX_MAXMIN 12043U + #define LCR_ERR_LCRPID_PAR_DEADBAND_MODE 12042U + #define LCR_ERR_LCRPIDTune_W_CHANGED 12041U + #define LCR_ERR_LCRPIDTune_TIMEOUT 12040U + #define LCR_ERR_LCRPIDTune_PARAMETER 12039U + #define LCR_ERR_LCRPIDTune_ABORT 12038U + #define LCR_ERR_MAXMIN 12037U + #define LCR_ERR_LCRContinServo_TIMPULSE 12036U + #define LCR_ERR_LCRContinServo_TCHANGE 12035U + #define LCR_ERR_LCRRamp_DYUP_DYDOWN 12034U + #define LCR_ERR_LCRPWM_TPERIOD 12033U + #define LCR_ERR_LCRPWM_TPULSE 12033U + #define LCR_ERR_LCRPWM_TMINPULSE 12032U + #define LCR_ERR_LCRPT1_T 12031U + #define LCR_ERR_LCRPID_PAR_TV 12030U + #define LCR_ERR_LCRPID_PAR_TN 12029U + #define LCR_ERR_LCRPID_PAR_TF 12028U + #define LCR_ERR_LCRPID_PAR_KW 12027U + #define LCR_ERR_LCRPID_PAR_KP 12026U + #define LCR_ERROR 12025U + #define LCR_ERR_LCRPID_PAR_KFBK 12025U + #define LCR_WARN_LCRTEMPPID_WR_PARA 12024U + #define LCR_WARN_LCRTEMPTune_WR_BASE 12023U + #define LCR_WARN_LCRTEMPTune_WR_PARA 12022U + #define LCR_WARN_LCRTEMPTune_HEAT_TP 12021U + #define LCR_WARN_LCRDBLPID_TUNE_CHANGE 12019U + #define LCR_WARN_LCRTT_MEM 12018U + #define LCR_WARN_LCRTT_TT_INT 12017U + #define LCR_WARN_LCRTT_TT_TS 12016U + #define LCR_WARN_LCRTT_TT_ZERO 12015U + #define LCR_WARN_LCRPT12_T2_INT 12014U + #define LCR_WARN_LCRPT12_T2_TS 12013U + #define LCR_WARN_LCRPT12_T2_ZERO 12012U + #define LCR_WARN_LCRPT12_T1_INT 12011U + #define LCR_WARN_LCRPT12_T1_TS 12010U + #define LCR_WARN_LCRPID_YMAN_LIMIT 12009U + #define LCR_WARN_LCRPID_A_LIMIT 12008U + #define LCR_WARN_Tx_DT 12007U + #define LCR_WARN_LCRPT12_T1_ZERO 12005U + #define LCR_WARN_LCRPIDTune_CYCLETIME 12004U + #define LCR_WARN_LCRPID_YFBK_LIMIT 12003U + #define LCR_WARN_LCRPID_I_MINLIMIT 12002U + #define LCR_WARN_LCRPID_I_MAXLIMIT 12001U + #define LCRSLIMPID_REQU_OSC_1 10000U + #define LCRPID_TUNE_REQU_OSC_1 10000U + #define LCRSLIMPID_REQU_CHR_REF_OS 5000U + #define LCRPID_TUNE_REQU_CHR_REF_OS 5000U + #define LCRSLIMPID_REQU_CHR_REF_AP 4000U + #define LCRPID_TUNE_REQU_CHR_REF_AP 4000U + #define LCRPID_TUNE_REQU_ZN_DIST 3000U + #define LCRSLIMPID_REQU_ZN_DIST 3000U + #define LCRPID_TUNE_REQU_CHR_DIST_OS 2000U + #define LCRSLIMPID_REQU_CHR_DIST_OS 2000U + #define LCRPID_TUNE_REQU_CHR_DIST_AP 1000U + #define LCRSLIMPID_REQU_CHR_DIST_AP 1000U + #define LCRSLIMPID_REQU_P 300U + #define LCRPID_TUNE_REQU_P 300U + #define LCRSLIMPID_REQU_PI 200U + #define LCRPID_TUNE_REQU_PI 200U + #define LCRTEMP_STEP_DONE 130U + #define LCRTEMP_STEP_PID_DONE 125U + #define LCRTEMP_STEP_PID_DONE_COOLONLY 122U + #define LCRTEMP_STEP_COOL 120U + #define LCRPID_TUNE_ADDINFO_OSC_PERIOD 111U + #define LCRTEMP_STEP_START_COOL 110U + #define LCRTEMP_STEP_WAIT_COOLONLY 105U + #define LCRPID_MODE_FREEZE_JOLTFREE 105U + #define LCRPID_MODE_CLOSE_JOLTFREE 104U + #define LCRPID_MODE_OPEN_JOLTFREE 103U + #define LCRPID_MODE_MAN_JOLTFREE 102U + #define LCRTEMP_STEP_WAIT_COOL 100U + #define LCRPID_TUNE_REQU_PID 100U + #define LCRSLIMPID_REQU_PID 100U + #define LCRTEMP_STEP_PID_COOL 90U + #define LCRTEMP_STEP_PID 80U + #define LCRTEMP_STEP_FREE 70U + #define LCRTEMP_STEP_START_FREE 60U + #define LCRTEMP_STEP_WAIT_FREE 50U + #define LCRPID_TUNE_STATE_FINISHED 50U + #define LCRPID_TUNE_STATE_RESET_CNTL 49U + #define LCRPID_TUNE_STATE_CALC_PARA 45U + #define LCRTEMP_STEP_PID_FREE 40U + #define LCRTEMP_STEP_HEAT 30U + #define LCRPID_TUNE_STATE_STEP_WAITEQ2 22U + #define LCRPID_TUNE_STATE_STEP_MAXGRAD 21U + #define LCRSLIMPID_REQU_DIR_NEG 20U + #define LCRTEMP_STEP_START_HEAT 20U + #define LCRPID_TUNE_STATE_STEP_WAITEQ1 20U + #define LCRPID_TUNE_REQU_DIR_NEG 20U + #define LCRPID_TUNE_STATE_OSC_CNTLPAR 19U + #define LCRPID_TUNE_STATE_OSC_PERFORM_2 13U + #define LCRPID_TUNE_STATE_OSC_PERFORM_1 12U + #define LCRPID_TUNE_STATE_OSC_SEQ_CNTL 11U + #define LCRTEMP_STEP_WAIT_HEAT 10U + #define LCRSLIMPID_REQU_DIR_POS 10U + #define LCRPID_TUNE_STATE_OSCILLATE 10U + #define LCRPID_TUNE_REQU_DIR_POS 10U + #define LCRDBLPID_MODE_TUNE_Y2 9U + #define LCRDBLPID_MODE_TUNE_Y1 8U + #define LCRDBLPID_MODE_TUNE_6 7U + #define LCRDBLPID_MODE_TUNE_4 6U + #define LCRPID_FBK_MODE_SET_YI 5U + #define LCRPID_MODE_FREEZE 5U + #define LCRTEMP_STEP_WAIT 5U + #define LCRSLIMPID_REQU_WRITE_PARAS 4U + #define LCRPID_MODE_CLOSE 4U + #define LCRPID_FBK_MODE_LIMIT_YI 4U + #define LCRDBLPID_TSTATE_ERROR 4U + #define LCRPID_FBK_MODE_EXT_SELECTOR 3U + #define LCRSLIMPID_REQU_READ_PARAS 3U + #define LCRDBLPID_TSTATE_FINISHED 3U + #define LCRPID_MODE_OPEN 3U + #define LCRPID_TUNE_REQU_STEPRESPONSE 2U + #define LCRPID_FBK_MODE_EXTERN 2U + #define LCRPID_MODE_MAN 2U + #define LCRSLIMPID_REQU_STEPRESPONSE 2U + #define LCRPID_D_MODE_E 2U + #define LCRDBLPID_TSTATE_Y2 2U + #define LCRTEMPPID_MODE_MAN 2U + #define LCRPID_DEADBAND_MODE_STANDARD_I 2U + #define LCRSLIMPID_REQU_OSCILLATE 1U + #define LCRTEMP_COOL 1U + #define LCRTEMP_PT2 1U + #define LCRTEMP_HYST_MODE_JOLTFREE 1U + #define LCRTEMPPID_MODE_AUTO 1U + #define LCRPID_TUNE_REQU_OSCILLATE 1U + #define LCRDBLPID_TSTATE_Y1 1U + #define LCRPID_FBK_MODE_INTERN 1U + #define LCRPID_DEADBAND_MODE_STANDARD 1U + #define LCRPID_D_MODE_X 1U + #define LCRPID_MODE_AUTO 1U + #define LCRTEMPTune_MODE_EXP 1U + #define LCRPID_TUNE_REQU_OFF 0U + #define LCRDBLPID_TSTATE_OFF 0U + #define LCRTEMPTune_MODE_DEF 0U + #define LCRTEMP_PT1 0U + #define LCRSLIMPID_REQU_OFF 0U + #define LCRPID_TUNE_STATE_READY 0U + #define LCRPID_MODE_OFF 0U + #define LCRTEMP_HEAT 0U + #define LCRPID_DEADBAND_MODE_ZERO 0U +#else + #ifndef _GLOBAL_CONST + #define _GLOBAL_CONST _WEAK const + #endif + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_5; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_5; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_4; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_4; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PER_3; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PER_3; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_ERROR; + _GLOBAL_CONST unsigned short LCR_ERR_DISABLED; + _GLOBAL_CONST unsigned short LCR_ERR_PT2O_TF_NEG_ZERO; + _GLOBAL_CONST unsigned short LCR_ERR_PT2O_D_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_DT_IGNORED; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_INVALID_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_INVALID_MODE; + _GLOBAL_CONST unsigned short LCR_WARN_PT2O_TF_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_ASYNC; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_DT_HIGH; + _GLOBAL_CONST unsigned short LCR_ERR_SCHEDULE_N; + _GLOBAL_CONST unsigned short LCR_ERR_SCHEDULE_P; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_NO_TALT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_TKNICK; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_TASKTIME_0; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_ILLEGALMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_WR_PTR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPPID_WR_PARA; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_WR_TSET; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTEMPTune_WR_PTR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_POINTER; + _GLOBAL_CONST unsigned short LCR_ERR_LCRDBLPID_DX_DT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRDBLPID_WX_LOW; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_CONTROL_VAR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_INVALID_REQU; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_FBKMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DYMAX; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DMODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PARADAT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_IDENT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRMovAvgFlt_BASE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRIntegrate_TN; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_3; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_3; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_2; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_2; + _GLOBAL_CONST unsigned short LCR_ERR_LCRTT_TT_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT12_T2_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT12_T1_NEG; + _GLOBAL_CONST unsigned short LCR_ERR_LCRCurveByPoints_TABLE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DEADBAND; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_WX_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_DEADBAND_MODE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_W_CHANGED; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_TIMEOUT; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_PARAMETER; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPIDTune_ABORT; + _GLOBAL_CONST unsigned short LCR_ERR_MAXMIN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRContinServo_TIMPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRContinServo_TCHANGE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRRamp_DYUP_DYDOWN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TPERIOD; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPWM_TMINPULSE; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPT1_T; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TV; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TN; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_TF; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KW; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KP; + _GLOBAL_CONST unsigned short LCR_ERROR; + _GLOBAL_CONST unsigned short LCR_ERR_LCRPID_PAR_KFBK; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPPID_WR_PARA; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_WR_BASE; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_WR_PARA; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTEMPTune_HEAT_TP; + _GLOBAL_CONST unsigned short LCR_WARN_LCRDBLPID_TUNE_CHANGE; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_MEM; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRTT_TT_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T2_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_INT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_TS; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_YMAN_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_A_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_Tx_DT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPT12_T1_ZERO; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPIDTune_CYCLETIME; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_YFBK_LIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_I_MINLIMIT; + _GLOBAL_CONST unsigned short LCR_WARN_LCRPID_I_MAXLIMIT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSC_1; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSC_1; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_REF_OS; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_REF_OS; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_REF_AP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_REF_AP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_ZN_DIST; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_ZN_DIST; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_DIST_OS; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_DIST_OS; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_CHR_DIST_AP; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_CHR_DIST_AP; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_P; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_P; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PI; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PI; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_DONE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_DONE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_DONE_COOLONLY; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_COOL; + _GLOBAL_CONST unsigned short LCRPID_TUNE_ADDINFO_OSC_PERIOD; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_COOL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_COOLONLY; + _GLOBAL_CONST unsigned char LCRPID_MODE_FREEZE_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_CLOSE_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_OPEN_JOLTFREE; + _GLOBAL_CONST unsigned char LCRPID_MODE_MAN_JOLTFREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_COOL; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_PID; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_PID; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_COOL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_FREE; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_FINISHED; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_RESET_CNTL; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_CALC_PARA; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_PID_FREE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_HEAT; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_WAITEQ2; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_MAXGRAD; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_DIR_NEG; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_START_HEAT; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_STEP_WAITEQ1; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_DIR_NEG; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_CNTLPAR; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_PERFORM_2; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_PERFORM_1; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSC_SEQ_CNTL; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT_HEAT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_DIR_POS; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_OSCILLATE; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_DIR_POS; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_Y2; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_Y1; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_6; + _GLOBAL_CONST unsigned char LCRDBLPID_MODE_TUNE_4; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_SET_YI; + _GLOBAL_CONST unsigned char LCRPID_MODE_FREEZE; + _GLOBAL_CONST unsigned short LCRTEMP_STEP_WAIT; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_WRITE_PARAS; + _GLOBAL_CONST unsigned char LCRPID_MODE_CLOSE; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_LIMIT_YI; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_ERROR; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_EXT_SELECTOR; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_READ_PARAS; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_FINISHED; + _GLOBAL_CONST unsigned char LCRPID_MODE_OPEN; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_STEPRESPONSE; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_EXTERN; + _GLOBAL_CONST unsigned char LCRPID_MODE_MAN; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_STEPRESPONSE; + _GLOBAL_CONST unsigned char LCRPID_D_MODE_E; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_Y2; + _GLOBAL_CONST unsigned long LCRTEMPPID_MODE_MAN; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_STANDARD_I; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OSCILLATE; + _GLOBAL_CONST unsigned char LCRTEMP_COOL; + _GLOBAL_CONST unsigned char LCRTEMP_PT2; + _GLOBAL_CONST unsigned char LCRTEMP_HYST_MODE_JOLTFREE; + _GLOBAL_CONST unsigned long LCRTEMPPID_MODE_AUTO; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OSCILLATE; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_Y1; + _GLOBAL_CONST unsigned char LCRPID_FBK_MODE_INTERN; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_STANDARD; + _GLOBAL_CONST unsigned char LCRPID_D_MODE_X; + _GLOBAL_CONST unsigned char LCRPID_MODE_AUTO; + _GLOBAL_CONST unsigned long LCRTEMPTune_MODE_EXP; + _GLOBAL_CONST unsigned long LCRPID_TUNE_REQU_OFF; + _GLOBAL_CONST unsigned char LCRDBLPID_TSTATE_OFF; + _GLOBAL_CONST unsigned long LCRTEMPTune_MODE_DEF; + _GLOBAL_CONST unsigned char LCRTEMP_PT1; + _GLOBAL_CONST unsigned long LCRSLIMPID_REQU_OFF; + _GLOBAL_CONST unsigned short LCRPID_TUNE_STATE_READY; + _GLOBAL_CONST unsigned char LCRPID_MODE_OFF; + _GLOBAL_CONST unsigned char LCRTEMP_HEAT; + _GLOBAL_CONST unsigned char LCRPID_DEADBAND_MODE_ZERO; +#endif + + + + +/* Datatypes and datatypes of function blocks */ +typedef struct lcrCurveByPoints_TabEntry_type +{ float x; + float y; +} lcrCurveByPoints_TabEntry_type; + +typedef struct lcrdblpid_par_typ +{ float Y_max; + float Y_min; + signed short K_fact; + float Kp; + float Tn; + float Tv; +} lcrdblpid_par_typ; + +typedef struct lcrpid_tune_osc_options_typ +{ float osc_minAmplitude; + float Q_min; +} lcrpid_tune_osc_options_typ; + +typedef struct lcrpid_tune_step_options_typ +{ float eqDeltaX; + float eqDeltaWX; + float eqDeltat; + float evalDeltaX; + unsigned short evalNfilter; + unsigned short exitNotMaxdXCount; + float exitdXRatio; +} lcrpid_tune_step_options_typ; + +typedef struct lcrdblpid_tune_typ +{ signed short P1_manualAdjust; + signed short I1_manualAdjust; + signed short D1_manualAdjust; + signed short P2_manualAdjust; + signed short I2_manualAdjust; + signed short D2_manualAdjust; + float X_min; + float X_max; + float X0; + float de_min; + float Y0; + float Y1step; + float Y2step; + unsigned long tuneY1_opt; + unsigned long tuneY2_opt; + unsigned char tune_first; + float hyst; + float measDelta; + struct lcrpid_tune_osc_options_typ osc_opt; + struct lcrpid_tune_step_options_typ step_opt; +} lcrdblpid_tune_typ; + +typedef struct lcrpid_internal_typ +{ unsigned short size; + plcbit valid; + float WX_max; + float WX_min; + plcbit invert; + float deadband; + unsigned char deadband_mode; + float dY_max; + float Kp; + float Kp_Tn; + float Tv_Tf; + float Tf_reciproc; + float Kw; + float Kfbk_Kp; + float Kfbk_Kp_max; + unsigned char fbk_mode; + unsigned char d_mode; + unsigned char force_mode; + float Y_force; + float W; + float X; + unsigned char pid_init; + signed long Yp1; + signed long Yp2; + signed long dYi1; + signed long dYi2; + signed long Yi1; + signed long Yi2; + float dt_Tf; + signed long a11; + signed long a12; + signed long a21; + signed long a22; + signed long Yd1; + signed long Yd2; + signed long Ytotal1; + signed long Ytotal2; + signed long Ylim1; + signed long Ylim2; + signed long Y1; + signed long Y2; + float deltaY_fbk; + float e_fbk; +} lcrpid_internal_typ; + +typedef struct lcrpid_procPar_typ +{ unsigned short size; + plcbit valid; + plcbit stepResp_valid; + float stepResp_v; + float stepResp_t_u; + float stepResp_t_g; + plcbit osc_valid; + float osc_amplitudeRatio; + float osc_tPeriod; + plcbit force_params; + float Kp; + float Kp_tune; + float Tn; + float Tn_tune; + float Tv; + float Tv_tune; +} lcrpid_procPar_typ; + +typedef struct lcrpid_old_typ +{ struct lcrpid_procPar_typ processPar; + signed short P_manualAdjust; + signed short I_manualAdjust; + signed short D_manualAdjust; + float Y_min; + float Y_max; + float dY_max; + float Tf_Tv; + float Kw; + float Kfbk; + float deadband; + float W; + unsigned long request; + unsigned char fbk_mode; + unsigned char d_mode; + plcbit invert; + plcbit enable; +} lcrpid_old_typ; + +typedef struct lcrpid_osc_val_typ +{ float X; + float t; +} lcrpid_osc_val_typ; + +typedef struct lcrpid_osc_per_typ +{ struct lcrpid_osc_val_typ max; + struct lcrpid_osc_val_typ min; +} lcrpid_osc_per_typ; + +typedef struct lcrpid_tune_addpar_typ +{ float t_max_tune; + float WX_min; + float WX_max; + float dY_max; + float Tf_Tv; + float Kw; + float Kfbk; + unsigned char fbk_mode; + unsigned char d_mode; + float deadband; + unsigned char deadband_mode; + plcbit invert; +} lcrpid_tune_addpar_typ; + +typedef struct lcrpid_tune_osc_typ +{ struct lcrpid_tune_osc_options_typ options; + unsigned short oscPhase; + signed char dir; + plcbit enHi; + plcbit enLo; + float Y_hi; + float Y_lo; + unsigned short i_maxPeriod; + unsigned short i_period; + float X_ampl; + float X_avg; + float X_min_avg; + float X_max_avg; + float Y_avg; + float deltaY; + float t_Ylohi[5]; + float t_Yhilo[5]; + float Q_act; + float a_wx; + float amplitudeRatio; + float Ku; + float tPeriod; + struct lcrpid_osc_per_typ period[5]; +} lcrpid_tune_osc_typ; + +typedef struct lcrpid_tune_step_typ +{ struct lcrpid_tune_step_options_typ options; + float Y0; + float Y1; + float t_jump; + float W; + float X0; + float Xmax; + float Xmin; + float Xfiltered; + plcbit deltaXok; + plcbit deltaWXok; + float eqTime; + signed char dir; + float deltaX; + float X1; + float t1; + plcbit t1set; + float dX_dt; + float dX_dt_max; + float XmaxGrad; + float maxX1; + float maxX2; + float maxt1; + float maxt2; + float tmaxGrad; + float gainFactor; + float deadTime; + float riseTime; + unsigned short notMaxCount; + float gradientRatio; +} lcrpid_tune_step_typ; + +typedef struct lcrpt2o_Internal_typ +{ signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + float V_old; + float D_old; + float Tf_old; + unsigned char Set_y_old; + unsigned char Set_y_2; + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + unsigned long x2_dbl_1; + unsigned long x2_dbl_2; + unsigned long Sqrt_D_1_dbl_1; + unsigned long Sqrt_D_1_dbl_2; + unsigned long Ts_Tf_dbl_1; + unsigned long Ts_Tf_dbl_2; + unsigned long Exp_D_Ts_Tf_dbl_1; + unsigned long Exp_D_Ts_Tf_dbl_2; + unsigned long a0_dbl_1; + unsigned long a0_dbl_2; + unsigned long a1_dbl_1; + unsigned long a1_dbl_2; + unsigned long b0_dbl_1; + unsigned long b0_dbl_2; + unsigned long b1_dbl_1; + unsigned long b1_dbl_2; + unsigned long Bootkey; +} lcrpt2o_Internal_typ; + +typedef struct LCRPWM +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_min_pulse; + float t_period; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float t_on; + float t_off; + /* VAR (analog) */ + signed long cnt_terron_1; + signed long cnt_terron_2; + signed long cnt_terroff_1; + signed long cnt_terroff_2; + signed long cnt_t_pulse_1; + signed long cnt_t_pulse_2; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR_OUTPUT (digital) */ + plcbit pulse; + /* VAR (digital) */ + plcbit corr; +} LCRPWM_typ; + +typedef struct lcrschedule_add_typ +{ float periodTime; + float onTime; + float t_on_intern; + float bcOnTime; + unsigned short sortIndex; + struct LCRPWM fbkPWM; + plcbit flagDelay; +} lcrschedule_add_typ; + +typedef struct lcrschedule_par_typ +{ float P; + float X; + plcbit pulse; + float Pout; + plcbit lim; + struct lcrschedule_add_typ Internal; +} lcrschedule_par_typ; + +typedef struct lcrslimpid_par_typ +{ float Y_max; + float Y_min; + float Kp; + float Tn; + float Tv; + float Kfbk; +} lcrslimpid_par_typ; + +typedef struct lcrtemp_add_typ +{ float mem01; + float mem02; + float mem10; + float mem20; + float exp_mem; + float cnt01; + float cnt02; + float cnt10; + float cnt20; + float cnt03; + float cnt30; + float cnt00; + float t_ignore_dT_heat; + float t_ignore_dT_free; + float t_ignore_dT_cool; + float yMin; + float yMax; + unsigned long reserved3; + unsigned long reserved4; + plcbit reserved5; + plcbit reserved6; +} lcrtemp_add_typ; + +typedef struct lcrtemp_pid_internal_typ +{ plcbit enable_cooling; + plcbit disable_heating; + float hyst; + float delay; + float Kw; + float Kfbk; + float Kp_h; + float Tn_h; + float Tv_h; + float Kp_c; + float Tn_c; + float Tv_c; + float dynGeneral; + float dynHeat; + float dynCool; + float mem01; + float mem02; + float mem10; + float mem20; + float exp_mem; + float yMin; + float yMax; +} lcrtemp_pid_internal_typ; + +typedef struct lcrtemp_pid_opt_typ +{ float Kp_h; + float Tn_h; + float Tv_h; + float Tf_h; + float Kp_c; + float Tn_c; + float Tv_c; + float Tf_c; + float dynGeneral; + float dynHeat; + float dynCool; +} lcrtemp_pid_opt_typ; + +typedef struct lcrtemp_pid_set_typ +{ float hyst; + unsigned char hyst_mode; + float delay; + float Kw; + float Kfbk; +} lcrtemp_pid_set_typ; + +typedef struct lcrtemp_tune_set_typ +{ unsigned long mode; + float Temp_amb; + float dRatio_heat; + float cnt_tp_heat; + float delta_T_heat; + float dT_min_heat; + float dRatio_free; + float cnt_tp_free; + float delta_T_free; + float dT_min_free; + float dRatio_cool; + float cnt_tp_cool; + float delta_T_cool; + float dT_min_cool; + float delta_T_sync_heat; + float delta_dT_sync_heat; + float cnt_wait_heat; + float delta_T_sync_free; + float delta_dT_sync_free; + float cnt_wait_free; + float delta_T_sync_cool; + float delta_dT_sync_cool; + float cnt_wait_cool; + float filter_base_T; + float delta_T_sync_stop; + float Y_heat_tune; +} lcrtemp_tune_set_typ; + +typedef struct lcrtemp_set_typ +{ plcbit enable_cooling; + plcbit disable_heating; + struct lcrtemp_pid_opt_typ PIDpara; + struct lcrtemp_tune_set_typ TuneSet; + struct lcrtemp_pid_set_typ PIDSet; + struct lcrtemp_add_typ Internal; +} lcrtemp_set_typ; + +typedef struct lcrtemp_tune_internal_typ +{ plcbit cool_tuning; + plcbit disable_heating; + unsigned long mode; + float Temp_amb; + float dRatio_heat; + float cnt_tp_heat; + float delta_T_heat; + float dT_min_heat; + float dRatio_free; + float cnt_tp_free; + float delta_T_free; + float dT_min_free; + float dRatio_cool; + float cnt_tp_cool; + float delta_T_cool; + float dT_min_cool; + float delta_T_sync_heat; + float delta_dT_sync_heat; + float cnt_wait_heat; + float delta_T_sync_free; + float delta_dT_sync_free; + float cnt_wait_free; + float delta_T_sync_cool; + float delta_dT_sync_cool; + float cnt_wait_cool; + float filter_base_T; + float t_ignore_dT_heat; + float t_ignore_dT_free; + float t_ignore_dT_cool; + float delta_T_sync_stop; +} lcrtemp_tune_internal_typ; + +typedef struct LCRScal +{ + /* VAR_INPUT (analog) */ + float x; + float x1; + float y1; + float x2; + float y2; + /* VAR_OUTPUT (analog) */ + float y; +} LCRScal_typ; + +typedef struct LCRPID +{ + /* VAR_INPUT (analog) */ + unsigned long ident; + float W; + float X; + float Y_max; + float Y_min; + float A; + float Y_man; + float Y_fbk; + unsigned char mode; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float e; + float Y; + float Yp; + float Yi; + float Yd; + /* VAR (analog) */ + float Yi_set; + float Yi_min; + float Yi_max; + float Yi_minInternal; + float Yi_maxInternal; + float Tv_Tf_old; + float e_old; + unsigned short deadband_state; + struct SysInfo sysinfo_inst; + struct LCRScal scal_inst; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short musecs_old; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit hold_I; + /* VAR (digital) */ + plcbit Set_Yi; + plcbit force_Yi; + plcbit joltFreeDoneLowerLim; + plcbit joltFreeDoneUpperLim; + plcbit enable_old; +} LCRPID_typ; + +typedef struct LCRCurveByPoints +{ + /* VAR_INPUT (analog) */ + float x; + unsigned short NoOfPoints; + struct lcrCurveByPoints_TabEntry_type* ptr_table; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed short i_tab; + unsigned short iterations; + struct LCRScal scal1; +} LCRCurveByPoints_typ; + +typedef struct LCRPIDpara +{ + /* VAR_INPUT (analog) */ + float WX_max; + float WX_min; + float deadband; + unsigned char deadband_mode; + float dY_max; + float Kp; + float Tn; + float Tv; + float Tf; + float Kw; + float Kfbk; + unsigned char fbk_mode; + unsigned char d_mode; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long ident; + /* VAR (analog) */ + struct lcrpid_internal_typ internal_data; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit enter; + plcbit invert; +} LCRPIDpara_typ; + +typedef struct LCRContinServo +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_impulse; + float t_change_up; + float t_change_down; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float hysteresis_up; + float hysteresis_down; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long t_cnt_1; + signed long t_cnt_2; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysInfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit ref; + /* VAR_OUTPUT (digital) */ + plcbit up; + plcbit down; + plcbit refOk; + /* VAR (digital) */ + plcbit enable_old; + plcbit ref_old; +} LCRContinServo_typ; + +typedef struct LCRPT1 +{ + /* VAR_INPUT (analog) */ + float x; + float t; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; +} LCRPT1_typ; + +typedef struct LCRRamp +{ + /* VAR_INPUT (analog) */ + float x; + float dy_up; + float dy_down; + float y_max; + float y_min; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed long y_dbl_1; + signed long y_dbl_2; + unsigned long timestore1; + unsigned long timestore2; + unsigned long getDtForceOff; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR_OUTPUT (digital) */ + plcbit x_reached; + plcbit max_limit; + plcbit min_limit; +} LCRRamp_typ; + +typedef struct LCRIntegrate +{ + /* VAR_INPUT (analog) */ + float x; + float tn; + float y_max; + float y_min; + float y_set; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR_OUTPUT (digital) */ + plcbit max_limit; + plcbit min_limit; +} LCRIntegrate_typ; + +typedef struct LCRLimit +{ + /* VAR_INPUT (analog) */ + float in; + signed long max_value; + signed long min_value; + /* VAR_OUTPUT (analog) */ + unsigned short status; + signed long out; + /* VAR_OUTPUT (digital) */ + plcbit max_limit; + plcbit min_limit; +} LCRLimit_typ; + +typedef struct LCRLimScal +{ + /* VAR_INPUT (analog) */ + float x; + float x1; + float y1; + float x2; + float y2; + /* VAR_OUTPUT (analog) */ + float y; +} LCRLimScal_typ; + +typedef struct LCRMovAvgFlt +{ + /* VAR_INPUT (analog) */ + float x; + unsigned short base; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + signed long sum_old_dbl_1; + signed long sum_old_dbl_2; + unsigned long p_xold; + unsigned short i_xold; + unsigned short base_old; + unsigned long bootkey_old; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRMovAvgFlt_typ; + +typedef struct LCRTimeBasedOnOff +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float timpulse; + float tchange_up; + float tchange_down; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float hysteresis_up; + float hysteresis_down; + /* VAR (analog) */ + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + signed long t_cnt_1; + signed long t_cnt_2; + signed long y_dbl_1; + signed long y_dbl_2; + struct SysInfo sysInfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit ref; + /* VAR_OUTPUT (digital) */ + plcbit up; + plcbit down; + plcbit refOk; + /* VAR (digital) */ + plcbit enable_old; + plcbit ref_old; +} LCRTimeBasedOnOff_typ; + +typedef struct LCRDifferentiate +{ + /* VAR_INPUT (analog) */ + float x; + float tv; + float tf; + /* VAR_OUTPUT (analog) */ + unsigned short status; + float y; + /* VAR (analog) */ + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + struct SysInfo sysinfo_inst; + signed long a11; + signed long a12; + signed long a21; + signed long a22; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRDifferentiate_typ; + +typedef struct LCRPIDTune +{ + /* VAR_INPUT (analog) */ + float Y_min; + float Y_max; + float Y0; + float Y1; + float X0; + float X_min; + float X_max; + signed short P_manualAdjust; + signed short I_manualAdjust; + signed short D_manualAdjust; + unsigned long request; + struct lcrpid_tune_addpar_typ* pAddPar; + struct lcrpid_tune_osc_options_typ* pOptions_osc; + struct lcrpid_tune_step_options_typ* pOptions_step; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned short addInfo; + unsigned long ident; + unsigned short state; + /* VAR (analog) */ + float t_autotune; + unsigned short status_tmp; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + float e; + float e_minAmp; + float e_old_up; + float e_old_down; + float e_old; + struct SysInfo sysinfo_inst; + struct LCRMovAvgFlt MovAvgFlt_inst; + struct lcrpid_old_typ old; + struct lcrpid_procPar_typ processPar; + struct lcrpid_internal_typ internal_data; + struct lcrpid_tune_addpar_typ addPar; + struct lcrpid_tune_osc_typ oscillation; + struct lcrpid_tune_step_typ stepresponse; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit okToStep; + /* VAR_OUTPUT (digital) */ + plcbit rdyToStep; + /* VAR (digital) */ + plcbit curveDown; + plcbit curveUp; +} LCRPIDTune_typ; + +typedef struct LCRSlimPID +{ + /* VAR_INPUT (analog) */ + float W; + float X; + unsigned long request; + struct lcrslimpid_par_typ* pPar; + /* VAR_OUTPUT (analog) */ + float e; + float Y; + unsigned short status; + unsigned short addInfo; + /* VAR (analog) */ + struct LCRMovAvgFlt MovAvgFlt_inst; + struct LCRPIDTune PIDTune_inst; + struct LCRPID PID_inst; + unsigned long requ_old; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRSlimPID_typ; + +typedef struct LCRPFM +{ + /* VAR_INPUT (analog) */ + float x; + float max_value; + float min_value; + float t_pulse; + float t_pause; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR (analog) */ + float area; + float area_c; + float range; + float last; + float tpls; + unsigned short counter_state; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + struct SysInfo sysinfo_inst; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR_OUTPUT (digital) */ + plcbit pulse; + /* VAR (digital) */ + plcbit enable_old; +} LCRPFM_typ; + +typedef struct LCRTt +{ + /* VAR_INPUT (analog) */ + signed long Tt; + float x; + float y_set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + signed long Ts; + signed long Tt_Max; + float* pRingBuf; + float* pBuf_OutIn; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit set; + /* VAR (digital) */ + plcbit enable_old; +} LCRTt_typ; + +typedef struct LCRPT2 +{ + /* VAR_INPUT (analog) */ + float V; + float T1; + float T2; + float x; + float y_set; + unsigned char set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + unsigned long x2_dbl_1; + unsigned long x2_dbl_2; + signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT2_typ; + +typedef struct LCRSimModExt +{ + /* VAR_INPUT (analog) */ + signed long Tt_h; + signed long Tt_c; + float k_h; + float k_c; + float PT2_T1; + float PT2_T2; + float Temp_amb; + float Temp_c; + float Alpha_h; + float Alpha_c; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + struct LCRTt Tt_heat; + struct LCRTt Tt_cool; + float k_h_intern; + float k_c_intern; + struct LCRPT2 PT2; + float y_c; + float y_end; + float y_h; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; +} LCRSimModExt_typ; + +typedef struct LCRPT1e +{ + /* VAR_INPUT (analog) */ + float V; + float T1; + float x; + float y_set; + unsigned char set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + unsigned long x1_dbl_1; + unsigned long x1_dbl_2; + signed long Ts; + unsigned long Ts_dbl_1; + unsigned long Ts_dbl_2; + unsigned char set_old; + unsigned char Set_y; + unsigned long Bootkey; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT1e_typ; + +typedef struct LCRDblActPID +{ + /* VAR_INPUT (analog) */ + float W; + float X; + float Y_man; + unsigned char mode; + struct lcrdblpid_par_typ* pPar1; + struct lcrdblpid_par_typ* pPar2; + struct lcrpid_tune_addpar_typ* pAddPar; + struct lcrdblpid_tune_typ* pOpt; + /* VAR_OUTPUT (analog) */ + float e; + float Y1; + float Y2; + unsigned short status; + unsigned char tuneState; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDTune tune; + struct SysInfo sysinfo_inst; + float gradient; + float Y_avg; + unsigned long tcnt_1; + unsigned long tcnt_2; + float Tmeas; + float y_lim_old; + float p_fact; + unsigned long bootkey_old; + unsigned long systicks_old; + unsigned short musecs_old; + unsigned char use_par; + unsigned char meas; + unsigned char mode_old; + unsigned char tune_step; + unsigned char tune_grad; + unsigned char tune_2nd; + unsigned char invert; + unsigned char counter_state; + unsigned char mode_int; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit hold_I; + plcbit okToStep; + /* VAR_OUTPUT (digital) */ + plcbit rdyToStep; + /* VAR (digital) */ + plcbit enable_old; +} LCRDblActPID_typ; + +typedef struct LCRMinMax +{ + /* VAR_INPUT (analog) */ + float in; + /* VAR_OUTPUT (analog) */ + float out_min; + float out_max; + /* VAR_INPUT (digital) */ + plcbit reset; +} LCRMinMax_typ; + +typedef struct LCRTempPID +{ + /* VAR_INPUT (analog) */ + float Temp_set; + float Temp; + float Y_man; + unsigned long mode; + struct lcrtemp_set_typ* pSettings; + /* VAR_OUTPUT (analog) */ + float y_heat; + float y_cool; + unsigned short status; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDpara pid_para; + float Temp_set_delay; + float Temp_set_int; + float TempSetOld; + float delayCnt; + signed char stateOld; + signed char state; + float a; + struct SysInfo sysinfo_inst; + unsigned char para_check_done; + struct lcrtemp_pid_internal_typ internal_para; + float dbl_dt; + float tAlt; + float altTime; + float tKnick; + float fAlt; + float a_alt; + float a_e; + float a_internal; + float Temp_set_int_old1; + float Temp_set_int_old2; + float Temp_set_int_old3; + unsigned long mode_old; + unsigned long timestore1; + unsigned long timestore2; + float yManInternal; + unsigned long timeCnt; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit update; + /* VAR (digital) */ + plcbit delayFlag; + plcbit enable_old; + plcbit altActive; + plcbit err_flag; +} LCRTempPID_typ; + +typedef struct LCRPT2o +{ + /* VAR_INPUT (analog) */ + float V; + float D; + float Tf; + float u; + unsigned char Set_y; + float y_set; + /* VAR_OUTPUT (analog) */ + float y; + unsigned short status; + /* VAR (analog) */ + struct lcrpt2o_Internal_typ Internal; + /* VAR_INPUT (digital) */ + plcbit enable; +} LCRPT2o_typ; + +typedef struct LCRTempTune +{ + /* VAR_INPUT (analog) */ + float Temp_set; + float Temp; + struct lcrtemp_set_typ* pSettings; + /* VAR_OUTPUT (analog) */ + float y_heat; + float y_cool; + unsigned short status; + /* VAR (analog) */ + struct LCRPID pid; + struct LCRPIDpara pid_para; + struct LCRDifferentiate DT2; + struct LCRPT2o pt2; + float Temp_flt; + unsigned short step; + float t; + float Temp_start; + float mem00; + float cnt02; + float cnt33; + float cnt20; + float pem01; + float pem33; + float pem10; + float pem02; + float pem44; + float pem20; + float tol01; + float tol10; + float tol02; + float tol20; + float tol22; + float Temp_old; + float delta_Temp; + unsigned long tcnt_1; + unsigned long tcnt_2; + unsigned long tcnt_dT_1; + unsigned long tcnt_dT_2; + struct SysInfo sysinfo_inst; + float Temp_set_internal; + float timecounter; + struct lcrtemp_tune_internal_typ internal_para; + float dbl_dt; + unsigned long call_counter; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + float timer2; + unsigned short waitCounter; + float Y_heat_tune_intern; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit start; + plcbit okToHeat; + plcbit okToFree; + plcbit okToFreeEnd; + plcbit okToCool; + plcbit okToCoolEnd; + /* VAR_OUTPUT (digital) */ + plcbit rdyToHeat; + plcbit rdyToFree; + plcbit rdyToFreeEnd; + plcbit rdyToCool; + plcbit rdyToCoolEnd; + plcbit done; + plcbit busy; + /* VAR (digital) */ + plcbit enable_old; +} LCRTempTune_typ; + +typedef struct LCRSchedulePWM +{ + /* VAR_INPUT (analog) */ + float Pmax; + unsigned short n; + unsigned long pPar; + float min_value; + float max_value; + float t_min_pulse; + float t_period; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR (analog) */ + struct SysInfo sysinfo_inst; + unsigned long store1; + unsigned long store2; + unsigned long timeCnt; + unsigned short numberUnits; + unsigned short limFact; + float Pact; + float Pman; + float intern0[6]; + struct lcrschedule_par_typ* in; + /* VAR_INPUT (digital) */ + plcbit enable; + /* VAR (digital) */ + plcbit enable_old; + plcbit cmd_delay; + plcbit err_flag; + plcbit limAll; +} LCRSchedulePWM_typ; + + + +/* Prototyping of functions and function blocks */ +_BUR_PUBLIC void LCRPID(struct LCRPID* inst); +_BUR_PUBLIC void LCRScal(struct LCRScal* inst); +_BUR_PUBLIC void LCRCurveByPoints(struct LCRCurveByPoints* inst); +_BUR_PUBLIC void LCRPIDpara(struct LCRPIDpara* inst); +_BUR_PUBLIC void LCRContinServo(struct LCRContinServo* inst); +_BUR_PUBLIC void LCRPT1(struct LCRPT1* inst); +_BUR_PUBLIC void LCRRamp(struct LCRRamp* inst); +_BUR_PUBLIC void LCRIntegrate(struct LCRIntegrate* inst); +_BUR_PUBLIC void LCRLimit(struct LCRLimit* inst); +_BUR_PUBLIC void LCRLimScal(struct LCRLimScal* inst); +_BUR_PUBLIC void LCRPWM(struct LCRPWM* inst); +_BUR_PUBLIC void LCRMovAvgFlt(struct LCRMovAvgFlt* inst); +_BUR_PUBLIC void LCRTimeBasedOnOff(struct LCRTimeBasedOnOff* inst); +_BUR_PUBLIC void LCRDifferentiate(struct LCRDifferentiate* inst); +_BUR_PUBLIC void LCRSlimPID(struct LCRSlimPID* inst); +_BUR_PUBLIC void LCRPIDTune(struct LCRPIDTune* inst); +_BUR_PUBLIC void LCRPFM(struct LCRPFM* inst); +_BUR_PUBLIC void LCRSimModExt(struct LCRSimModExt* inst); +_BUR_PUBLIC void LCRTt(struct LCRTt* inst); +_BUR_PUBLIC void LCRPT2(struct LCRPT2* inst); +_BUR_PUBLIC void LCRPT1e(struct LCRPT1e* inst); +_BUR_PUBLIC void LCRDblActPID(struct LCRDblActPID* inst); +_BUR_PUBLIC void LCRMinMax(struct LCRMinMax* inst); +_BUR_PUBLIC void LCRTempPID(struct LCRTempPID* inst); +_BUR_PUBLIC void LCRTempTune(struct LCRTempTune* inst); +_BUR_PUBLIC void LCRPT2o(struct LCRPT2o* inst); +_BUR_PUBLIC void LCRSchedulePWM(struct LCRSchedulePWM* inst); + + +#ifdef __cplusplus +}; +#endif +#endif /* _LOOPCONR_ */ + diff --git a/Logical/Libraries/Package.pkg b/Logical/Libraries/Package.pkg index 00a1531..b09ee00 100644 --- a/Logical/Libraries/Package.pkg +++ b/Logical/Libraries/Package.pkg @@ -18,5 +18,8 @@ AsBrMath AsHttp AsOpcUac + LoopConR + sys_lib + brsystem \ No newline at end of file diff --git a/Logical/Libraries/brsystem/SG3/brsystem.h b/Logical/Libraries/brsystem/SG3/brsystem.h new file mode 100644 index 0000000..06254eb --- /dev/null +++ b/Logical/Libraries/brsystem/SG3/brsystem.h @@ -0,0 +1,271 @@ +/* Automation Studio generated header file */ +/* Do not edit ! */ + +#ifndef _BRSYSTEM_ +#define _BRSYSTEM_ +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + +#include + +#ifndef _IEC_CONST +#define _IEC_CONST _WEAK const +#endif + +/* Constants */ +#ifdef _REPLACE_CONST + #define brX2X 10U + #define brPP 255U + #define brCPU 1U + #define brKEY 8U + #define brDRAM 0U + #define br2003 2U + #define br2005 1U + #define br2010 0U + #define brC200 9U + #define brC300 8U + #define brADDON 7U + #define brPANEL 6U + #define brGLOBAL_REMANENT_PV 5U + #define brLOCAL_REMANENT_PV 4U + #define brUSRROM 3U + #define brSYSROM 2U + #define brUSRRAM 1U + #define brACOPOS 7U + #define brCAN_IO 5U + #define brBASE_IO 3U + #define brPRODUCT 0U + #define brETHER_IO 6U + #define brNO_FAMILY 255U + #define brREMOTE_IO 4U + #define brBATTERY_OK 1U + #define brPOWERPANEL 5U + #define brBATTERY_LOW 0U + #define brLOGICSCANNER 3U + #define brPLUGIN_MODULE 10U + #define brSYSTEM_MODULE 2U + #define brBATTERY_NOTEST 2U + #define TARGET_BIG_ENDIAN 2U + #define brBATTERY_MISSING 3U + #define INIT_REASON_UNKNOWN (-1) + #define INIT_REASON_DOWNLOAD 3 + #define TARGET_LITTLE_ENDIAN 1U + #define brAUTOMATION_RUNTIME 4U + #define brERR_INVALID_DEVICE 27250U + #define INIT_REASON_COLDSTART 2 + #define INIT_REASON_WARMSTART 1 + #define brSYSCONF_SET_VOLATILE 0 + #define brERR_INVALID_PARAMETER 27251U + #define brSYSCONF_SET_NON_VOLATILE 1 +#else + _IEC_CONST unsigned char brX2X = 10U; + _IEC_CONST unsigned char brPP = 255U; + _IEC_CONST unsigned char brCPU = 1U; + _IEC_CONST unsigned char brKEY = 8U; + _IEC_CONST unsigned long brDRAM = 0U; + _IEC_CONST unsigned char br2003 = 2U; + _IEC_CONST unsigned char br2005 = 1U; + _IEC_CONST unsigned char br2010 = 0U; + _IEC_CONST unsigned char brC200 = 9U; + _IEC_CONST unsigned char brC300 = 8U; + _IEC_CONST unsigned char brADDON = 7U; + _IEC_CONST unsigned char brPANEL = 6U; + _IEC_CONST unsigned long brGLOBAL_REMANENT_PV = 5U; + _IEC_CONST unsigned long brLOCAL_REMANENT_PV = 4U; + _IEC_CONST unsigned long brUSRROM = 3U; + _IEC_CONST unsigned long brSYSROM = 2U; + _IEC_CONST unsigned long brUSRRAM = 1U; + _IEC_CONST unsigned char brACOPOS = 7U; + _IEC_CONST unsigned char brCAN_IO = 5U; + _IEC_CONST unsigned char brBASE_IO = 3U; + _IEC_CONST unsigned char brPRODUCT = 0U; + _IEC_CONST unsigned char brETHER_IO = 6U; + _IEC_CONST unsigned char brNO_FAMILY = 255U; + _IEC_CONST unsigned char brREMOTE_IO = 4U; + _IEC_CONST unsigned char brBATTERY_OK = 1U; + _IEC_CONST unsigned char brPOWERPANEL = 5U; + _IEC_CONST unsigned char brBATTERY_LOW = 0U; + _IEC_CONST unsigned char brLOGICSCANNER = 3U; + _IEC_CONST unsigned char brPLUGIN_MODULE = 10U; + _IEC_CONST unsigned char brSYSTEM_MODULE = 2U; + _IEC_CONST unsigned char brBATTERY_NOTEST = 2U; + _IEC_CONST unsigned char TARGET_BIG_ENDIAN = 2U; + _IEC_CONST unsigned char brBATTERY_MISSING = 3U; + _IEC_CONST signed char INIT_REASON_UNKNOWN = -1; + _IEC_CONST signed char INIT_REASON_DOWNLOAD = 3; + _IEC_CONST unsigned char TARGET_LITTLE_ENDIAN = 1U; + _IEC_CONST unsigned char brAUTOMATION_RUNTIME = 4U; + _IEC_CONST unsigned short brERR_INVALID_DEVICE = 27250U; + _IEC_CONST signed char INIT_REASON_COLDSTART = 2; + _IEC_CONST signed char INIT_REASON_WARMSTART = 1; + _IEC_CONST plcbit brSYSCONF_SET_VOLATILE = 0; + _IEC_CONST unsigned short brERR_INVALID_PARAMETER = 27251U; + _IEC_CONST plcbit brSYSCONF_SET_NON_VOLATILE = 1; +#endif + + + + +/* Datatypes and datatypes of function blocks */ +typedef struct MEMInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long FreeUSR_Ram; + unsigned long FreeSYSTEM; + unsigned long FreeUSR_Prom; + unsigned long FreeSYS_Prom; + unsigned long FreeFIX_Ram; + unsigned long FreeTMP_Ram; + unsigned long FreeMEMCARD; + /* VAR_INPUT (digital) */ + plcbit enable; +} MEMInfo_typ; + +typedef struct SysInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned char init_reason; + unsigned char init_count; + unsigned long tick_count; + unsigned long version; + /* VAR_INPUT (digital) */ + plcbit enable; +} SysInfo_typ; + +typedef struct RTInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long cycle_time; + signed char init_reason; + signed char task_class; + /* VAR_INPUT (digital) */ + plcbit enable; +} RTInfo_typ; + +typedef struct TARGETInfo +{ + /* VAR_INPUT (analog) */ + unsigned long pOSVersion; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned char DataFormat; + /* VAR_INPUT (digital) */ + plcbit enable; +} TARGETInfo_typ; + +typedef struct HWInfo +{ + /* VAR_INPUT (analog) */ + unsigned long pName; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned char family; + unsigned char usetype; + unsigned long module_typ; + unsigned char master_no; + unsigned char slave_no; + unsigned char module_adr; + unsigned char slot_no; + /* VAR (analog) */ + unsigned long next_vw_p; + unsigned long last_modul_p; + unsigned long next_entry_p; + unsigned char next_entry_ix; + unsigned char next_slot_ix; + unsigned char last_rio_master; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit first; +} HWInfo_typ; + +typedef struct BatteryInfo +{ + /* VAR_INPUT (analog) */ + unsigned long pDevice; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned char state; + /* VAR_INPUT (digital) */ + plcbit enable; +} BatteryInfo_typ; + +typedef struct EXCInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long task_class; + unsigned long task_ident; + /* VAR_INPUT (digital) */ + plcbit enable; +} EXCInfo_typ; + +typedef struct ZYKVLenable +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit mode; +} ZYKVLenable_typ; + +typedef struct PMemGet +{ + /* VAR_INPUT (analog) */ + unsigned long offset; + unsigned long len; + unsigned long adress; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR_INPUT (digital) */ + plcbit enable; +} PMemGet_typ; + +typedef struct PMemPut +{ + /* VAR_INPUT (analog) */ + unsigned long offset; + unsigned long len; + unsigned long adress; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR_INPUT (digital) */ + plcbit enable; +} PMemPut_typ; + +typedef struct PMemSize +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long size; + /* VAR_INPUT (digital) */ + plcbit enable; +} PMemSize_typ; + + + +/* Prototyping of functions and function blocks */ +void MEMInfo(struct MEMInfo* inst); +void SysInfo(struct SysInfo* inst); +void RTInfo(struct RTInfo* inst); +void TARGETInfo(struct TARGETInfo* inst); +void HWInfo(struct HWInfo* inst); +void BatteryInfo(struct BatteryInfo* inst); +void EXCInfo(struct EXCInfo* inst); +void ZYKVLenable(struct ZYKVLenable* inst); +void PMemGet(struct PMemGet* inst); +void PMemPut(struct PMemPut* inst); +void PMemSize(struct PMemSize* inst); + + +#ifdef __cplusplus +}; +#endif +#endif /* _BRSYSTEM_ */ + + diff --git a/Logical/Libraries/brsystem/SG4/brsystem.h b/Logical/Libraries/brsystem/SG4/brsystem.h new file mode 100644 index 0000000..2d87e5f --- /dev/null +++ b/Logical/Libraries/brsystem/SG4/brsystem.h @@ -0,0 +1,347 @@ +/* Automation Studio generated header file */ +/* Do not edit ! */ + +#ifndef _BRSYSTEM_ +#define _BRSYSTEM_ +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + +#include + +#ifndef _BUR_PUBLIC +#define _BUR_PUBLIC +#endif +/* Constants */ +#ifdef _REPLACE_CONST + #define brWINDOWS_BLUESCREEN 1U + #define brWINDOWS_OK 0U + #define brX2X 10U + #define brPP 255U + #define brCPU 1U + #define brKEY 8U + #define brDRAM 0U + #define br2003 2U + #define br2005 1U + #define br2010 0U + #define brC200 9U + #define brC300 8U + #define brADDON 7U + #define brPANEL 6U + #define brGLOBAL_REMANENT_PV 5U + #define brLOCAL_REMANENT_PV 4U + #define brUSRROM 3U + #define brSYSROM 2U + #define brUSRRAM 1U + #define brACOPOS 7U + #define brCAN_IO 5U + #define brBASE_IO 3U + #define brPRODUCT 0U + #define brETHER_IO 6U + #define brNO_FAMILY 255U + #define brREMOTE_IO 4U + #define brBATTERY_OK 1U + #define brPOWERPANEL 5U + #define brBATTERY_LOW 0U + #define brLOGICSCANNER 3U + #define brPLUGIN_MODULE 10U + #define brSYSTEM_MODULE 2U + #define brBATTERY_NOTEST 2U + #define TARGET_BIG_ENDIAN 2U + #define brBATTERY_MISSING 3U + #define INIT_REASON_UNKNOWN (-1) + #define INIT_REASON_DOWNLOAD 3 + #define TARGET_LITTLE_ENDIAN 1U + #define brAUTOMATION_RUNTIME 4U + #define brERR_INVALID_DEVICE 27250U + #define INIT_REASON_COLDSTART 2 + #define INIT_REASON_WARMSTART 1 + #define brSYSCONF_SET_VOLATILE 0 + #define brERR_INVALID_PARAMETER 27251U + #define brERR_NON_CYCLIC_CONTEXT 27252U + #define brSYSCONF_SET_NON_VOLATILE 1 +#else + #ifndef _GLOBAL_CONST + #define _GLOBAL_CONST _WEAK const + #endif + _GLOBAL_CONST unsigned long brWINDOWS_BLUESCREEN; + _GLOBAL_CONST unsigned long brWINDOWS_OK; + _GLOBAL_CONST unsigned char brX2X; + _GLOBAL_CONST unsigned char brPP; + _GLOBAL_CONST unsigned char brCPU; + _GLOBAL_CONST unsigned char brKEY; + _GLOBAL_CONST unsigned long brDRAM; + _GLOBAL_CONST unsigned char br2003; + _GLOBAL_CONST unsigned char br2005; + _GLOBAL_CONST unsigned char br2010; + _GLOBAL_CONST unsigned char brC200; + _GLOBAL_CONST unsigned char brC300; + _GLOBAL_CONST unsigned char brADDON; + _GLOBAL_CONST unsigned char brPANEL; + _GLOBAL_CONST unsigned long brGLOBAL_REMANENT_PV; + _GLOBAL_CONST unsigned long brLOCAL_REMANENT_PV; + _GLOBAL_CONST unsigned long brUSRROM; + _GLOBAL_CONST unsigned long brSYSROM; + _GLOBAL_CONST unsigned long brUSRRAM; + _GLOBAL_CONST unsigned char brACOPOS; + _GLOBAL_CONST unsigned char brCAN_IO; + _GLOBAL_CONST unsigned char brBASE_IO; + _GLOBAL_CONST unsigned char brPRODUCT; + _GLOBAL_CONST unsigned char brETHER_IO; + _GLOBAL_CONST unsigned char brNO_FAMILY; + _GLOBAL_CONST unsigned char brREMOTE_IO; + _GLOBAL_CONST unsigned char brBATTERY_OK; + _GLOBAL_CONST unsigned char brPOWERPANEL; + _GLOBAL_CONST unsigned char brBATTERY_LOW; + _GLOBAL_CONST unsigned char brLOGICSCANNER; + _GLOBAL_CONST unsigned char brPLUGIN_MODULE; + _GLOBAL_CONST unsigned char brSYSTEM_MODULE; + _GLOBAL_CONST unsigned char brBATTERY_NOTEST; + _GLOBAL_CONST unsigned char TARGET_BIG_ENDIAN; + _GLOBAL_CONST unsigned char brBATTERY_MISSING; + _GLOBAL_CONST signed char INIT_REASON_UNKNOWN; + _GLOBAL_CONST signed char INIT_REASON_DOWNLOAD; + _GLOBAL_CONST unsigned char TARGET_LITTLE_ENDIAN; + _GLOBAL_CONST unsigned char brAUTOMATION_RUNTIME; + _GLOBAL_CONST unsigned short brERR_INVALID_DEVICE; + _GLOBAL_CONST signed char INIT_REASON_COLDSTART; + _GLOBAL_CONST signed char INIT_REASON_WARMSTART; + _GLOBAL_CONST plcbit brSYSCONF_SET_VOLATILE; + _GLOBAL_CONST unsigned short brERR_INVALID_PARAMETER; + _GLOBAL_CONST unsigned short brERR_NON_CYCLIC_CONTEXT; + _GLOBAL_CONST plcbit brSYSCONF_SET_NON_VOLATILE; +#endif + + + + +/* Datatypes and datatypes of function blocks */ +typedef struct MEMInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long FreeUSR_Ram; + unsigned long FreeSYSTEM; + unsigned long FreeUSR_Prom; + unsigned long FreeSYS_Prom; + unsigned long FreeFIX_Ram; + unsigned long FreeTMP_Ram; + unsigned long FreeMEMCARD; + /* VAR_INPUT (digital) */ + plcbit enable; +} MEMInfo_typ; + +typedef struct MEMxInfo +{ + /* VAR_INPUT (analog) */ + unsigned long mem_typ; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long MemSize; + unsigned long FreeMemSize; + unsigned long BiggestFreeBlockSize; + /* VAR (analog) */ + unsigned short i_state; + unsigned short i_result; + unsigned long i_tmp; + /* VAR_INPUT (digital) */ + plcbit enable; +} MEMxInfo_typ; + +typedef struct SysInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned char init_reason; + unsigned char init_count; + unsigned long tick_count; + unsigned long version; + /* VAR_INPUT (digital) */ + plcbit enable; +} SysInfo_typ; + +typedef struct RTInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long cycle_time; + signed char init_reason; + signed char task_class; + /* VAR_INPUT (digital) */ + plcbit enable; +} RTInfo_typ; + +typedef struct TARGETInfo +{ + /* VAR_INPUT (analog) */ + unsigned long pOSVersion; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned char DataFormat; + /* VAR_INPUT (digital) */ + plcbit enable; +} TARGETInfo_typ; + +typedef struct HWInfo +{ + /* VAR_INPUT (analog) */ + unsigned long pName; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned char family; + unsigned char usetype; + unsigned long module_typ; + unsigned char master_no; + unsigned char slave_no; + unsigned char module_adr; + unsigned char slot_no; + /* VAR (analog) */ + unsigned long next_vw_p; + unsigned long last_modul_p; + unsigned long next_entry_p; + unsigned char next_entry_ix; + unsigned char next_slot_ix; + unsigned char last_rio_master; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit first; +} HWInfo_typ; + +typedef struct SysconfInfo +{ + /* VAR_INPUT (analog) */ + unsigned long pEntry; + unsigned long pValue; + unsigned long value_len; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR_INPUT (digital) */ + plcbit enable; +} SysconfInfo_typ; + +typedef struct SysconfSet +{ + /* VAR_INPUT (analog) */ + unsigned long pEntry; + unsigned long pNewValue; + unsigned char option; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR_INPUT (digital) */ + plcbit enable; +} SysconfSet_typ; + +typedef struct BatteryInfo +{ + /* VAR_INPUT (analog) */ + unsigned long pDevice; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned char state; + /* VAR_INPUT (digital) */ + plcbit enable; +} BatteryInfo_typ; + +typedef struct EXCInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long task_class; + unsigned long task_ident; + /* VAR_INPUT (digital) */ + plcbit enable; +} EXCInfo_typ; + +typedef struct ZYKVLenable +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit mode; +} ZYKVLenable_typ; + +typedef struct PMemGet +{ + /* VAR_INPUT (analog) */ + unsigned long offset; + unsigned long len; + unsigned long adress; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR_INPUT (digital) */ + plcbit enable; +} PMemGet_typ; + +typedef struct PMemPut +{ + /* VAR_INPUT (analog) */ + unsigned long offset; + unsigned long len; + unsigned long adress; + /* VAR_OUTPUT (analog) */ + unsigned short status; + /* VAR_INPUT (digital) */ + plcbit enable; +} PMemPut_typ; + +typedef struct PMemSize +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long size; + /* VAR_INPUT (digital) */ + plcbit enable; +} PMemSize_typ; + +typedef struct ARwinWindowsInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long windowsStatus; + /* VAR_INPUT (digital) */ + plcbit enable; +} ARwinWindowsInfo_typ; + +typedef struct ARwinEthWinInfo +{ + /* VAR_OUTPUT (analog) */ + unsigned short status; + plcstring IPAddr[16]; + plcstring SubnetMask[16]; + plcbyte MacAddr[6]; + /* VAR_INPUT (digital) */ + plcbit enable; +} ARwinEthWinInfo_typ; + + + +/* Prototyping of functions and function blocks */ +_BUR_PUBLIC void MEMInfo(struct MEMInfo* inst); +_BUR_PUBLIC void MEMxInfo(struct MEMxInfo* inst); +_BUR_PUBLIC void SysInfo(struct SysInfo* inst); +_BUR_PUBLIC void RTInfo(struct RTInfo* inst); +_BUR_PUBLIC void TARGETInfo(struct TARGETInfo* inst); +_BUR_PUBLIC void HWInfo(struct HWInfo* inst); +_BUR_PUBLIC void SysconfInfo(struct SysconfInfo* inst); +_BUR_PUBLIC void SysconfSet(struct SysconfSet* inst); +_BUR_PUBLIC void BatteryInfo(struct BatteryInfo* inst); +_BUR_PUBLIC void EXCInfo(struct EXCInfo* inst); +_BUR_PUBLIC void ZYKVLenable(struct ZYKVLenable* inst); +_BUR_PUBLIC void PMemGet(struct PMemGet* inst); +_BUR_PUBLIC void PMemPut(struct PMemPut* inst); +_BUR_PUBLIC void PMemSize(struct PMemSize* inst); +_BUR_PUBLIC void ARwinWindowsInfo(struct ARwinWindowsInfo* inst); +_BUR_PUBLIC void ARwinEthWinInfo(struct ARwinEthWinInfo* inst); +_BUR_PUBLIC plcbit RTCyclic(void); +_BUR_PUBLIC plcbit RTInit(void); +_BUR_PUBLIC plcbit RTExit(void); + + +#ifdef __cplusplus +}; +#endif +#endif /* _BRSYSTEM_ */ + diff --git a/Logical/Libraries/brsystem/binary.lby b/Logical/Libraries/brsystem/binary.lby new file mode 100644 index 0000000..c174b3d --- /dev/null +++ b/Logical/Libraries/brsystem/binary.lby @@ -0,0 +1,12 @@ + + + + + brsystem.fun + brsystem.typ + brsystem.var + + + + + \ No newline at end of file diff --git a/Logical/Libraries/brsystem/brsystem.fun b/Logical/Libraries/brsystem/brsystem.fun new file mode 100644 index 0000000..dc3386a --- /dev/null +++ b/Logical/Libraries/brsystem/brsystem.fun @@ -0,0 +1,216 @@ + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK MEMInfo (*returns information about the memory areas available on the system*) + VAR_INPUT + enable :BOOL; (*enables execution*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + FreeUSR_Ram :UDINT; (*SG3: free memory in USER RAM SG4: free memory in SRAM (Userram)*) + FreeSYSTEM :UDINT; (*SG3: free system memory SG4: not used, always 0*) + FreeUSR_Prom :UDINT; (*SG3: free memory in USER PROM SG4: free memory of HD where RPSHD is located*) + FreeSYS_Prom :UDINT; (*SG3: free memory in system PROM SG4: free memory of HD where RPSHD is located*) + FreeFIX_Ram :UDINT; (*SG3: free memory in FIX RAM SG4: not used, always 0*) + FreeTMP_Ram :UDINT; (*SG3: free temporary memory in RAM SG4: free memory in DRAM*) + FreeMEMCARD :UDINT; (*SG3: free memory on MEMCARD SG4: not used, always 0*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK MEMxInfo (*returns information about the memory areas available in the system; asynchronous execution*) + VAR_INPUT + enable :BOOL; (*enables execution*) + mem_typ :UDINT; (*memory type: brDRAM, brUSRRAM, brSYSROM, brUSRROM*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*) + MemSize :UDINT; (*total memory size in bytes*) + FreeMemSize :UDINT; (*size of available memory in bytes*) + BiggestFreeBlockSize :UDINT; (*size of the largest available block in memory in bytes*) + END_VAR + VAR + i_state :UINT; (*internal variable*) + i_result :UINT; (*internal variable*) + i_tmp :UDINT; (*internal variable*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK SysInfo (*returns information about the target system*) + VAR_INPUT + enable :BOOL; (*enables execution*) + END_VAR + VAR_OUTPUT + init_reason :USINT; (*reason for initialization*) + init_count :USINT; (*SG3: the value is increased by every INIT (warm restart) SG4: not used, always 0*) + tick_count :UDINT; (*tick count*) + version :UDINT; (*operating system version of the target system*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK RTInfo (*returns runtime information about the program*) + VAR_INPUT + enable :BOOL; (*enables execution*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + cycle_time :UDINT; (*cycle time in microsec*) + init_reason :SINT; (*reason for initialization*) + task_class :SINT; (*task class (SG3: #1 - #4 SG4: #1 - #8)*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK TARGETInfo (*returns information about the target system used*) + VAR_INPUT + enable :BOOL; (*enables execution*) + pOSVersion :UDINT; (*string given as a pointer (min. 7 char), where the os version is written*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + DataFormat :USINT; (*wether "big endian" or "little endian" ("TARGET_BIG_ENDIAN"/"TARGET_LITTLE_ENDIAN")*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK HWInfo (*returns information about the hardware configuration*) + VAR_INPUT + enable :BOOL; (*enables execution*) + first :BOOL; (*determines the hardware module on which the FUB is used 0/1 next/first*) + pName :UDINT; (*string given as a pointer, where the name of the module is written*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + family :USINT; (*family designation*) + usetype :USINT; (*hardware type*) + module_typ :UDINT; (*module type*) + master_no :USINT; (*logical number of the IO master, RIO master, CAN bus with CANIO*) + slave_no :USINT; (*slave number*) + module_adr :USINT; (*hardware module address (decimal)*) + slot_no :USINT; (*slot of the first submodule found (decimal)*) + END_VAR + VAR + next_vw_p :UDINT; (*internal variable*) + last_modul_p :UDINT; (*internal variable*) + next_entry_p :UDINT; (*internal variable*) + next_entry_ix :USINT; (*internal variable*) + next_slot_ix :USINT; (*internal variable*) + last_rio_master :USINT; (*internal variable*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK SysconfInfo (*returns the parameters for a sysconf entry*) + VAR_INPUT + enable :BOOL; (*enables execution*) + pEntry :UDINT; (*string given as a pointer, where the name of the entry is written*) + pValue :UDINT; (*string given as a pointer, where the value of the entry is copied*) + value_len :UDINT; (*length of the "value-string"*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK SysconfSet (*sets the parameters for a sysconf entry*) + VAR_INPUT + enable :BOOL; (*enables execution*) + pEntry :UDINT; (*string given as a pointer, where the name of the entry is written*) + pNewValue :UDINT; (*string given as a pointer, where the new value of the entry is written*) + option :USINT; (*sets the parameter volatile/permanent ("brSYSCONF_SET_VOLATILE"/"brSYSCONF_SET_NON_VOLATILE")*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK BatteryInfo (*returns the state of the battery*) + VAR_INPUT + enable :BOOL; (*enables execution*) + pDevice :UDINT; (*device name given as a pointer*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + state :USINT; (*state of the battery*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK EXCInfo (*returns information about the program that triggered the exception*) + VAR_INPUT + enable :BOOL; (*enables execution*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + task_class :UDINT; (*task class in which the exception was triggered*) + task_ident :UDINT; (*ID number of the program that triggered the exception*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK ZYKVLenable (*enables/disables the cycle time monitoring of programs*) + VAR_INPUT + enable :BOOL; (*enables execution*) + mode :BOOL; (*0/1 monitoring off/on*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK PMemGet (*reads data of len byte from the permanent memeory area beginning at offset*) + VAR_INPUT + enable :BOOL; (*enables execution*) + offset :UDINT; (*offset within the permanent memory area*) + len :UDINT; (*length of data area to be read*) + adress :UDINT; (*address where the read data is copied*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK PMemPut (*writes len bytes to the permanent memory area beginning at offset*) + VAR_INPUT + enable :BOOL; (*enables execution*) + offset :UDINT; (*offset within the permanent memory area*) + len :UDINT; (*length of data area to be written*) + adress :UDINT; (*address of the data to be written to the permanent memory area*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK PMemSize (*determines the size of permanent memory area in its existing configuration*) + VAR_INPUT + enable :BOOL; (*enables execution*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + size :UDINT; (*size of permanent memory area*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK ARwinWindowsInfo (*get status of windows system*) + VAR_INPUT + enable :BOOL; (*enables execution*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, 0xXXXX = see help*) + windowsStatus :UDINT; (*windows system status: brWINDOWS_BLUESCREEN, brWINDOWS_OK*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION_BLOCK ARwinEthWinInfo (*get ETH info windows interface*) + VAR_INPUT + enable :BOOL; (*enables execution*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, 0xXXXX = see help*) + IPAddr :STRING[15]; (*IP-address of virtual windows IF*) + SubnetMask :STRING[15]; (*netmask of virtual windows IF*) + MacAddr :ARRAY[0..5] OF BYTE; (*MAC-address of virtual windows IF*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_OK} FUNCTION RTCyclic : BOOL (*returns true, if function is called in the cyclic part of the program, false otherwise*) +END_FUNCTION + +{REDUND_OK} FUNCTION RTInit : BOOL (*returns true, if function is called in the init part of the program, false otherwise*) +END_FUNCTION + +{REDUND_OK} FUNCTION RTExit : BOOL (*returns true, if function is called in the exit part of the program, false otherwise*) +END_FUNCTION \ No newline at end of file diff --git a/Logical/Libraries/brsystem/brsystem.typ b/Logical/Libraries/brsystem/brsystem.typ new file mode 100644 index 0000000..22bfc94 --- /dev/null +++ b/Logical/Libraries/brsystem/brsystem.typ @@ -0,0 +1,4 @@ + +TYPE + +END_TYPE diff --git a/Logical/Libraries/brsystem/brsystem.var b/Logical/Libraries/brsystem/brsystem.var new file mode 100644 index 0000000..d8b2db1 --- /dev/null +++ b/Logical/Libraries/brsystem/brsystem.var @@ -0,0 +1,49 @@ + +VAR CONSTANT + brSYSCONF_SET_NON_VOLATILE : BOOL := TRUE; (*set permanent value*) + brERR_NON_CYCLIC_CONTEXT : UINT := 27252; (*non-cyclic context call*) + brERR_INVALID_PARAMETER : UINT := 27251; (*invalid parameter transferred*) + brSYSCONF_SET_VOLATILE : BOOL := FALSE; (*set non-permanent value*) + INIT_REASON_WARMSTART : SINT := 1; (*warm restart boot information*) + INIT_REASON_COLDSTART : SINT := 2; (*cold restart boot information*) + brERR_INVALID_DEVICE : UINT := 27250; (*battery monitoring*) + brAUTOMATION_RUNTIME : USINT := 4; (*series recognition*) + TARGET_LITTLE_ENDIAN : USINT := 1; (*formatSpec*) + INIT_REASON_DOWNLOAD : SINT := 3; (*download boot information*) + INIT_REASON_UNKNOWN : SINT := -1; (*unknown boot information*) + brBATTERY_MISSING : USINT := 3; (*battery monitoring*) + TARGET_BIG_ENDIAN : USINT := 2; (*formatSpec*) + brBATTERY_NOTEST : USINT := 2; (*battery monitoring*) + brSYSTEM_MODULE : USINT := 2; (*usage recognition*) + brPLUGIN_MODULE : USINT := 10; (*usage recognition*) + brLOGICSCANNER : USINT := 3; (*series recognition*) + brBATTERY_LOW : USINT := 0; (*battery monitoring*) + brPOWERPANEL : USINT := 5; (*series recognition*) + brBATTERY_OK : USINT := 1; (*battery monitoring*) + brREMOTE_IO : USINT := 4; (*usage recognition*) + brNO_FAMILY : USINT := 255; (*series recognition*) + brETHER_IO : USINT := 6; (*usage recognition*) + brPRODUCT : USINT := 0; (*usage recognition*) + brBASE_IO : USINT := 3; (*usage recognition*) + brCAN_IO : USINT := 5; (*usage recognition*) + brACOPOS : USINT := 7; (*usage recognition*) + brUSRRAM : UDINT := 1; (*USRRAM memory type*) + brSYSROM : UDINT := 2; (*SYSROM memory type*) + brUSRROM : UDINT := 3; (*USRROM memory type*) + brLOCAL_REMANENT_PV : UDINT := 4; (*local REMMEM memory type*) + brGLOBAL_REMANENT_PV : UDINT := 5; (*global REMMEM memory type*) + brPANEL : USINT := 6; (*series recognition*) + brADDON : USINT := 7; (*series recognition*) + brC300 : USINT := 8; (*series recognition*) + brC200 : USINT := 9; (*series recognition*) + br2010 : USINT := 0; (*series recognition*) + br2005 : USINT := 1; (*series recognition*) + br2003 : USINT := 2; (*series recognition*) + brDRAM : UDINT := 0; (*DRAM memory type*) + brKEY : USINT := 8; (*usage recognition*) + brCPU : USINT := 1; (*usage recognition*) + brPP : USINT := 255; (*usage recognition*) + brX2X : USINT := 10; (*series recognition*) + brWINDOWS_OK : UDINT := 0; (*Windows OK*) + brWINDOWS_BLUESCREEN : UDINT := 1; (*Windows in bluescreen*) +END_VAR diff --git a/Logical/Libraries/sys_lib/SG3/sys_lib.h b/Logical/Libraries/sys_lib/SG3/sys_lib.h new file mode 100644 index 0000000..039504c --- /dev/null +++ b/Logical/Libraries/sys_lib/SG3/sys_lib.h @@ -0,0 +1,684 @@ +/****************************************************************************/ +/* */ +/* sys_lib.h */ +/* Declarations and Prototypes for libsys_lib.a */ +/* */ +/* Automation Studio */ +/* Copyright Bernecker&Rainer 1998 */ +/* */ +/****************************************************************************/ + +#ifndef _SYS_LIB_H_ +#define _SYS_LIB_H_ +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + +#include + +#define TMP_MODE 0x8000 /* temporary suspend/resume for */ + /* PLC and user task */ + +/* Error codes of the BURTRAP/SYS_LIB services */ + +#define ERR_BUR_WRROW 2061 /* illegal row */ +#define ERR_BUR_WRCOL 2062 /* illegal column */ +#define ERR_BUR_WR_CHAR 2063 /* invalid ASCII character */ +#define ERR_BUR_NORTC 2073 /* RTC not existing or uninitialized */ + +#define ERR_BUR_MO_NOTFOUND 3019 /* module not found */ +#define ERR_BUR_NOMEM 3030 /* out of memory */ +#define ERR_BUR_MEMVWBUSY 3035 /* memory management busy */ +#define ERR_BUR_ILLPTR 3104 /* illegal data pointer in MEM_free */ + +#define ERR_BUR_PSOS_BASE 3300 /* base number of pSOS errors */ + +#define ERR_BUR_ILLTKNR 3300 /* illegal task-class number */ +#define ERR_BUR_WROFFSET 3301 /* illegal offset */ +#define ERR_BUR_ILLSTATE 3302 /* illegal state of object */ +#define ERR_BUR_NOMSG 3303 /* no message sent/received */ +#define ERR_BUR_DUPOBJ 3305 /* object exists */ +#define ERR_BUR_TIMEOUT 3304 /* timeout error */ +#define ERR_BUR_EXISTS 3306 /* entry exists */ +#define ERR_BUR_LCOUNT 3307 /* Linkcnt <> 0 in AVT_cancel () */ +#define ERR_BUR_BURNING 3308 /* error burning module */ +#define ERR_BUR_INVALIDMBX 3309 /* invalid mailbox */ + +#define ERR_BUR_ILLBPTR 3310 /* invalid base pointer */ +#define ERR_BUR_ILLTYP 3311 /* invalid I/O type */ +#define ERR_BUR_ILLEXT 3312 /* invalid ext. bit */ +#define ERR_BUR_ILLVER 3313 /* invalid version */ + /* e.g. BURTRAP V1.10 to SPSSW V1.05 */ +#define ERR_BUR_ILLLEN 3314 /* invalid data length */ +#define ERR_BUR_MAX_LCOUNT 3315 /* AVT_attach: LCOUNT > 127 */ +#define ERR_BUR_AVT_FREE 3316 /* AVT_release:LCOUNT = 0 */ +#define ERR_BUR_ILLPAR 3317 /* illegal parameter */ +#define ERR_BUR_INSTALL 3318 /* error install datamodule */ +#define ERR_BUR_WRONG_MODTYP 3319 /* wrong Moduletype */ + + +#define ERR_BUR_OBJDEL 3320 /* object already deleted */ +#define ERR_BUR_ILLOBJ 3324 /* object does not exist */ +#define ERR_BUR_ILLOBJTYP 3328 /* invalid object type */ +#define ERR_BUR_NOENTRY 3332 /* no entry */ +#define ERR_BUR_TOOLONG_PVNAME 3333 /* too long PV name */ +#define ERR_BUR_ILLIDENT 3336 /* illegal ident */ +#define ERR_BUR_NOSMBUF 3560 /* no more semaphore buffers */ +#define ERR_BUR_NOSM 3564 /* semaphore not available */ +#define ERR_BUR_SMDEL 3568 /* semaphore deleted */ +#define ERR_BUR_NOTIME 3584 /* time not available */ +#define ERR_BUR_ILLDATE 3588 /* date : out of range */ +#define ERR_BUR_ILLTIME 3592 /* time : out of range */ +#define ERR_BUR_ILLTICKS 3596 /* ticks : out of range */ + +#define ERR_BUR_MEM_ALLOC 3600 /* not enough continuous memory */ +#define ERR_BUR_TMP_ALLOC 3601 /* not enough continuous memory */ +#define ERR_BUR_MEM_FREE 3700 /* invalid pointer/length */ +#define ERR_BUR_TMP_FREE 3701 /* invalid pointer/length */ + +/* State for object PLC task */ +#define Z_ST_created 1 +#define Z_ST_running 2 +#define Z_ST_blocked 3 +#define Z_ST_exist 0x00 +#define Z_ST_installed 0x82 +#define Z_ST_PVinstalled 0x83 +#define Z_ST_IOinstalled 0x84 +#define Z_ST_IOdeinstalled 0x85 +#define Z_ST_PVdeinstalled 0x86 +#define Z_ST_delete 0x87 +#define Z_ST_stdebug 0x88 +#define Z_ST_tmp_suspended 0x90 + +/* PV data types */ +#define PB_DT_STRUCT 0 /* structure */ +#define PB_DT_BOOL 1 /* boolean */ +#define PB_DT_INT8 2 /* integer8 */ +#define PB_DT_INT16 3 /* integer16 */ +#define PB_DT_INT32 4 /* integer32 */ +#define PB_DT_BYTE 5 /* unsigned integer8 */ +#define PB_DT_WORD 6 /* unsigned integer16 */ +#define PB_DT_LONG 7 /* unsigned integer32 */ +#define PB_DT_FLOAT 8 /* floating point */ +#define PB_DT_VIS 9 /* visible string*/ +#define PB_DT_OCTET 10 /* octet string */ +#define PB_DT_DATE 11 /* date */ +#define PB_DT_TIME 12 /* time of day */ +#define PB_DT_DIFF 13 /* time difference */ +#define PB_DT_BIT 14 /* bit string */ +#define PB_DT_ARRAY 15 /* array */ + +/* memory types */ +#define SYS_RAM 1 /* RAM */ +#define USER_ROM1 2 /* EPROM */ +#define FIX_RAM 5 /* fixed RAM */ + +typedef struct RTCtime_typ { + /* 1. UDINT */ + UINT year; /* year, starting with zero */ + USINT month; /* month: 1 - 12 */ + USINT day; /* day: 1 - 31 */ + /* 2. UDINT */ + USINT reserve; + USINT hour; /* hour: 0 - 23 */ + USINT minute; /* minute: 0 - 59 */ + USINT second; /* second: 0 - 59 */ + /* 3. UDINT */ + UINT millisec; /* millisecond: 0 - 999 */ + UINT microsec; /* microsecond: 0 - 999 */ + } RTCtime_typ; + +/* structure for SYSxinfo */ +typedef struct SYSxinfo_typ { + char aws_name[6]; + char aws_type[2]; + UDINT cpu_info; + UINT ma_globl_len; + UINT md_globl_len; + UDINT os_len; + UDINT user_len; + UDINT tmp_len; + UDINT eprom_len; + UDINT fix_ram_len; + } SYSxinfo_typ; + +/* structure for MO_list */ +typedef struct MO_List_typ { + char name[14]; /* name of the module (ASCII) */ + USINT grp; /* groups */ + USINT type; /* module type */ + USINT state; /* state of the module */ + USINT reserve; + UDINT adress; /* physical address of the module */ + UDINT memtype; /* memory type (0=OTP,1=RAM,2=EPROM,3=FLASH */ + } MO_List_typ; /* 5=FIXRAM) */ + +/* structure for MO_info */ +typedef struct MO_info +{ + /* VAR_INPUT (analog) */ + unsigned long pName; + unsigned char grp; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned char type; + unsigned char state; + unsigned long memType; + unsigned long address; + unsigned long size; + unsigned char version[10]; + struct RTCtime_typ date; + /* VAR_INPUT (digital) */ + plcbit enable; +} MO_info_typ; + +/* structure for PV_list */ +typedef struct PV_List_typ { + char name[14]; /* name of the PV (ASCII) */ + USINT tcnr; /* PV task class */ + USINT grp; /* PV group */ + UDINT ident; /* PV identifier */ + UDINT adress; /* physical address of the PV */ + } PV_List_typ; + +/* structue for PV_xlist */ +typedef struct PV_xList_typ { + + char name[33]; /* name of PV (ASCII) */ + USINT data_typ; /* data type of PV */ + UDINT data_len; /* data length of PV */ + UDINT dimension; /* dimension of PV */ + UDINT adress; /* physical address of PV */ + }PV_xList_typ; + +/* structure for ERR_read */ +typedef struct ERR_typ { + UINT err_nr; /* error number */ + UDINT err_info; /* additional information */ + char t_name[5]; /* name of the running task */ + USINT err_type; /* error type (1=fatal, 2=warning, 3=info) */ + UINT err_year; /* time of the error in RTC format */ + USINT err_month; + USINT err_day; + USINT err_reserve; + USINT err_hour; + USINT err_minute; + USINT err_second; + UINT err_millisec; + UINT err_microsec; + } ERR_typ; + +/* structure for ERR_xread */ +typedef struct ERR_xtyp { + UINT err_nr; /* error number */ + UDINT err_info; /* additional information */ + char t_name[5]; /* name of the running task */ + USINT err_type; /* error type (1=Fatal, 2=Warning, 3=Info) */ + UINT err_year; /* time of the error in RTC format */ + USINT err_month; + USINT err_day; + USINT err_reserve; + USINT err_hour; + USINT err_minute; + USINT err_second; + UINT err_millisec; + UINT err_microsec; + USINT err_string[34]; /* 32 byte string with 0 termination */ + } ERR_xtyp; + +/* structure for MO_ver */ +typedef struct MoVerStruc_typ { + USINT version[10]; /* Version of the BR Module */ + UINT year; + USINT month; + USINT day; + USINT reserve; + USINT hour; + USINT minute; + USINT second; + } MoVerStruc_typ; + +/* structure for the FUB Bit2Byte */ +typedef struct Bit2Byte { + /* non boolean input parameter */ + UDINT bitadr; + UINT length; + /* non boolean output parameter*/ + UDINT byteadr; + /* non boolean static local */ + USINT byte_00; + USINT byte_01; + USINT byte_02; + USINT byte_03; + USINT byte_04; + USINT byte_05; + USINT byte_06; + USINT byte_07; + USINT byte_08; + USINT byte_09; + USINT byte_10; + USINT byte_11; + USINT byte_12; + USINT byte_13; + USINT byte_14; + USINT byte_15; + /* boolean input parameter */ + /* boolean output parameter */ + /* boolean static local */ + BOOL bmem000; + BOOL bmem001; + BOOL bmem002; + BOOL bmem003; + BOOL bmem004; + BOOL bmem005; + BOOL bmem006; + BOOL bmem007; + BOOL bmem008; + BOOL bmem009; + BOOL bmem010; + BOOL bmem011; + BOOL bmem012; + BOOL bmem013; + BOOL bmem014; + BOOL bmem015; + BOOL bmem016; + BOOL bmem017; + BOOL bmem018; + BOOL bmem019; + BOOL bmem020; + BOOL bmem021; + BOOL bmem022; + BOOL bmem023; + BOOL bmem024; + BOOL bmem025; + BOOL bmem026; + BOOL bmem027; + BOOL bmem028; + BOOL bmem029; + BOOL bmem030; + BOOL bmem031; + BOOL bmem032; + BOOL bmem033; + BOOL bmem034; + BOOL bmem035; + BOOL bmem036; + BOOL bmem037; + BOOL bmem038; + BOOL bmem039; + BOOL bmem040; + BOOL bmem041; + BOOL bmem042; + BOOL bmem043; + BOOL bmem044; + BOOL bmem045; + BOOL bmem046; + BOOL bmem047; + BOOL bmem048; + BOOL bmem049; + BOOL bmem050; + BOOL bmem051; + BOOL bmem052; + BOOL bmem053; + BOOL bmem054; + BOOL bmem055; + BOOL bmem056; + BOOL bmem057; + BOOL bmem058; + BOOL bmem059; + BOOL bmem060; + BOOL bmem061; + BOOL bmem062; + BOOL bmem063; + BOOL bmem064; + BOOL bmem065; + BOOL bmem066; + BOOL bmem067; + BOOL bmem068; + BOOL bmem069; + BOOL bmem070; + BOOL bmem071; + BOOL bmem072; + BOOL bmem073; + BOOL bmem074; + BOOL bmem075; + BOOL bmem076; + BOOL bmem077; + BOOL bmem078; + BOOL bmem079; + BOOL bmem080; + BOOL bmem081; + BOOL bmem082; + BOOL bmem083; + BOOL bmem084; + BOOL bmem085; + BOOL bmem086; + BOOL bmem087; + BOOL bmem088; + BOOL bmem089; + BOOL bmem090; + BOOL bmem091; + BOOL bmem092; + BOOL bmem093; + BOOL bmem094; + BOOL bmem095; + BOOL bmem096; + BOOL bmem097; + BOOL bmem098; + BOOL bmem099; + BOOL bmem100; + BOOL bmem101; + BOOL bmem102; + BOOL bmem103; + BOOL bmem104; + BOOL bmem105; + BOOL bmem106; + BOOL bmem107; + BOOL bmem108; + BOOL bmem109; + BOOL bmem110; + BOOL bmem111; + BOOL bmem112; + BOOL bmem113; + BOOL bmem114; + BOOL bmem115; + BOOL bmem116; + BOOL bmem117; + BOOL bmem118; + BOOL bmem119; + BOOL bmem120; + BOOL bmem121; + BOOL bmem122; + BOOL bmem123; + BOOL bmem124; + BOOL bmem125; + BOOL bmem126; + BOOL bmem127; + BOOL bmem128; + BOOL bmem129; + BOOL bmem130; + BOOL bmem131; + BOOL bmem132; + BOOL bmem133; + BOOL bmem134; + BOOL bmem135; + BOOL bmem136; + BOOL bmem137; + BOOL bmem138; + BOOL bmem139; + } Bit2Byte_typ; + +/* structure for the FUB Byte2Bit */ +typedef struct Byte2Bit { + /* non boolean input parameter */ + UDINT byteadr; + UINT length; + /* non boolean output parameter*/ + UDINT bitadr; + /* non boolean static local */ + /* boolean input parameter */ + /* boolean output parameter */ + /* boolean static local */ + BOOL bmem000; + BOOL bmem001; + BOOL bmem002; + BOOL bmem003; + BOOL bmem004; + BOOL bmem005; + BOOL bmem006; + BOOL bmem007; + BOOL bmem008; + BOOL bmem009; + BOOL bmem010; + BOOL bmem011; + BOOL bmem012; + BOOL bmem013; + BOOL bmem014; + BOOL bmem015; + BOOL bmem016; + BOOL bmem017; + BOOL bmem018; + BOOL bmem019; + BOOL bmem020; + BOOL bmem021; + BOOL bmem022; + BOOL bmem023; + BOOL bmem024; + BOOL bmem025; + BOOL bmem026; + BOOL bmem027; + BOOL bmem028; + BOOL bmem029; + BOOL bmem030; + BOOL bmem031; + BOOL bmem032; + BOOL bmem033; + BOOL bmem034; + BOOL bmem035; + BOOL bmem036; + BOOL bmem037; + BOOL bmem038; + BOOL bmem039; + BOOL bmem040; + BOOL bmem041; + BOOL bmem042; + BOOL bmem043; + BOOL bmem044; + BOOL bmem045; + BOOL bmem046; + BOOL bmem047; + BOOL bmem048; + BOOL bmem049; + BOOL bmem050; + BOOL bmem051; + BOOL bmem052; + BOOL bmem053; + BOOL bmem054; + BOOL bmem055; + BOOL bmem056; + BOOL bmem057; + BOOL bmem058; + BOOL bmem059; + BOOL bmem060; + BOOL bmem061; + BOOL bmem062; + BOOL bmem063; + BOOL bmem064; + BOOL bmem065; + BOOL bmem066; + BOOL bmem067; + BOOL bmem068; + BOOL bmem069; + BOOL bmem070; + BOOL bmem071; + BOOL bmem072; + BOOL bmem073; + BOOL bmem074; + BOOL bmem075; + BOOL bmem076; + BOOL bmem077; + BOOL bmem078; + BOOL bmem079; + BOOL bmem080; + BOOL bmem081; + BOOL bmem082; + BOOL bmem083; + BOOL bmem084; + BOOL bmem085; + BOOL bmem086; + BOOL bmem087; + BOOL bmem088; + BOOL bmem089; + BOOL bmem090; + BOOL bmem091; + BOOL bmem092; + BOOL bmem093; + BOOL bmem094; + BOOL bmem095; + BOOL bmem096; + BOOL bmem097; + BOOL bmem098; + BOOL bmem099; + BOOL bmem100; + BOOL bmem101; + BOOL bmem102; + BOOL bmem103; + BOOL bmem104; + BOOL bmem105; + BOOL bmem106; + BOOL bmem107; + BOOL bmem108; + BOOL bmem109; + BOOL bmem110; + BOOL bmem111; + BOOL bmem112; + BOOL bmem113; + BOOL bmem114; + BOOL bmem115; + BOOL bmem116; + BOOL bmem117; + BOOL bmem118; + BOOL bmem119; + BOOL bmem120; + BOOL bmem121; + BOOL bmem122; + BOOL bmem123; + BOOL bmem124; + BOOL bmem125; + BOOL bmem126; + BOOL bmem127; + BOOL bmem128; + BOOL bmem129; + BOOL bmem130; + BOOL bmem131; + BOOL bmem132; + BOOL bmem133; + BOOL bmem134; + BOOL bmem135; + BOOL bmem136; + BOOL bmem137; + BOOL bmem138; + BOOL bmem139; + } Byte2Bit_typ; + +/***************/ +/* Prototyping */ +/***************/ + +UINT PV_ident (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr, + UDINT *pv_ident); +UINT PV_setval (UDINT pv_ident, UDINT value); +UINT PV_getval (UDINT pv_ident, UDINT *value); +UINT PV_getadr (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr, + UDINT *pv_adresse); +UINT PV_xgetadr (char *pv_name, UDINT *pv_adresse, UDINT *data_len); +UINT PV_xsetval (UDINT pv_ident, UINT subindex, void *data_p, + USINT data_len); +UINT PV_xgetval (UDINT pv_ident, UINT subindex, void *data_p, + USINT data_len); +UINT PV_info (UDINT pv_ident, UDINT *data_type, UDINT *data_len, + UINT *dimension); +UINT PV_list (UINT prev_index, UINT *index, PV_List_typ *pvl_p); +UINT PV_xlist (UINT prev_index, UINT *index, PV_xList_typ *pvl_p); +UINT PV_item (char *pv_name, UINT index, char *itemname); +UINT PV_ninfo (char *pv_name, UDINT *data_typ_p, UDINT *data_len_p, + UINT *dimension_p); + + + +UINT SYS_info (UDINT *sg_init_cnt, UDINT *sg_initdescr, UDINT *sg_tickcnt, + UDINT *sg_version, UDINT *sg_ov_version); +UINT SYSxinfo (SYSxinfo_typ *sx_p); +UINT SYSreset (BOOL enable, USINT mode); +USINT SYS_battery (void); + +UINT MO_list (UINT prev_index, UINT *index, MO_List_typ *mol_p); +void MO_info (struct MO_info* pInst); +UINT KEY_enadis (BOOL mode); +UINT KEY_read (USINT keys[4]); + +UINT FORCE_info (USINT tcnr, BOOL *force); + +UINT ST_ident (char *st_name_p, USINT st_grp, UDINT *st_ident); +UINT ST_suspend (UDINT st_ident); +UINT ST_resume (UDINT st_ident); +UINT ST_tmp_suspend (UDINT st_ident); +UINT ST_tmp_resume (UDINT st_ident); +UINT ST_allsuspend (void); +UINT ST_info (UDINT st_ident, USINT *state, SINT *tcnr); +UINT ST_name (UDINT st_ident, char *st_name_p, USINT *st_grp); + +UINT UT_ident (char *ut_name_p, USINT ut_grp, USINT ut_proc, char *ut_sps_p,UDINT *ut_ident); +UINT UT_suspend (UDINT ut_ident); +UINT UT_resume (UDINT ut_ident); +UINT UT_sleep (UDINT tickcount); +UINT UT_sendmsg (UDINT ut_ident, void *msg, UDINT msglng, UDINT flags); +UINT UT_recmsg (UDINT *ut_ident, void **msg, UDINT *msglng, UDINT flags); +UINT UT_freemsg (UDINT msglng, void *msg); +UINT UT_exit (UDINT exitinfo); + + +UINT AVT_create (char *name_p, USINT grupid, UDINT av_info, UDINT *av_ident); +UINT AVT_cancel (UDINT av_ident); +UINT AVT_ident (char *name_p, USINT grupid, UDINT *av_ident); +UINT AVT_attach (UDINT av_ident, UDINT *av_info); +UINT AVT_release (UDINT av_ident); +UINT AVT_info (UDINT av_ident, USINT *av_linkcount); + +UINT MEM_alloc (UDINT memlng, void **memptr); +UINT MEM_free (UDINT memlng, void *memptr); +UINT TMP_alloc (UDINT memlng, void **memptr); +UINT TMP_free (UDINT memlng, void *memptr); + +UINT RTC_gettime (RTCtime_typ *rtctime); +UINT RTC_settime (RTCtime_typ *rtctime); +UINT SW_gettime (RTCtime_typ *rtctime); +UINT SW_settime (RTCtime_typ *rtctime); +UINT TIM_musec (void); +UINT TIM_ticks (void); + +UINT SM_create (char *sm_name, USINT sm_count, UDINT *sm_ident); +UINT SM_ident (char *sm_name, UDINT *sm_ident); +UINT SM_delete (UDINT sm_ident); +UINT SM_attach (UDINT sm_ident, UDINT timeout, UDINT flags); +UINT SM_release (UDINT sm_ident); + +UINT ERR_warning (UINT errornr, UDINT errorinfo); +UINT ERR_fatal (UINT errornr, UDINT errorinfo); +UINT ERR_read (UINT entry_nr, ERR_typ *err_p); +UINT ERRxwarning (UINT errornr, UDINT errorinfo, char* errorstring); +UINT ERRxread (UINT entry_nr, ERR_xtyp *err_p); +UINT ERRxfatal (UINT errornr, UDINT errorinfo, char* errorstring); + +UINT DIS_str (UDINT row, UDINT col, char *string); +UINT DIS_chr (UDINT row, UDINT col, char character); +UINT DIS_clr (void); + +UINT DA_create (char *name_p, USINT grp, UINT spooladr, UDINT data_len, + void *data_p, void **mo_data_p, UDINT *mo_ident); +UINT DA_write (UDINT mo_ident, void *data_p,UDINT data_len, + UDINT mo_data_offset); +UINT DA_read (UDINT mo_ident, void *data_p,UDINT data_len, + UDINT mo_data_offset); +UINT DA_ident (char *name_p, USINT grp, UDINT *mo_ident); +UINT DA_delete (UDINT mo_ident); +UINT DA_burn (UDINT mo_ident); +UINT DA_fix (UDINT mo_ident); +UINT DA_info (UDINT mo_ident, void **moduldata_adr, UDINT *moduldata_lng, + USINT *memorytype); +UINT DA_copy (UDINT mo_ident, char *new_name, USINT mem_typ, UDINT *da_ident, + UDINT *daten_p, UDINT *daten_len); +UINT DA_store (UDINT mo_ident, USINT mem_typ, UDINT* daten_p, UDINT* daten_len); + +UINT MO_ver (STRING *pName, USINT grp, MoVerStruc_typ* pMoVerStruc); + +void Bit2Byte (Bit2Byte_typ* Bit2Byte_ptr); +void Byte2Bit (Byte2Bit_typ* Byte2Bit_ptr); + +#ifdef __cplusplus +}; +#endif +#endif /* _SYS_LIB_H_ */ + diff --git a/Logical/Libraries/sys_lib/SG4/sys_lib.h b/Logical/Libraries/sys_lib/SG4/sys_lib.h new file mode 100644 index 0000000..da46f3b --- /dev/null +++ b/Logical/Libraries/sys_lib/SG4/sys_lib.h @@ -0,0 +1,730 @@ +/* Automation Studio generated header file */ +/* Do not edit ! */ + +#ifndef _SYS_LIB_H_ +#define _SYS_LIB_H_ +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#include + +#ifndef _BUR_PUBLIC +#define _BUR_PUBLIC +#endif + +#define TMP_MODE 0x8000 /* temporary suspend/resume for */ + /* PLC and user task */ + +/* Error codes of the BURTRAP/SYS_LIB services */ + +#define ERR_BUR_WRROW 2061 /* illegal row */ +#define ERR_BUR_WRCOL 2062 /* illegal column */ +#define ERR_BUR_WR_CHAR 2063 /* invalid ASCII character */ +#define ERR_BUR_NORTC 2073 /* RTC not existing or uninitialized */ + +#define ERR_BUR_MO_NOTFOUND 3019 /* module not found */ +#define ERR_BUR_NOMEM 3030 /* out of memory */ +#define ERR_BUR_MEMVWBUSY 3035 /* memory management busy */ +#define ERR_BUR_ILLPTR 3104 /* illegal data pointer in MEM_free */ + +#define ERR_BUR_PSOS_BASE 3300 /* base number of pSOS errors */ + +#define ERR_BUR_ILLTKNR 3300 /* illegal task-class number */ +#define ERR_BUR_WROFFSET 3301 /* illegal offset */ +#define ERR_BUR_ILLSTATE 3302 /* illegal state of object */ +#define ERR_BUR_NOMSG 3303 /* no message sent/received */ +#define ERR_BUR_DUPOBJ 3305 /* object exists */ +#define ERR_BUR_TIMEOUT 3304 /* timeout error */ +#define ERR_BUR_EXISTS 3306 /* entry exists */ +#define ERR_BUR_LCOUNT 3307 /* Linkcnt <> 0 in AVT_cancel () */ +#define ERR_BUR_BURNING 3308 /* error burning module */ +#define ERR_BUR_INVALIDMBX 3309 /* invalid mailbox */ + +#define ERR_BUR_ILLBPTR 3310 /* invalid base pointer */ +#define ERR_BUR_ILLTYP 3311 /* invalid I/O type */ +#define ERR_BUR_ILLEXT 3312 /* invalid ext. bit */ +#define ERR_BUR_ILLVER 3313 /* invalid version */ + /* e.g. BURTRAP V1.10 to SPSSW V1.05 */ +#define ERR_BUR_ILLLEN 3314 /* invalid data length */ +#define ERR_BUR_MAX_LCOUNT 3315 /* AVT_attach: LCOUNT > 127 */ +#define ERR_BUR_AVT_FREE 3316 /* AVT_release:LCOUNT = 0 */ +#define ERR_BUR_ILLPAR 3317 /* illegal parameter */ +#define ERR_BUR_INSTALL 3318 /* error install datamodule */ +#define ERR_BUR_WRONG_MODTYP 3319 /* wrong Moduletype */ + +#define ERR_BUR_OBJDEL 3320 /* object already deleted */ +#define ERR_BUR_ILLOBJ 3324 /* object does not exist */ +#define ERR_BUR_ILLOBJTYP 3328 /* invalid object type */ +#define ERR_BUR_NOENTRY 3332 /* no entry */ +#define ERR_BUR_TOOLONG_PVNAME 3333 /* too long PV name */ +#define ERR_BUR_ILLIDENT 3336 /* illegal ident */ +#define ERR_BUR_NOSMBUF 3560 /* no more semaphore buffers */ +#define ERR_BUR_NOSM 3564 /* semaphore not available */ +#define ERR_BUR_SMDEL 3568 /* semaphore deleted */ +#define ERR_BUR_NOTIME 3584 /* time not available */ +#define ERR_BUR_ILLDATE 3588 /* date : out of range */ +#define ERR_BUR_ILLTIME 3592 /* time : out of range */ +#define ERR_BUR_ILLTICKS 3596 /* ticks : out of range */ + +#define ERR_BUR_MEM_ALLOC 3600 /* not enough continuous memory */ +#define ERR_BUR_TMP_ALLOC 3601 /* not enough continuous memory */ +#define ERR_BUR_MEM_FREE 3700 /* invalid pointer/length */ +#define ERR_BUR_TMP_FREE 3701 /* invalid pointer/length */ + +/* State for object PLC task */ +#define Z_ST_created 1 +#define Z_ST_running 2 +#define Z_ST_blocked 3 +#define Z_ST_exist 0x00 +#define Z_ST_installed 0x82 +#define Z_ST_PVinstalled 0x83 +#define Z_ST_IOinstalled 0x84 +#define Z_ST_IOdeinstalled 0x85 +#define Z_ST_PVdeinstalled 0x86 +#define Z_ST_delete 0x87 +#define Z_ST_stdebug 0x88 +#define Z_ST_tmp_suspended 0x90 + +/* PV data types - obsolete */ +#define PB_DT_STRUCT 0 /* structure */ +#define PB_DT_BOOL 1 /* boolean */ +#define PB_DT_INT8 2 /* integer8 */ +#define PB_DT_INT16 3 /* integer16 */ +#define PB_DT_INT32 4 /* integer32 */ +#define PB_DT_BYTE 5 /* unsigned integer8 */ +#define PB_DT_WORD 6 /* unsigned integer16 */ +#define PB_DT_LONG 7 /* unsigned integer32 */ +#define PB_DT_FLOAT 8 /* floating point */ +#define PB_DT_VIS 9 /* visible string */ +#define PB_DT_OCTET 10 /* octet string */ +#define PB_DT_DATE 11 /* date */ +#define PB_DT_TIME 12 /* time of day */ +#define PB_DT_DIFF 13 /* time difference */ +#define PB_DT_BIT 14 /* bit string */ +#define PB_DT_ARRAY 15 /* array */ + +/* elementary data types */ +#define SYSLIB_IEC_TYPE_USER_DEFINED 0 /* User-defined data type */ +#define SYSLIB_IEC_TYPE_USER_DEFINED_2 15 /* User-defined data type (legacy: array of structs) */ +#define SYSLIB_IEC_TYPE_BOOL 1 /* 8 Bit containing a boolean value FALSE=0 or TRUE=1 */ +#define SYSLIB_IEC_TYPE_SINT 2 /* 8 Bit signed integer */ +#define SYSLIB_IEC_TYPE_INT 3 /* 16 Bit signed integer */ +#define SYSLIB_IEC_TYPE_DINT 4 /* 32 Bit signed integer */ +#define SYSLIB_IEC_TYPE_USINT 5 /* 8 Bit unsigned integer */ +#define SYSLIB_IEC_TYPE_UINT 6 /* 16 Bit unsigned integer */ +#define SYSLIB_IEC_TYPE_UDINT 7 /* 32 Bit unsigned integer */ +#define SYSLIB_IEC_TYPE_REAL 8 /* 32 Bit floating point number */ +#define SYSLIB_IEC_TYPE_STRING 9 /* Variable-length single-byte character string */ +#define SYSLIB_IEC_TYPE_DATE_AND_TIME 11 /* 32 Bit of Date in Seconds since 01.01.1970 00:00:00 */ +#define SYSLIB_IEC_TYPE_TIME 12 /* 32 Bit of Time in ms */ +#define SYSLIB_IEC_TYPE_DATE 13 /* 32 Bit of Date (only) */ +#define SYSLIB_IEC_TYPE_LREAL 14 /* 64 Bit floating point number */ +#define SYSLIB_IEC_TYPE_TIME_OF_DAY 16 /* 32 Bit Time of day (only) */ +#define SYSLIB_IEC_TYPE_BYTE 17 /* Bit string of length 8 */ +#define SYSLIB_IEC_TYPE_WORD 18 /* Bit string of length 16 */ +#define SYSLIB_IEC_TYPE_DWORD 19 /* Bit string of length 32 */ +#define SYSLIB_IEC_TYPE_WSTRING 21 /* Variable-length double-byte character string */ + +/* memory types */ +#define SYS_RAM 1 /* RAM */ +#define USER_ROM1 2 /* EPROM */ +#define FIX_RAM 5 /* fixed RAM */ + +/* shutdown / reboot types */ +#define SYSLIB_WARMSTART 0x01 /*WARMSTART(with restart)*/ +#define SYSLIB_COLDSTART 0x02 /*COLDSTART(with restart)*/ +#define SYSLIB_WARMSTART_NO_REBOOT 0x11 /*WARMSTART(no restart, only shutdown)*/ +#define SYSLIB_COLDSTART_NO_REBOOT 0x12 /*COLDSTART(no restart, only shutdown)*/ +#define SYSLIB_DIAGNOSTICS 0x20 /*DIAGNOSTICS(with restart)*/ +#define SYSLIB_SERVICE 0x40 /*SERVICE(with restart) */ + +typedef struct RTCtime_typ { + /* 1. UDINT */ + UINT year; /* year, starting with zero */ + USINT month; /* month: 1 - 12 */ + USINT day; /* day: 1 - 31 */ + /* 2. UDINT */ + USINT reserve; + USINT hour; /* hour: 0 - 23 */ + USINT minute; /* minute: 0 - 59 */ + USINT second; /* second: 0 - 59 */ + /* 3. UDINT */ + UINT millisec; /* millisecond: 0 - 999 */ + UINT microsec; /* microsecond: 0 - 999 */ + } RTCtime_typ; + +/* structure for SYSxinfo */ +typedef struct SYSxinfo_typ { + char aws_name[6]; + char aws_type[2]; + UDINT cpu_info; + UINT ma_globl_len; + UINT md_globl_len; + UDINT os_len; + UDINT user_len; + UDINT tmp_len; + UDINT eprom_len; + UDINT fix_ram_len; + } SYSxinfo_typ; + +/* structure for MO_list */ +typedef struct MO_List_typ { + char name[14]; /* name of the module (ASCII) */ + USINT grp; /* groups */ + USINT type; /* module type */ + USINT state; /* state of the module */ + USINT reserve; + UDINT adress; /* physical address of the module */ + UDINT memtype; /* memory type (0=OTP,1=RAM,2=EPROM,3=FLASH */ + } MO_List_typ; /* 5=FIXRAM) */ + +/* structure for slMoList */ +typedef struct slMoList { + /* VAR_INPUT (analog) */ + unsigned long pMoName; + unsigned long sizeMoName; + unsigned long pAppMoName; + unsigned long sizeAppMoName; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned long moSize; + unsigned char moType; + unsigned char memType; + /* VAR (analog) */ + unsigned long i_hMo; + /* VAR_INPUT (digital) */ + plcbit enable; + plcbit first; + plcbit filter; +} slMoList_typ; + +/* structure for MO_info */ +typedef struct MO_info +{ + /* VAR_INPUT (analog) */ + unsigned long pName; + unsigned char grp; + /* VAR_OUTPUT (analog) */ + unsigned short status; + unsigned char type; + unsigned char state; + unsigned long memType; + unsigned long address; + unsigned long size; + unsigned char version[10]; + struct RTCtime_typ date; + /* VAR_INPUT (digital) */ + plcbit enable; +} MO_info_typ; + +/* structure for PV_list */ +typedef struct PV_List_typ { + char name[14]; /* name of the PV (ASCII) */ + USINT tcnr; /* PV task class */ + USINT grp; /* PV group */ + UDINT ident; /* PV identifier */ + UDINT adress; /* physical address of the PV */ + } PV_List_typ; + +/* structue for PV_xlist */ +typedef struct PV_xList_typ { + + char name[33]; /* name of PV (ASCII) */ + USINT data_typ; /* data type of PV */ + UDINT data_len; /* data length of PV */ + UDINT dimension; /* dimension of PV */ + UDINT adress; /* physical address of PV */ + }PV_xList_typ; + +/* structure for ERR_read */ +typedef struct ERR_typ { + UINT err_nr; /* error number */ + UDINT err_info; /* additional information */ + char t_name[5]; /* name of the running task */ + USINT err_type; /* error type (1=fatal, 2=warning, 3=info) */ + UINT err_year; /* time of the error in RTC format */ + USINT err_month; + USINT err_day; + USINT err_reserve; + USINT err_hour; + USINT err_minute; + USINT err_second; + UINT err_millisec; + UINT err_microsec; + } ERR_typ; + +/* structure for ERR_xread */ +typedef struct ERR_xtyp { + UINT err_nr; /* error number */ + UDINT err_info; /* additional information */ + char t_name[5]; /* name of the running task */ + USINT err_type; /* error type (1=Fatal, 2=Warning, 3=Info) */ + UINT err_year; /* time of the error in RTC format */ + USINT err_month; + USINT err_day; + USINT err_reserve; + USINT err_hour; + USINT err_minute; + USINT err_second; + UINT err_millisec; + UINT err_microsec; + USINT err_string[34]; /* 32 byte string with 0 termination */ + } ERR_xtyp; + +/* structure for MO_ver */ +typedef struct MoVerStruc_typ { + USINT version[10]; /* Version of the BR Module */ + UINT year; + USINT month; + USINT day; + USINT reserve; + USINT hour; + USINT minute; + USINT second; + } MoVerStruc_typ; + +/* structure for the FUB Bit2Byte */ +typedef struct Bit2Byte { + /* non boolean input parameter */ + UDINT bitadr; + UINT length; + /* non boolean output parameter*/ + UDINT byteadr; + /* non boolean static local */ + USINT byte_00; + USINT byte_01; + USINT byte_02; + USINT byte_03; + USINT byte_04; + USINT byte_05; + USINT byte_06; + USINT byte_07; + USINT byte_08; + USINT byte_09; + USINT byte_10; + USINT byte_11; + USINT byte_12; + USINT byte_13; + USINT byte_14; + USINT byte_15; + /* boolean input parameter */ + /* boolean output parameter */ + /* boolean static local */ + BOOL bmem000; + BOOL bmem001; + BOOL bmem002; + BOOL bmem003; + BOOL bmem004; + BOOL bmem005; + BOOL bmem006; + BOOL bmem007; + BOOL bmem008; + BOOL bmem009; + BOOL bmem010; + BOOL bmem011; + BOOL bmem012; + BOOL bmem013; + BOOL bmem014; + BOOL bmem015; + BOOL bmem016; + BOOL bmem017; + BOOL bmem018; + BOOL bmem019; + BOOL bmem020; + BOOL bmem021; + BOOL bmem022; + BOOL bmem023; + BOOL bmem024; + BOOL bmem025; + BOOL bmem026; + BOOL bmem027; + BOOL bmem028; + BOOL bmem029; + BOOL bmem030; + BOOL bmem031; + BOOL bmem032; + BOOL bmem033; + BOOL bmem034; + BOOL bmem035; + BOOL bmem036; + BOOL bmem037; + BOOL bmem038; + BOOL bmem039; + BOOL bmem040; + BOOL bmem041; + BOOL bmem042; + BOOL bmem043; + BOOL bmem044; + BOOL bmem045; + BOOL bmem046; + BOOL bmem047; + BOOL bmem048; + BOOL bmem049; + BOOL bmem050; + BOOL bmem051; + BOOL bmem052; + BOOL bmem053; + BOOL bmem054; + BOOL bmem055; + BOOL bmem056; + BOOL bmem057; + BOOL bmem058; + BOOL bmem059; + BOOL bmem060; + BOOL bmem061; + BOOL bmem062; + BOOL bmem063; + BOOL bmem064; + BOOL bmem065; + BOOL bmem066; + BOOL bmem067; + BOOL bmem068; + BOOL bmem069; + BOOL bmem070; + BOOL bmem071; + BOOL bmem072; + BOOL bmem073; + BOOL bmem074; + BOOL bmem075; + BOOL bmem076; + BOOL bmem077; + BOOL bmem078; + BOOL bmem079; + BOOL bmem080; + BOOL bmem081; + BOOL bmem082; + BOOL bmem083; + BOOL bmem084; + BOOL bmem085; + BOOL bmem086; + BOOL bmem087; + BOOL bmem088; + BOOL bmem089; + BOOL bmem090; + BOOL bmem091; + BOOL bmem092; + BOOL bmem093; + BOOL bmem094; + BOOL bmem095; + BOOL bmem096; + BOOL bmem097; + BOOL bmem098; + BOOL bmem099; + BOOL bmem100; + BOOL bmem101; + BOOL bmem102; + BOOL bmem103; + BOOL bmem104; + BOOL bmem105; + BOOL bmem106; + BOOL bmem107; + BOOL bmem108; + BOOL bmem109; + BOOL bmem110; + BOOL bmem111; + BOOL bmem112; + BOOL bmem113; + BOOL bmem114; + BOOL bmem115; + BOOL bmem116; + BOOL bmem117; + BOOL bmem118; + BOOL bmem119; + BOOL bmem120; + BOOL bmem121; + BOOL bmem122; + BOOL bmem123; + BOOL bmem124; + BOOL bmem125; + BOOL bmem126; + BOOL bmem127; + BOOL bmem128; + BOOL bmem129; + BOOL bmem130; + BOOL bmem131; + BOOL bmem132; + BOOL bmem133; + BOOL bmem134; + BOOL bmem135; + BOOL bmem136; + BOOL bmem137; + BOOL bmem138; + BOOL bmem139; + } Bit2Byte_typ; + +/* structure for the FUB Byte2Bit */ +typedef struct Byte2Bit { + /* non boolean input parameter */ + UDINT byteadr; + UINT length; + /* non boolean output parameter*/ + UDINT bitadr; + /* non boolean static local */ + /* boolean input parameter */ + /* boolean output parameter */ + /* boolean static local */ + BOOL bmem000; + BOOL bmem001; + BOOL bmem002; + BOOL bmem003; + BOOL bmem004; + BOOL bmem005; + BOOL bmem006; + BOOL bmem007; + BOOL bmem008; + BOOL bmem009; + BOOL bmem010; + BOOL bmem011; + BOOL bmem012; + BOOL bmem013; + BOOL bmem014; + BOOL bmem015; + BOOL bmem016; + BOOL bmem017; + BOOL bmem018; + BOOL bmem019; + BOOL bmem020; + BOOL bmem021; + BOOL bmem022; + BOOL bmem023; + BOOL bmem024; + BOOL bmem025; + BOOL bmem026; + BOOL bmem027; + BOOL bmem028; + BOOL bmem029; + BOOL bmem030; + BOOL bmem031; + BOOL bmem032; + BOOL bmem033; + BOOL bmem034; + BOOL bmem035; + BOOL bmem036; + BOOL bmem037; + BOOL bmem038; + BOOL bmem039; + BOOL bmem040; + BOOL bmem041; + BOOL bmem042; + BOOL bmem043; + BOOL bmem044; + BOOL bmem045; + BOOL bmem046; + BOOL bmem047; + BOOL bmem048; + BOOL bmem049; + BOOL bmem050; + BOOL bmem051; + BOOL bmem052; + BOOL bmem053; + BOOL bmem054; + BOOL bmem055; + BOOL bmem056; + BOOL bmem057; + BOOL bmem058; + BOOL bmem059; + BOOL bmem060; + BOOL bmem061; + BOOL bmem062; + BOOL bmem063; + BOOL bmem064; + BOOL bmem065; + BOOL bmem066; + BOOL bmem067; + BOOL bmem068; + BOOL bmem069; + BOOL bmem070; + BOOL bmem071; + BOOL bmem072; + BOOL bmem073; + BOOL bmem074; + BOOL bmem075; + BOOL bmem076; + BOOL bmem077; + BOOL bmem078; + BOOL bmem079; + BOOL bmem080; + BOOL bmem081; + BOOL bmem082; + BOOL bmem083; + BOOL bmem084; + BOOL bmem085; + BOOL bmem086; + BOOL bmem087; + BOOL bmem088; + BOOL bmem089; + BOOL bmem090; + BOOL bmem091; + BOOL bmem092; + BOOL bmem093; + BOOL bmem094; + BOOL bmem095; + BOOL bmem096; + BOOL bmem097; + BOOL bmem098; + BOOL bmem099; + BOOL bmem100; + BOOL bmem101; + BOOL bmem102; + BOOL bmem103; + BOOL bmem104; + BOOL bmem105; + BOOL bmem106; + BOOL bmem107; + BOOL bmem108; + BOOL bmem109; + BOOL bmem110; + BOOL bmem111; + BOOL bmem112; + BOOL bmem113; + BOOL bmem114; + BOOL bmem115; + BOOL bmem116; + BOOL bmem117; + BOOL bmem118; + BOOL bmem119; + BOOL bmem120; + BOOL bmem121; + BOOL bmem122; + BOOL bmem123; + BOOL bmem124; + BOOL bmem125; + BOOL bmem126; + BOOL bmem127; + BOOL bmem128; + BOOL bmem129; + BOOL bmem130; + BOOL bmem131; + BOOL bmem132; + BOOL bmem133; + BOOL bmem134; + BOOL bmem135; + BOOL bmem136; + BOOL bmem137; + BOOL bmem138; + BOOL bmem139; + } Byte2Bit_typ; + +/***************/ +/* Prototyping of functions and function blocks */ +_BUR_PUBLIC UINT PV_ident (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr, + UDINT *pv_ident); +_BUR_PUBLIC UINT PV_setval (UDINT pv_ident, UDINT value); +_BUR_PUBLIC UINT PV_getval (UDINT pv_ident, UDINT *value); +_BUR_PUBLIC UINT PV_getadr (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr, + UDINT *pv_adresse); +_BUR_PUBLIC UINT PV_xgetadr (char *pv_name, UDINT *pv_adresse, UDINT *data_len); +_BUR_PUBLIC UINT PV_xsetval (UDINT pv_ident, UINT subindex, void *data_p, + USINT data_len); +_BUR_PUBLIC UINT PV_xgetval (UDINT pv_ident, UINT subindex, void *data_p, + USINT data_len); +_BUR_PUBLIC UINT PV_info (UDINT pv_ident, UDINT *data_type, UDINT *data_len, + UINT *dimension); +_BUR_PUBLIC UINT PV_list (UINT prev_index, UINT *index, PV_List_typ *pvl_p); +_BUR_PUBLIC UINT PV_xlist (UINT prev_index, UINT *index, PV_xList_typ *pvl_p); +_BUR_PUBLIC UINT PV_item (char *pv_name, UINT index, char *itemname); +_BUR_PUBLIC UINT PV_ninfo (char *pv_name, UDINT *data_typ_p, UDINT *data_len_p, + UINT *dimension_p); + + + +_BUR_PUBLIC UINT SYS_info (UDINT *sg_init_cnt, UDINT *sg_initdescr, UDINT *sg_tickcnt, + UDINT *sg_version, UDINT *sg_ov_version); +_BUR_PUBLIC UINT SYSxinfo (SYSxinfo_typ *sx_p); +_BUR_PUBLIC UINT SYSreset (BOOL enable, USINT mode); +_BUR_PUBLIC USINT SYS_battery (void); + +_BUR_PUBLIC UINT MO_list (UINT prev_index, UINT *index, MO_List_typ *mol_p); +_BUR_PUBLIC void MO_info (struct MO_info* pInst); +_BUR_PUBLIC void slMoList (slMoList_typ * pInst); + +_BUR_PUBLIC UINT KEY_enadis (BOOL mode); +_BUR_PUBLIC UINT KEY_read (USINT keys[4]); + +_BUR_PUBLIC UINT FORCE_info (USINT tcnr, BOOL *force); + +_BUR_PUBLIC UINT ST_ident (char *st_name_p, USINT st_grp, UDINT *st_ident); +_BUR_PUBLIC UINT ST_suspend (UDINT st_ident); +_BUR_PUBLIC UINT ST_resume (UDINT st_ident); +_BUR_PUBLIC UINT ST_tmp_suspend (UDINT st_ident); +_BUR_PUBLIC UINT ST_tmp_resume (UDINT st_ident); +_BUR_PUBLIC UINT ST_allsuspend (void); +_BUR_PUBLIC UINT ST_info (UDINT st_ident, USINT *state, SINT *tcnr); +_BUR_PUBLIC UINT ST_name (UDINT st_ident, char *st_name_p, USINT *st_grp); + +_BUR_PUBLIC UINT UT_ident (char *ut_name_p, USINT ut_grp, USINT ut_proc, char *ut_sps_p,UDINT *ut_ident); +_BUR_PUBLIC UINT UT_suspend (UDINT ut_ident); +_BUR_PUBLIC UINT UT_resume (UDINT ut_ident); +_BUR_PUBLIC UINT UT_sleep (UDINT tickcount); +_BUR_PUBLIC UINT UT_sendmsg (UDINT ut_ident, void *msg, UDINT msglng, UDINT flags); +_BUR_PUBLIC UINT UT_recmsg (UDINT *ut_ident, void **msg, UDINT *msglng, UDINT flags); +_BUR_PUBLIC UINT UT_freemsg (UDINT msglng, void *msg); +_BUR_PUBLIC UINT UT_exit (UDINT exitinfo); + + +_BUR_PUBLIC UINT AVT_create (char *name_p, USINT grupid, UDINT av_info, UDINT *av_ident); +_BUR_PUBLIC UINT AVT_cancel (UDINT av_ident); +_BUR_PUBLIC UINT AVT_ident (char *name_p, USINT grupid, UDINT *av_ident); +_BUR_PUBLIC UINT AVT_attach (UDINT av_ident, UDINT *av_info); +_BUR_PUBLIC UINT AVT_release (UDINT av_ident); +_BUR_PUBLIC UINT AVT_info (UDINT av_ident, USINT *av_linkcount); + +_BUR_PUBLIC UINT MEM_alloc (UDINT memlng, void **memptr); +_BUR_PUBLIC UINT MEM_free (UDINT memlng, void *memptr); +_BUR_PUBLIC UINT TMP_alloc (UDINT memlng, void **memptr); +_BUR_PUBLIC UINT TMP_free (UDINT memlng, void *memptr); + +_BUR_PUBLIC UINT RTC_gettime (RTCtime_typ *rtctime); +_BUR_PUBLIC UINT RTC_settime (RTCtime_typ *rtctime); +_BUR_PUBLIC UINT SW_gettime (RTCtime_typ *rtctime); +_BUR_PUBLIC UINT SW_settime (RTCtime_typ *rtctime); +_BUR_PUBLIC UINT TIM_musec (void); +_BUR_PUBLIC UINT TIM_ticks (void); + +_BUR_PUBLIC UINT SM_create (char *sm_name, USINT sm_count, UDINT *sm_ident); +_BUR_PUBLIC UINT SM_ident (char *sm_name, UDINT *sm_ident); +_BUR_PUBLIC UINT SM_delete (UDINT sm_ident); +_BUR_PUBLIC UINT SM_attach (UDINT sm_ident, UDINT timeout, UDINT flags); +_BUR_PUBLIC UINT SM_release (UDINT sm_ident); + +_BUR_PUBLIC UINT ERR_warning (UINT errornr, UDINT errorinfo); +_BUR_PUBLIC UINT ERR_fatal (UINT errornr, UDINT errorinfo); +_BUR_PUBLIC UINT ERR_read (UINT entry_nr, ERR_typ *err_p); +_BUR_PUBLIC UINT ERRxwarning (UINT errornr, UDINT errorinfo, char* errorstring); +_BUR_PUBLIC UINT ERRxread (UINT entry_nr, ERR_xtyp *err_p); +_BUR_PUBLIC UINT ERRxfatal (UINT errornr, UDINT errorinfo, char* errorstring); + +_BUR_PUBLIC UINT DIS_str (UDINT row, UDINT col, char *string); +_BUR_PUBLIC UINT DIS_chr (UDINT row, UDINT col, char character); +_BUR_PUBLIC UINT DIS_clr (void); + +_BUR_PUBLIC UINT DA_create (char *name_p, USINT grp, UINT spooladr, UDINT data_len, + void *data_p, void **mo_data_p, UDINT *mo_ident); +_BUR_PUBLIC UINT DA_write (UDINT mo_ident, void *data_p,UDINT data_len, + UDINT mo_data_offset); +_BUR_PUBLIC UINT DA_read (UDINT mo_ident, void *data_p,UDINT data_len, + UDINT mo_data_offset); +_BUR_PUBLIC UINT DA_ident (char *name_p, USINT grp, UDINT *mo_ident); +_BUR_PUBLIC UINT DA_delete (UDINT mo_ident); +_BUR_PUBLIC UINT DA_burn (UDINT mo_ident); +_BUR_PUBLIC UINT DA_fix (UDINT mo_ident); +_BUR_PUBLIC UINT DA_info (UDINT mo_ident, void **moduldata_adr, UDINT *moduldata_lng, + USINT *memorytype); +_BUR_PUBLIC UINT DA_copy (UDINT mo_ident, char *new_name, USINT mem_typ, UDINT *da_ident, + UDINT *daten_p, UDINT *daten_len); +_BUR_PUBLIC UINT DA_store (UDINT mo_ident, USINT mem_typ, UDINT* daten_p, UDINT* daten_len); + +_BUR_PUBLIC UINT MO_ver (STRING *pName, USINT grp, MoVerStruc_typ* pMoVerStruc); + +_BUR_PUBLIC void Bit2Byte (Bit2Byte_typ* Bit2Byte_ptr); +_BUR_PUBLIC void Byte2Bit (Byte2Bit_typ* Byte2Bit_ptr); + +#ifdef __cplusplus +}; +#endif +#endif /* _SYS_LIB_H_ */ + + diff --git a/Logical/Libraries/sys_lib/binary.lby b/Logical/Libraries/sys_lib/binary.lby new file mode 100644 index 0000000..8360c7b --- /dev/null +++ b/Logical/Libraries/sys_lib/binary.lby @@ -0,0 +1,12 @@ + + + + + sys_lib.fun + sys_lib.typ + sys_lib.var + + + + + \ No newline at end of file diff --git a/Logical/Libraries/sys_lib/sys_lib.fun b/Logical/Libraries/sys_lib/sys_lib.fun new file mode 100644 index 0000000..4111403 --- /dev/null +++ b/Logical/Libraries/sys_lib/sys_lib.fun @@ -0,0 +1,655 @@ + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK Byte2Bit (*converts a byte array into a bit array*) + VAR_INPUT + byteadr :UDINT; (*byte array address*) + length :UINT; (*byte array length (1 through 16)*) + END_VAR + VAR_OUTPUT + bitadr :UDINT; (*bit array address*) + END_VAR + VAR + bmem000 :BOOL; (*internal variable*) + static_val :ARRAY[0..138] OF USINT; (*internal variable*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK Bit2Byte (*converts a bit array into a byte array where every bit of data corresponds to an element in the bit array*) + VAR_INPUT + bitadr :UDINT; (*BIT array address*) + length :UINT; (*BIT array length (1 through 128)*) + END_VAR + VAR_OUTPUT + byteadr :UDINT; (*BYTE array address*) + END_VAR + VAR + byte_00 :USINT; (*internal variable*) + byte_01 :USINT; (*internal variable*) + byte_02 :USINT; (*internal variable*) + byte_03 :USINT; (*internal variable*) + byte_04 :USINT; (*internal variable*) + byte_05 :USINT; (*internal variable*) + byte_06 :USINT; (*internal variable*) + byte_07 :USINT; (*internal variable*) + byte_08 :USINT; (*internal variable*) + byte_09 :USINT; (*internal variable*) + byte_10 :USINT; (*internal variable*) + byte_11 :USINT; (*internal variable*) + byte_12 :USINT; (*internal variable*) + byte_13 :USINT; (*internal variable*) + byte_14 :USINT; (*internal variable*) + byte_15 :USINT; (*internal variable*) + bmem000 :BOOL; (*internal variable*) + static_val :ARRAY[0..138] OF USINT; (*internal variable*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION KEY_read : UINT (*reads the status of the keys on the CPU*) + VAR_INPUT + keys :UDINT; (*array variable for storing key states*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION KEY_enadis : UINT (*disables key handling by the operating system (operating mode 0)*) + VAR_INPUT + mode :BOOL; (*operating mode: 0 ... key handling by the operating system, 1 ... key handling by an application program*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_fix : UINT (*transfers a data object to the FIXRAM*) + VAR_INPUT + mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_info : UINT (*provides information about the data object*) + VAR_INPUT + mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*) + moduldata_adr :UDINT; (*data address in the data object*) + moduldata_len :UDINT; (*pointer to length of the data (in bytes)*) + memorytype :UDINT; (*pointer to memory type*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_copy : UINT (*copies a data object into the specified memory (RAM, User ROM, MEMCARD or FIXRAM) under the name new_name*) + VAR_INPUT + mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*) + new_name :UDINT; (*pointer to name of the new data object*) + mem_typ :USINT; (*memory type, e.g. 1...RAM, 2...User ROM, ..*) + da_ident :UDINT; (*pointer to ID number of the copied data object*) + daten_p :UDINT; (*data address in the new data object*) + daten_len :UDINT; (*pointer to data length in the new data object (in bytes)*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_store : UINT (*saves a data object in the specified memory (RAM, UserROM, MEMCARD or FIXRAM)*) + VAR_INPUT + mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*) + mem_typ :USINT; (*memory type, e.g. 1...RAM, 2...User ROM, ..*) + daten_p :UDINT; (*data address in the new data object*) + daten_len :UDINT; (*pointer to data length in the new data object (in bytes)*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_burn : UINT (*transfers a data object to UserROM*) + VAR_INPUT + mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_delete : UINT (*deletes a data object from the memory (RAM, User ROM, MEMCARD or FIXRAM)*) + VAR_INPUT + mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_ident : UINT (*provides the ID number of an existing data object*) + VAR_INPUT + name_p :UDINT; (*pointer to name of the data object*) + grp :USINT; (*group number (standard = 0)*) + mo_ident :UDINT; (*pointer to ID number of the data object*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_read : UINT (*reads data from a module in the RAM or FIXRAM*) + VAR_INPUT + mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*) + data_p :UDINT; (*pointer to data range*) + data_len :UDINT; (*length of the data (in bytes)*) + mo_data_offset :UDINT; (*offset in the data area of the module*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_write : UINT (*writes data to a data object in RAM or FIXRAM*) + VAR_INPUT + mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*) + data_p :UDINT; (*pointer to data range*) + data_len :UDINT; (*length of the data (in bytes)*) + mo_data_offset :UDINT; (*offset in the data area of the module*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DA_create : UINT (*generates a data object with corresponding parameter in the RAM*) + VAR_INPUT + name_p :UDINT; (*pointer to name of the data object*) + grp :USINT; (*group Number (standard = 0)*) + spooladr :UINT; (*spool address (standard = 0)*) + data_len :UDINT; (*length of the data (in bytes)*) + data_p :UDINT; (*pointer to data which is written in the data object*) + mo_data_p :UDINT; (*data address in the data object*) + mo_ident :UDINT; (*pointer to ID number of the data object*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DIS_clr : UINT (*clears the CPU status display (B&R 2010 system only)*) + VAR_INPUT + dummy_input :USINT; (*required for operation in ladder diagram*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DIS_chr : UINT (*writes a ASCII character to the CPU status display*) + VAR_INPUT + row :UDINT; (*row number (0 or 1) where the ASCII character is to be output*) + col :UDINT; (*column number (0 through 7) where the ASCII character is to be output*) + character :SINT; (*ASCII character that is to be output on the status display*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION DIS_str : UINT (*writes a character string to the CPU status display*) + VAR_INPUT + row :UDINT; (*row number (0 or 1) where the string is to be output*) + col :UDINT; (*column number (0 through 7) from where the string is to be output*) + string :UDINT; (*pointer to string (ending in zero) that is to be output on the status display*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION ERRxfatal : UINT (*makes an log book entry in the error log book*) + VAR_INPUT + errornr :UINT; (*error number, which is entered in the error log book*) + errorinfo :UDINT; (*optional additional information (error details)*) + errorstring :UDINT; (*pointer to string, ending in zero (32 characters maximum)*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ERR_read : UINT (*reads an entry from the error log book and writes the information in a structure (ERR_typ_struct)*) + VAR_INPUT + entry_nr :UINT; (*number of the log book entry that is to be read*) + ERR_typ_struct :UDINT; (*pointer to structure in which information about the log book entry is written*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ERRxread : UINT (*reads an entry from the error log book and writes the information in a structure (ERR_typ_struct)*) + VAR_INPUT + entry_nr :UINT; (*number of the log book entry that is to be read*) + ERR_xtyp_struct :UDINT; (*pointer to structure in which information about the log book entry is written*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ERR_fatal : UINT (*makes an entry (log book entry) in the error log book*) + VAR_INPUT + errornr :UINT; (*error number, which is entered in the error log book*) + errorinfo :UDINT; (*optional additional information (error details)*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ERR_warning : UINT (*makes an entry (log book entry) in the error log book*) + VAR_INPUT + errornr :UINT; (*error number, which is entered in the error log book*) + errorinfo :UDINT; (*optional additional information (error details)*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ERRxwarning : UINT (*makes an entry (log book entry) in the error log book*) + VAR_INPUT + errornr :UINT; (*error number, which is entered in the error log book*) + errorinfo :UDINT; (*optional additional information (error details)*) + errorstring :UDINT; (*string ending in zero (32 characters maximum)*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION SM_release : UINT (*releases the semaphore with the specified ID number*) + VAR_INPUT + sm_ident :UDINT; (*semaphore ID number from SM_create() or SM_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION SM_attach : UINT (*requests the use of a semaphore*) + VAR_INPUT + sm_ident :UDINT; (*semaphore ID number from SM_create() or SM_ident()*) + timeout :UDINT; (*timeout time in units of 10 ms (0 = unlimited timeout time)*) + flags :UDINT; (*0 ... wait for timeout time to elapse, 1 ... do not wait for timeout time to elapse*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION SM_delete : UINT (*deletes the semaphore with the specified ID number*) + VAR_INPUT + sm_ident :UDINT; (*semaphore ID number from SM_create() or SM_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION SM_ident : UINT (*provides the ID number of an existing semaphore*) + VAR_INPUT + sm_name :UDINT; (*pointer to semaphore name*) + sm_ident :UDINT; (*pointer to ID number of the semaphore*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION SM_create : UINT (*generates a semaphore using the specified parameter and provides the ID number of the semaphore*) + VAR_INPUT + sm_name :UDINT; (*semaphore name, given as a string*) + sm_count :USINT; (*number of permitted instances of simultaneous access using the semaphore*) + sm_ident :UDINT; (*ID number of the semaphore*) + END_VAR +END_FUNCTION + +{REDUND_OK} {REDUND_UNREPLICABLE} FUNCTION TIM_ticks : UINT (*provides the number of ticks (1 tick = 10 ms) in the current second*) +(* The dummy_input parameter is obsolete. + VAR_INPUT + dummy_input :USINT; required for operation in ladder diagram + END_VAR *) +END_FUNCTION + +{REDUND_OK} {REDUND_UNREPLICABLE} FUNCTION TIM_musec : UINT (*provides the (approximate) number of microseconds in the current tick (1 tick = 10 ms)*) +(* The dummy_input parameter is obsolete. + VAR_INPUT + dummy_input :USINT; required for operation in ladder diagram + END_VAR *) +END_FUNCTION + +{REDUND_ERROR} FUNCTION SW_settime : UINT (*sets the software clock to the desired time (RTCtime_struct structure)*) + VAR_INPUT + RTCtime_struct :UDINT; (*pointer to the structure which contains the time and date*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION SW_gettime : UINT (*reads the time and date from the software clock and writes this information in a RTCtime_struct structure*) + VAR_INPUT + RTCtime_struct :UDINT; (*pointer to the structure where the time and date are stored*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION RTC_settime : UINT (*sets the real-time clock to the desired time (RTCtime_struct structure)*) + VAR_INPUT + RTCtime_struct :UDINT; (*pointer to the structure which contains the time and date*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION RTC_gettime : UINT (*reads time and date from the real-time clock and writes this information in a RTCtime_struct structure*) + VAR_INPUT + RTCtime_struct :UDINT; (*pointer to the structure where the time and date are stored*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION TMP_free : UINT (*releases a memory area, which has been allocated using TMP_alloc()*) + VAR_INPUT + memlng :UDINT; (*size of the memory area to be released in bytes*) + memptr :UDINT; (*address for the memory area to be released*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION TMP_alloc : UINT (*allocates memory in the temporary memory area (system RAM only)*) + VAR_INPUT + memlng :UDINT; (*size of the allocated memory area in bytes*) + memptr :UDINT; (*pointer to requested memory area*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION MEM_free : UINT (*releases a memory area, which has been allocated using MEM_alloc()*) + VAR_INPUT + memlng :UDINT; (*size of the memory area to be released in bytes*) + memptr :UDINT; (*address for the memory area to be released*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION MEM_alloc : UINT (*allocates memory in the user memory area (user RAM only)*) + VAR_INPUT + memlng :UDINT; (*size of the allocated memory area in bytes*) + memptr :UDINT; (*pointer to requested memory area*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION AVT_info : UINT (*determines how many links there are to the AVT entry with the specified AVT ID number*) + VAR_INPUT + av_ident :UDINT; (*AVT ID number from AVT_create() or AVT_ident()*) + av_linkcount :UDINT; (*link count (number of access to this AVT entry)*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION AVT_release : UINT (*releases the AVT entry with the specified AVT ID number*) + VAR_INPUT + av_ident :UDINT; (*AVT ID number from AVT_create() or AVT_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION AVT_attach : UINT (*attachs information to an AVT entry*) + VAR_INPUT + av_ident :UDINT; (*AVT ID number from AVT_create() or AVT_ident()*) + av_info :UDINT; (*pointer to AVT info (e.g.: data address)*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION AVT_ident : UINT (*provides the AVT ID number for an existing AVT entry*) + VAR_INPUT + av_name :UDINT; (*pointer to name of AVT entry*) + av_grp :USINT; (*group number (standard = 0)*) + av_ident :UDINT; (*pointer to AVT ident number*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION AVT_cancel : UINT (*deletes the entry with the specified AVT ID number from the AVT*) + VAR_INPUT + av_ident :UDINT; (*AVT ID number from AVT_create() or AVT_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION AVT_create : UINT (*generates an AVT entry with the specified name and provides an ID number*) + VAR_INPUT + av_name :UDINT; (*pointer to name of AVT entry*) + av_grp :USINT; (*group number (standard = 0)*) + av_info :UDINT; (*AVT info (e.g.: data address)*) + av_ident :UDINT; (*pointer to AVT ident number*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION UT_sleep : UINT (*stops the idle time object for a set period of time*) + VAR_INPUT + tickcount :UDINT; (*number of ticks (1 tick = 10 ms) for which an idle time object is stopped*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION UT_exit : UINT (*exits an idle time object*) + VAR_INPUT + exitinfo :UDINT; (*exit information (standard = 0)*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION UT_freemsg : UINT (*releases the memory which was taken up by a received message*) + VAR_INPUT + msglng :UDINT; (*size of the memory to be released (in bytes)*) + msg :UDINT; (*pointer to memory to be released*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION UT_recmsg : UINT (*receives a message sent using the UT_sendmsg() function*) + VAR_INPUT + ut_ident :UDINT; (*pointer to ID number of the object to which the message was sent*) + msg :UDINT; (*address at which the received message should be saved*) + msglng :UDINT; (*pointer to length of the received data in bytes*) + flags :UDINT; (*Bit 1 = 1: do not wait for UT_sendmsg()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION UT_sendmsg : UINT (*sends a message to another object (including cyclic objects)*) + VAR_INPUT + ut_ident :UDINT; (*ID number of the object to which the message is to be sent (from UT_ident())*) + msg :UDINT; (*pointer to message to be sent*) + msglng :UDINT; (*length of the message to be sent (in bytes)*) + flags :UDINT; (*Bit 1 = 1: do not wait for UT_recmsg()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION UT_resume : UINT (*restarts a stopped idle time object*) + VAR_INPUT + ut_ident :UDINT; (*ID number from UT_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION UT_suspend : UINT (*stops the idle time object with the specified ID number*) + VAR_INPUT + ut_ident :UDINT; (*ID number from UT_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION UT_ident : UINT (*provides the ID number of an idle time object*) + VAR_INPUT + ut_name :UDINT; (*pointer to name of the idle time object*) + ut_grp :USINT; (*group number (standard = 0)*) + ut_proc :USINT; (*processor number (standard: 0 = current processor)*) + ut_sps_p :UDINT; (*pointer to name of the target system*) + ut_ident :UDINT; (*pointer to ID number of the idle time object*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ST_name : UINT (*provides the name and group number for the object with the relevant ID number*) + VAR_INPUT + st_ident :UDINT; (*ID number for the object from ST_ident() (0 = the object itself)*) + st_name_p :UDINT; (*pointer to name of the object*) + st_grp :UDINT; (*pointer to group number for the object (standard = 0)*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ST_info : UINT (*provides information about the object with the relevant ID number*) + VAR_INPUT + st_ident :UDINT; (*ID number for the object from ST_ident() (0 = the object itself)*) + state :UDINT; (*pointer to status of the object: 1 ... Object installed, 2 ... Object running, ..*) + tknr :UDINT; (*pointer to resource information: 1 through 8 ... Cyclic resource, -8 ... Exception resource, ..*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ST_allsuspend : UINT (*suspends all cyclic software objects*) + VAR_INPUT + dummy_input :USINT; (*required for operation in ladder diagram*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ST_tmp_resume : UINT (*activates a previously stopped (cyclic) software object*) + VAR_INPUT + st_ident :UDINT; (*ID number for the software object from ST_ident()*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ST_tmp_suspend : UINT (*suspends a cyclic object temporarily*) + VAR_INPUT + st_ident :UDINT; (*ID number for the object from ST_ident() (0 = object suspends itself)*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION ST_resume : UINT (*activates a previously stopped (cyclic) software object*) + VAR_INPUT + st_ident :UDINT; (*ID number for the software object from ST_ident()*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION ST_suspend : UINT (*suspends a cyclic object permanently*) + VAR_INPUT + st_ident :UDINT; (*ID number for the object from ST_ident()(0 = object suspends itself)*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ST_ident : UINT (*provides the ID number for a software object*) + VAR_INPUT + st_name :UDINT; (*pointer to name of the software object*) + st_grp :USINT; (*group number for the object (standard = 0)*) + st_ident :UDINT; (*pointer to ID number of the object*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION FORCE_info : UINT (*determines whether or not a variable is forced in the objects of the specified resource (tk_nr)*) + VAR_INPUT + tknr :USINT; (*resource that is to be checked: 1 through 4 ... cyclic resource, -9 ... Interrupt resource, ..*) + force :UDINT; (*given as a pointer: 1 ... force function is active, 0 ... force function is inactive*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION MO_ver : UINT (*reads the version and the date of a B&R module*) + VAR_INPUT + pName :UDINT; (*pointer to name of the B&R module*) + grp :USINT; (*group number for the object (standard = 0)*) + pMoVerStruc :UDINT; (*pointer to the structure where the module version of the located B&R module is stored*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION MO_list : UINT (*browses all the B&R modules on the target system*) + VAR_INPUT + prev_index :UINT; (*index of the B&R module where the search is being started*) + index :UDINT; (*pointer to index of the found B&R module*) + MO_List_struct :UDINT; (*pointer to structure where the module information is stored*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK MO_info (*reads information of a B&R module on the target system*) + VAR_INPUT + enable :BOOL; (*enables execution*) + pName :UDINT; (*pointer to name of the B&R module*) + grp :USINT; (*group number for the object (standard = 0)*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + type :USINT; (*B&R module type*) + state :USINT; (*B&R module status*) + memType :UDINT; (*memory of the B&R module*) + address :UDINT; (*physical address of the B&R module*) + size :UDINT; (*size of the B&R module*) + version :ARRAY[0..9] OF USINT; (*B&R module version*) + date :RTCtime_typ; (*B&R module date*) + END_VAR +END_FUNCTION_BLOCK + +{REDUND_ERROR} FUNCTION SYS_battery : USINT (*indicates the status of the standard/rechargeable battery in the CPU and the battery in the APM*) + VAR_INPUT + dummy_input :USINT; (*required for operation in ladder diagram*) + END_VAR +END_FUNCTION + +{REDUND_OK} {REDUND_UNREPLICABLE} FUNCTION SYSreset : UINT (*initiates a boot procedure on the target system in the specified mode (WARM or COLD START)*) + VAR_INPUT + enable :BOOL; (*enables execution*) + mode :USINT; (*boot mode: 0x01 .. WARM START (with Restart), 0x02 .. COLD START (with Restart), ..*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION SYSxinfo : UINT (*reads the additional system information and writes this information into a SYSxinfo_struct structure*) + VAR_INPUT + SYSxinfo_struct :UDINT; (*pointer to structure where the additional system information is stored, given as a pointer*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION SYS_info : UINT (*provides information about the system*) + VAR_INPUT + init_count :UDINT; (*pointer to number of previously executed warm restarts*) + init_descr :UDINT; (*pointer to mode of last start-up: 1 ... WARM RESTART, 2 ... COLD RESTART, ..*) + tick_count :UDINT; (*pointer to tick counter*) + version :UDINT; (*pointer to operating system version number*) + ov_version :UDINT; (*pointer to object directory version number*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION PV_xlist : UINT (*browse all the variables*) + VAR_INPUT + prev_index :UINT; (*index of the PV where the search is being started*) + index :UDINT; (*pointer to index of the located PV*) + PV_xList_struct :UDINT; (*pointer to structure which contains PV information about the located PV*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION PV_ninfo : UINT (*reads data from a process variable of a complex data type (array or structure variable)*) + VAR_INPUT + pv_name :UDINT; (*pointer to name of the process variable*) + data_typ_p :UDINT; (*pointer to data type of the PV*) + data_len_p :UDINT; (*pointer to length of the PV in bytes*) + dimension_p :UDINT; (*pointer to number of array or structure elements*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION PV_item : UINT (*determines the names of structure elements*) + VAR_INPUT + pv_name :UDINT; (*pointer to name of the process variable*) + index :UINT; (*structure element index*) + itemname :UDINT; (*pointer to name of the structure element*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION PV_ident : UINT (*provides the ID number of a process variable (PV)*) + VAR_INPUT + pv_name :UDINT; (*pointer to name of the process variable*) + pv_tknr :USINT; (*process variable resource*) + pv_grp :USINT; (*group number *) + pv_ident :UDINT; (*pointer to PV ID number*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION PV_list : UINT (*browses all variables*) + VAR_INPUT + prev_index :UINT; (*index of the PV where the search is being started*) + index :UDINT; (*pointer to index of the located PV*) + PVList_struct :UDINT; (*pointer to structure which contains PV information about the located PV*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION PV_info : UINT (*reads data from a process variable of a complex data type (array or structure variable)*) + VAR_INPUT + pv_ident :UDINT; (*ID number of the process variable from PV_ident()*) + data_typ :UDINT; (*pointer to data type of the PV*) + data_len :UDINT; (*pointer to length of the PV in bytes*) + dimension :UDINT; (*pointer to number of array or structure elements*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION PV_xgetval : UINT (*reads data from a process variable of a complex data type (array or structure variable)*) + VAR_INPUT + pv_ident :UDINT; (*ID number of the process variable from PV_ident()*) + subindex :UINT; (*element index: 0 ... Entire array/structure, 1 ... 1st element of the array/structure, ..*) + data_p :UDINT; (*pointer to data read*) + data_len :USINT; (*length of the data to be read in bytes*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION PV_xsetval : UINT (*sets a particular value for a process variable of a complex data type (array variable or structure variable)*) + VAR_INPUT + pv_ident :UDINT; (*ID number of the process variable from PV_ident()*) + subindex :UINT; (*element index: 0 ... Entire array/structure, 1 ... 1st element of the array/structure, ..*) + data_p :UDINT; (*pointer to data assigned to the PV*) + data_len :USINT; (*length of the data in bytes*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION PV_xgetadr : UINT (*provides the address and length of a variable*) + VAR_INPUT + pv_name_p :UDINT; (*pointer to name of the process variable*) + pv_adresse :UDINT; (*PV address for dynamic access*) + data_len :UDINT; (*pointer to length of the process variable in bytes*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION PV_getadr : UINT (*provides the address of a process variable*) + VAR_INPUT + pv_name_p :UDINT; (*pointer to name of the process variable*) + pv_tknr :USINT; (*process variable resource: 1 ... Cyclic #1, timer #1-4, 2 ... Cyclic resource cyclic #2, ..*) + pv_grpnr :USINT; (*group number (standard = 0)*) + pv_adresse :UDINT; (*PV address for dynamic access*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION PV_getval : UINT (*reads the value of a process variable*) + VAR_INPUT + pv_ident :UDINT; (*ID number of the process variable from PV_ident()*) + value :UDINT; (*pointer to determined value of the PV*) + END_VAR +END_FUNCTION + +{REDUND_ERROR} FUNCTION PV_setval : UINT (*sets a particular value for a process variable*) + VAR_INPUT + pv_ident :UDINT; (*ID number of the process variable from PV_ident()*) + value :UDINT; (*value assigned to the PV*) + END_VAR +END_FUNCTION + +{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK slMoList (*browses the B&R modules on the target system*) + VAR_INPUT + enable :BOOL; (*enables execution*) + first :BOOL; (*starting point for browsing*) + filter :BOOL; (*filter for browsing in own application module*) + pMoName :UDINT; (*name of the B&R module given as a pointer*) + sizeMoName :UDINT; (*length of the string (pMoName) -> ideally, sizeMoName = 11*) + pAppMoName :UDINT; (*name of the application module given as a pointer*) + sizeAppMoName :UDINT; (*length of the string (pAppMoName) -> ideally, sizeAppMoName = 21*) + END_VAR + VAR_OUTPUT + status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*) + moSize :UDINT; (*size of the B&R module*) + moType :USINT; (*type of the B&R module*) + memType :USINT; (*memory type of the B&R module*) + END_VAR + VAR + i_hMo :UDINT; (*internal variable*) + END_VAR +END_FUNCTION_BLOCK diff --git a/Logical/Libraries/sys_lib/sys_lib.typ b/Logical/Libraries/sys_lib/sys_lib.typ new file mode 100644 index 0000000..7dc0ff1 --- /dev/null +++ b/Logical/Libraries/sys_lib/sys_lib.typ @@ -0,0 +1,90 @@ + +TYPE + MoVerStruc_typ : STRUCT + version : ARRAY[0..9] OF USINT ; + year : UINT ; + month : USINT ; + day : USINT ; + reserve : USINT ; + hour : USINT ; + minute : USINT ; + second : USINT ; + END_STRUCT; + ERR_xtyp : STRUCT + err_nr : UINT ; + err_info : UDINT ; + t_name : ARRAY[0..4] OF SINT ; + err_type : USINT ; + err_year : UINT ; + err_month : USINT ; + err_day : USINT ; + err_reserve : USINT ; + err_hour : USINT ; + err_minute : USINT ; + err_second : USINT ; + err_millisec : UINT ; + err_microsec : UINT ; + err_string : ARRAY[0..33] OF USINT ; + END_STRUCT; + ERR_typ : STRUCT + err_nr : UINT ; + err_info : UDINT ; + t_name : ARRAY[0..4] OF SINT ; + err_type : USINT ; + err_year : UINT ; + err_month : USINT ; + err_day : USINT ; + err_reserve : USINT ; + err_hour : USINT ; + err_minute : USINT ; + err_second : USINT ; + err_millisec : UINT ; + err_microsec : UINT ; + END_STRUCT; + PV_xList_typ : STRUCT + name : ARRAY[0..32] OF SINT ; (*name of the process variable*) + data_typ : USINT ; (*PV data type (see PV_info())*) + data_len : UDINT ; (*length of the PV in bytes*) + dimension : UDINT ; (*number of array elements*) + adress : UDINT ; (*physical address of the PV (for dynamic access)*) + END_STRUCT; + PV_List_typ : STRUCT + name : ARRAY[0..13] OF SINT ; (*name of the PV*) + tcnr : USINT ; (*PV resource*) + grp : USINT ; (*group number of the PV (standard = 0)*) + ident : UDINT ; (*PV ID number*) + adress : UDINT ; (*physical address of the PV (for dynamic access)*) + END_STRUCT; + MO_List_typ : STRUCT + name : ARRAY[0..13] OF SINT ; + grp : USINT ; + type : USINT ; + state : USINT ; + reserve : USINT ; + adress : UDINT ; + memtype : UDINT ; + END_STRUCT; + SYSxinfo_typ : STRUCT + aws_name : ARRAY[0..5] OF SINT ; + aws_type : ARRAY[0..1] OF SINT ; + cpu_info : UDINT ; + ma_globl_len : UINT ; + md_globl_len : UINT ; + os_len : UDINT ; + user_len : UDINT ; + tmp_len : UDINT ; + eprom_len : UDINT ; + fix_ram_len : UDINT ; + END_STRUCT; + RTCtime_typ : STRUCT + year : UINT ; + month : USINT ; + day : USINT ; + reserve : USINT ; + hour : USINT ; + minute : USINT ; + second : USINT ; + millisec : UINT ; + microsec : UINT ; + END_STRUCT; +END_TYPE diff --git a/Logical/Libraries/sys_lib/sys_lib.var b/Logical/Libraries/sys_lib/sys_lib.var new file mode 100644 index 0000000..625d11b --- /dev/null +++ b/Logical/Libraries/sys_lib/sys_lib.var @@ -0,0 +1,131 @@ + +(*error codes of the SYS_LIB services*) +VAR CONSTANT + ERR_BUR_WRROW : UINT := 2061; (*illegal row*) + ERR_BUR_WRCOL : UINT := 2062; (*illegal column*) + ERR_BUR_WR_CHAR : UINT := 2063; (*invalid ASCII character*) + ERR_BUR_NORTC : UINT := 2073; (*RTC not existing or uninitialized*) + + ERR_BUR_MO_NOTFOUND : UINT := 3019; (*module not found*) + ERR_BUR_NOMEM : UINT := 3030; (*out of memory*) + ERR_BUR_MEMVWBUSY : UINT := 3035; (*memory management busy*) + ERR_BUR_ILLPTR : UINT := 3104; (*illegal data pointer in MEM_free*) + + ERR_BUR_ILLTKNR : UINT := 3300; (*illegal task-class number*) + ERR_BUR_WROFFSET : UINT := 3301; (*illegal offset*) + ERR_BUR_ILLSTATE : UINT := 3302; (*illegal state of object*) + ERR_BUR_NOMSG : UINT := 3303; (*no message sent/received*) + ERR_BUR_DUPOBJ : UINT := 3305; (*object exists*) + ERR_BUR_TIMEOUT : UINT := 3304; (*timeout error*) + ERR_BUR_EXISTS : UINT := 3306; (*entry exists*) + ERR_BUR_LCOUNT : UINT := 3307; (*Linkcnt <> 0 in AVT_cancel ()*) + ERR_BUR_BURNING : UINT := 3308; (*error burning module*) + ERR_BUR_INVALIDMBX : UINT := 3309; (*invalid mailbox*) + + ERR_BUR_ILLBPTR : UINT := 3310; (*invalid base pointer*) + ERR_BUR_ILLTYP : UINT := 3311; (*invalid I/O type*) + ERR_BUR_ILLEXT : UINT := 3312; (*invalid ext. bit*) + ERR_BUR_ILLVER : UINT := 3313; (*invalid version, e.g. BURTRAP V1.10 to SPSSW V1.05*) + ERR_BUR_ILLLEN : UINT := 3314; (*invalid data length*) + ERR_BUR_MAX_LCOUNT : UINT := 3315; (*AVT_attach: LCOUNT > 127*) + ERR_BUR_AVT_FREE : UINT := 3316; (*AVT_release:LCOUNT = 0*) + ERR_BUR_ILLPAR : UINT := 3317; (*illegal parameter*) + ERR_BUR_INSTALL : UINT := 3318; (*error install datamodule*) + ERR_BUR_WRONG_MODTYP : UINT := 3319; (*wrong module type*) + + ERR_BUR_OBJDEL : UINT := 3320; (*object already deleted*) + ERR_BUR_ILLOBJ : UINT := 3324; (*object does not exist*) + ERR_BUR_ILLOBJTYP : UINT := 3328; (*invalid object type*) + ERR_BUR_NOENTRY : UINT := 3332; (*no entry*) + ERR_BUR_TOOLONG_PVNAME : UINT := 3333; (*too long PV name*) + ERR_BUR_ILLIDENT : UINT := 3336; (*illegal ident*) + ERR_BUR_NOSMBUF : UINT := 3560; (*no more semaphore buffers*) + ERR_BUR_NOSM : UINT := 3564; (*semaphore not available*) + ERR_BUR_SMDEL : UINT := 3568; (*semaphore deleted*) + ERR_BUR_NOTIME : UINT := 3584; (*time not available*) + ERR_BUR_ILLDATE : UINT := 3588; (*date : out of range*) + ERR_BUR_ILLTIME : UINT := 3592; (*time : out of range*) + ERR_BUR_ILLTICKS : UINT := 3596; (*ticks : out of range*) + + ERR_BUR_MEM_ALLOC : UINT := 3600; (*not enough continuous memory*) + ERR_BUR_TMP_ALLOC : UINT := 3601; (*not enough continuous memory*) + ERR_BUR_MEM_FREE : UINT := 3700; (*invalid pointer/length*) + ERR_BUR_TMP_FREE : UINT := 3701; (*invalid pointer/length*) + END_VAR + +(*state for object PLC task*) +VAR CONSTANT + Z_ST_created : UINT := 1; (*object installed*) + Z_ST_running : UINT := 2; (*object running*) + Z_ST_blocked : UINT := 3; (*object stopped*) + Z_ST_exist : UINT := 16#00; (*object exists*) + Z_ST_installed : UINT := 16#82; (*temporary status during installation*) + Z_ST_PVinstalled : UINT := 16#83; (*temporary status during installation*) + Z_ST_IOinstalled : UINT := 16#84; (*temporary status during installation*) + Z_ST_IOdeinstalled : UINT := 16#85; (*temporary status during installation*) + Z_ST_PVdeinstalled : UINT := 16#86; (*temporary status during installation*) + Z_ST_delete : UINT := 16#87; (*temporary status during installation*) + Z_ST_stdebug : UINT := 16#88; (*temporary status during installation*) + Z_ST_tmp_suspended : UINT := 16#90; (*object temporarily stopped*) +END_VAR + +(*OBSOLETE PV data types*) +VAR CONSTANT + PB_DT_STRUCT : UINT := 0; (*OBSOLETE*) + PB_DT_BOOL : UINT := 1; (*OBSOLETE*) + PB_DT_INT8 : UINT := 2; (*OBSOLETE*) + PB_DT_INT16 : UINT := 3; (*OBSOLETE*) + PB_DT_INT32 : UINT := 4; (*OBSOLETE*) + PB_DT_BYTE : UINT := 5; (*OBSOLETE*) + PB_DT_WORD : UINT := 6; (*OBSOLETE*) + PB_DT_LONG : UINT := 7; (*OBSOLETE*) + PB_DT_FLOAT : UINT := 8; (*OBSOLETE*) + PB_DT_VIS : UINT := 9; (*OBSOLETE*) + PB_DT_OCTET : UINT := 10; (*OBSOLETE*) + PB_DT_DATE : UINT := 11; (*OBSOLETE*) + PB_DT_TIME : UINT := 12; (*OBSOLETE*) + PB_DT_DIFF : UINT := 13; (*OBSOLETE*) + PB_DT_BIT : UINT := 14; (*OBSOLETE*) + PB_DT_ARRAY : UINT := 15; (*OBSOLETE*) +END_VAR + +(*elementary data types*) +VAR CONSTANT + SYSLIB_IEC_TYPE_USER_DEFINED : USINT := 0; (*User-defined data type*) + SYSLIB_IEC_TYPE_USER_DEFINED_2 : USINT := 15; (*User-defined data type (legacy: array of structs)*) + SYSLIB_IEC_TYPE_BOOL : USINT := 1; (*8 Bit containing a boolean value FALSE=0 or TRUE=1*) + SYSLIB_IEC_TYPE_SINT : USINT := 2; (*8 Bit signed integer*) + SYSLIB_IEC_TYPE_INT : USINT := 3; (*16 Bit signed integer*) + SYSLIB_IEC_TYPE_DINT : USINT := 4; (*32 Bit signed integer*) + SYSLIB_IEC_TYPE_USINT : USINT := 5; (*8 Bit unsigned integer*) + SYSLIB_IEC_TYPE_UINT : USINT := 6; (*16 Bit unsigned integer*) + SYSLIB_IEC_TYPE_UDINT : USINT := 7; (*32 Bit unsigned integer*) + SYSLIB_IEC_TYPE_REAL : USINT := 8; (*32 Bit floating point number*) + SYSLIB_IEC_TYPE_STRING : USINT := 9; (*Variable-length single-byte character string*) + SYSLIB_IEC_TYPE_DATE_AND_TIME : USINT := 11; (*32 Bit of Date in Seconds since 01.01.1970 00:00:00*) + SYSLIB_IEC_TYPE_TIME : USINT := 12; (*32 Bit of Time in ms*) + SYSLIB_IEC_TYPE_DATE : USINT := 13; (*32 Bit of Date (only)*) + SYSLIB_IEC_TYPE_LREAL : USINT := 14; (*64 Bit floating point number*) + SYSLIB_IEC_TYPE_TIME_OF_DAY : USINT := 16; (*32 Bit Time of day (only)*) + SYSLIB_IEC_TYPE_BYTE : USINT := 17; (*Bit string of length 8*) + SYSLIB_IEC_TYPE_WORD : USINT := 18; (*Bit string of length 16*) + SYSLIB_IEC_TYPE_DWORD : USINT := 19; (*Bit string of length 32*) + SYSLIB_IEC_TYPE_WSTRING : USINT := 21; (*Variable-length double-byte character string*) +END_VAR + +(*memory types*) +VAR CONSTANT + SYS_RAM : UINT := 1; (*RAM*) + USER_ROM1 : UINT := 2; (*EPROM*) + FIX_RAM : UINT := 5; (*fixed RAM*) +END_VAR + +(*shutdown/reboot types*) +VAR CONSTANT + SYSLIB_WARMSTART : USINT := 16#01; (*WARMSTART (with restart)*) + SYSLIB_COLDSTART : USINT := 16#02; (*COLDSTART (with restart)*) + SYSLIB_WARMSTART_NO_REBOOT : USINT := 16#11; (*WARMSTART (no restart, only shutdown)*) + SYSLIB_COLDSTART_NO_REBOOT : USINT := 16#12; (*COLDSTART (no restart, only shutdown)*) + SYSLIB_DIAGNOSTICS : USINT := 16#20; (*DIAGNOSTICS (with restart)*) + SYSLIB_SERVICE : USINT := 16#40; (*SERVICE (with restart) *) +END_VAR \ No newline at end of file diff --git a/Logical/Machine/ConMon/Main.st b/Logical/Machine/ConMon/Main.st index 77a522a..8857ae0 100644 --- a/Logical/Machine/ConMon/Main.st +++ b/Logical/Machine/ConMon/Main.st @@ -10,6 +10,9 @@ PROGRAM _INIT Status.enAirCom := enAIR_INIT; + + FUBs.LCRMovAvgFlt_pDiff.enable := TRUE; + FUBs.LCRMovAvgFlt_pDiff.base := 3000; END_PROGRAM @@ -58,10 +61,16 @@ PROGRAM _CYCLIC Environment.rHumidity1 := INT_TO_REAL (AirValues.iHumidity1) * 0.1; Environment.rHumidity2 := INT_TO_REAL (AirValues.iHumidity2) * 0.1; Environment.rAirPreasure := INT_TO_REAL (AirValues.iBaroPreassure); //Barometrischen Luftdruck verwenden - Environment.rDiffPreassure := - INT_TO_REAL (AirValues.iDiffPreassure) * 0.1; + rDiffpressureRaw := - INT_TO_REAL (AirValues.iDiffPreassure) * 0.3; // Wert * 3 + Environment.rDiffPreassure := rDiffpressureFlitered; gLogValue := Environment; END_IF END_CASE; + FUBs.LCRMovAvgFlt_pDiff.x := rDiffpressureRaw; + FUBs.LCRMovAvgFlt_pDiff (); + IF (FUBs.LCRMovAvgFlt_pDiff.status = ERR_OK) THEN + rDiffpressureFlitered := FUBs.LCRMovAvgFlt_pDiff.y; + END_IF //=================================== diff --git a/Logical/Machine/ConMon/Types.typ b/Logical/Machine/ConMon/Types.typ index 98307b2..6cdef52 100644 --- a/Logical/Machine/ConMon/Types.typ +++ b/Logical/Machine/ConMon/Types.typ @@ -18,6 +18,7 @@ TYPE TONParticleOK : TON; TOFParticleOk : TOF; TOFShowHidenMenu : TOF; + LCRMovAvgFlt_pDiff : LCRMovAvgFlt; END_STRUCT; typ_enAirComm : ( (*Schrittkette*) diff --git a/Logical/Machine/ConMon/Variables.var b/Logical/Machine/ConMon/Variables.var index 589c02c..ead56aa 100644 --- a/Logical/Machine/ConMon/Variables.var +++ b/Logical/Machine/ConMon/Variables.var @@ -1,6 +1,8 @@ VAR blTempOk : BOOL; blTempNOk : BOOL; + rDiffpressureRaw : REAL; + rDiffpressureFlitered : REAL; Status : typ_Status; (*Status*) Environment : gtyp_Environment; (*Umgebungsvariablen*) AirValues : typ_AirValues; (*Werte von Klimaanlage*) diff --git a/Physical/Config2/X20CP0483/Cpu.sw b/Physical/Config2/X20CP0483/Cpu.sw index f32763b..fde35c5 100644 --- a/Physical/Config2/X20CP0483/Cpu.sw +++ b/Physical/Config2/X20CP0483/Cpu.sw @@ -79,5 +79,8 @@ + + + \ No newline at end of file diff --git a/admin.set b/admin.set new file mode 100644 index 0000000..4be53a5 --- /dev/null +++ b/admin.set @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file