CLR
A #init
JC ini0
L "sysdb".ms
T #msold
L 0
T #sv_sel
// L #PV
// T #sv1
SET
S #sample
S #init
L #sv1
T #svn_1
ini0: NOP 0
CLR
L "sysdb".ms
L #msold
-D
JM s000
JU s001
s000: L DW#16#7FFFFFFF
+D
s001: L #CYCLE
<D
JC s002
L "sysdb".ms
T #msold
S #sample //generate sample pulse
s002: NOP 0
L #CYCLE
DTR
L 1.000000e+003
/R
T #TA //ta=cycle in s real
L #TA
L 2.000000e+000
/R
T #tTA2
L #TI
DTR
L 1.000000e+003
/R
T #TN //tn=ti in s real
L #tTA2
<R
JCN A7d0
T #TN //judge ti
A7d0: L #TD
DTR
L 1.000000e+003
/R
T #TV //tv=td in s real
L #TM_LAG
DTR
L 1.000000e+003
/R
T #TVD //tvd=tm_lag in s real
L #tTA2
<R
JCN A7d1
T #TVD //judge tm_lag
A7d1: CLR
A #INV_SENSE //judge n&p default is negative
JCN A7d2
L #GAIN
L -1.000000e+000
*R
T #KP //kp=-1*gain when positive
JU A7d3
A7d2: L #GAIN
T #KP //kp=gain when negative
A7d3: NOP 0
CLR
L #sv_sel //do sv select man
L 0
==I
JCN sv00
SET
S #man_on
R #cas_on
sv00: NOP 0
CLR
L #sv_sel //do sv select auto
L 1
==I
JCN sv01
SET
R #man_on
R #cas_on
sv01: NOP 0
CLR
L #sv_sel //do sv select cas
L 2
==I
JCN sv02
SET
R #man_on
S #cas_on
sv02: NOP 0
CLR
A #cas_on
JCN cas0
L #sv2
T #svn
T #sv1
cas0: CLR
A #cur_on
JCN cur0
L #sv3
T #svn
T #sv1
cur0: CLR
A #mod_on
JCN mod0
L #sv5
T #svn
T #sv1
JU mod1
mod0: NOP 0
L #sv1
T #svn
mod1: NOP 0
CLR
A #sv_vel_on
JCN vel1
CLR
A #sample
JCN vel0
CLR
L #svn
L #svn_1
-R
ABS
L #sv_vel_lim
>=R
JCN vel1 //judge dsv
CLR
L #svn
L #svn_1
>R
JCN vel3
L #svn_1
L #sv_vel_lim
+R
L #svn
TAK
>R
JCN vel1
L #svn_1
L #sv_vel_lim
+R
T #sv
JU vel0
vel3: CLR
L #svn
L #sv_vel_lim
+R
L #svn_1
TAK
>R
JCN vel1
L #svn_1
L #sv_vel_lim
-R
T #sv
JU vel0
vel1: NOP 0
L #svn
T #sv
vel0: NOP 0
L #sv
T #sp //end sv process
L #sp
L #PV
-R
T #ER //calculate er="sp-pv"
NEGR //start er alarm check
T #er_neg
L #erhh
>R
JCN a000
S #erhh_alm
a000: TAK
L #erh
>R
JCN a001
S #erh_alm
a001: TAK
L #erl
<R
JCN a002
S #erl_alm
a002: TAK
L #erll
<R
JCN a003
S #erll_alm
a003: NOP 0
L #erhh
L #alm_hys
-R
L #er_neg
>=R
JCN a004
R #erhh_alm
a004: L #erh
L #alm_hys
-R
L #er_neg
>=R
JCN a005
R #erh_alm
a005: L #erl
L #alm_hys
+R
L #er_neg
<=R
JCN a006
R #erl_alm
a006: L #erll
L #alm_hys
+R
L #er_neg
<=R
JCN a007
R #erll_alm //process er alarm check
a007: CLR
A #man_on //process pv check
JC pv01
CLR
L #PV
L #pvn_1
-R
ABS
L 5.000000e+001
>R
JCN pv00
S #pv_error //set when dpv>50.0
pv00: NOP 0
CLR
A #pv_error
JCN pv01
S #man_on
R #pv_error
pv01: NOP 0
CLR
A #DEADB_ON //deadband on_off default is off
JCN A7d4
CLR
L #ER
L #DEADB_DN
<R
JCN A7d5
L #ER
L #DEADB_DN
-R
T #tER
JU A7d9
A7d5: CLR
L #ER
L #DEADB_UP
>R
JCN A7d7
L #ER
L #DEADB_UP
-R
T #tER
JU A7d9
A7d7: L 0.000000e+000
T #tER
JU A7d9
A7d4: L #ER
T #tER //store er in ter
A7d9: L #tER
L #KP
*R
T #ERxKP //calc erxkp="er"*kp
L #PV
L #KP
*R
T #PVxKP //calc pvxkp="pv"*kp
CLR
A #COM_RST //restart when true
JCN A7da
L "sysdb".ms //start reset procee
T #msold
L 0.000000e+000
T #LMN_D //lmn_d=0
A #I_SEL
JCN A7db
A #PFDB_SEL
JCN A7dc
L #PVxKP
NEGR
T #LMN_I //lmn_i=-1*pvxkp
JU A7dd
A7dc: L #ERxKP
NEGR
T #LMN_I //lmn_i=-1*erxkp
A7dd: CLR
A #DISV_SEL
JCN A7df
L #LMN_I
L #DISV
-R
T #LMN_I //lmn_i=lmn_i-disv
JU A7df
A7db: L 0.000000e+000
T #LMN_I //lmn_i=0 when i_sel=0
A7df: L 0.000000e+000
T #PID_OUTV //reset output to 0 end restart
L #svn
T #svn_1
R #COM_RST
A7da: NOP 0 //end reset
CLR
A #man_on
JCN A7e0 //do when man_on=1 start manual process
L 0.000000e+000
T #LMN_D //lmn_d=0
A #PID_OUTV_RST
NOT
JCN A7e0
A #I_SEL
JCN A7e2
A #PFDB_SEL
JCN A7e3
L #LMN
L #PVxKP
-R
T #LMN_I
JU A7e4
A7e3: L #LMN
L #ERxKP
-R
T #LMN_I
A7e4: CLR
A #DISV_SEL
JCN A7e6
L #LMN_I
L #DISV
-R
T #LMN_I
JU A7e6
A7e2: L 0.000000e+000
T #LMN_I
A7e6: L #LMN
T #PID_OUTV //end manual mode process
A7e0: NOP 0
CLR
A #mv_trksv //track down
JCN trk0
L #dsv
T #LMN
trk0: NOP 0
CLR
A #trk_mv_on //track fmv
JCN fmv0
L #trk_mv
T #LMN
fmv0: NOP 0
CLR
A #mv_trksv
O #trk_mv_on
JCN B7e0 //do mv track process
L 0.000000e+000
T #LMN_D //lmn_d=0
A #PID_OUTV_RST
NOT
JCN B7e0
A #I_SEL
JCN B7e2
A #PFDB_SEL
JCN B7e3
L #LMN
L #PVxKP
-R
T #LMN_I
JU B7e4
B7e3: L #LMN
L #ERxKP
-R
T #LMN_I
B7e4: CLR
A #DISV_SEL
JCN B7e6
L #LMN_I
L #DISV
-R
T #LMN_I
JU B7e6
B7e2: L 0.000000e+000
T #LMN_I
B7e6: L #LMN
T #PID_OUTV //end mv track process
B7e0: NOP 0
CLR
A #PID_OUTV_RST
JCN A7e7
L 0.000000e+000 //do when pid_outv_rst=1
T #LMN_D
L #LMN_I
L #PID_OUTVold
-R
L #RST_VAL_OUTV
+R
T #LMN_I
L #RST_VAL_OUTV
T #PID_OUTV //end rest output
A7e7: CLR
A #sample
JCN A7e8
CLR //do when sample is true
A #man_on
O #mv_trksv
O #trk_mv_on
NOT
JCN sa00
A #P_SEL //do when man_on=0 start auto prcess
JCN A7e9
A #PFDB_SEL
JCN A7ea
L #PVxKP
T #LMN_P
JU A7ec
A7ea: L #ERxKP
T #LMN_P
JU A7ec
A7e9: L 0.000000e+000
T #LMN_P //calc lmn_p
A7ec: CLR
A #ITL_ON
JCN A7ed
L #I_ITLVAL
T #LMN_I
JU A7ee
A7ed: CLR
A #I_SEL
JCN A7ef
A #INT_HOLD
NOT
JCN A7ee
L #ERxKP
L #TN
/R
L #TA
*R
L #LMN_I
+R
T #LMN_I
L #LMN_P
+R
L #LMN_HLM
>R
JCN A7f1
L #LMN_HLM
L #LMN_P
-R
T #LMN_I
A7f1: L #LMN_P
L #LMN_I
+R
L #LMN_LLM
<R
JCN A7f2
L #LMN_LLM
L #LMN_P
-R
T #LMN_I
A7f2: JU A7ee
A7ef: L 0.000000e+000
T #LMN_I //calc lmn_i
A7ee: CLR
A #D_SEL
JCN A7f4
A #DFDB_SEL
JCN A7f5
L #PVxKP
L #PVold
-R
T #YD
JU A7f6
A7f5: L #ERxKP
L #ERold
-R
T #YD
A7f6: L #YD
L #TV
*R
L #TA
/R
T #YD
L 0.000000e+000
>R
JCN A7f7
TAK
L #LMN_D
>R
JCN A7f7
TAK
T #LMN_D
A7f7: L #YD
L 0.000000e+000
<R
JCN A7f9
TAK
L #LMN_D
<R
JCN A7f9
TAK
T #LMN_D
A7f9: L 2.000000e+000
L #TVD
*R
L #TA
-R
L 2.000000e+000
TAK
T #t_tvd
TAK
L #TVD
*R
L #TA
+R
L #t_tvd
TAK
/R
L #LMN_D
*R
T #LMN_D
JU A7fb
A7f4: L 0.000000e+000
T #LMN_D //calc lmn_d
A7fb: L #LMN_P
L #LMN_I
+R
L #LMN_D
+R
T #PID_OUTV
CLR
A #DISV_SEL
JCN A7fc
L #DISV
+R
T #PID_OUTV
A7fc: L #PID_OUTV
L #LMN_HLM
>R
JCN A7fd
T #PID_OUTV
A7fd: L #PID_OUTV
L #LMN_LLM
<R
JCN A7fe
T #PID_OUTV //calc pid_outv
A7fe: L #PVxKP
T #PVold
L #ERxKP
T #ERold
L #PID_OUTV
T #PID_OUTVold
T #LMN
sa00: L #PV
T #pvn_1
L #sp
T #svn_1
R #sample //end auto mode process
A7e8: NOP 0
CLR
L #LMN
L 1.000000e+002
>=R
JCN lmn0
L 1.000000e+002
JU lmn9
lmn0: TAK
CLR
L 0.000000e+000
<=R
JCN lmn1
L 0.000000e+000
JU lmn9
lmn1: TAK
lmn9: T #LMN
L #LMN
L 2.764800e+002
*R
RND
T #mv_per
BE