lundi 4 novembre 2013


Soyons fou un petit délire avec Panoramic  pour faire "mumuse" avec un vérin

 



Code:


 '   20131022

  error_french
 width 0,1000:height 0,800
 top 0,(screen_y-height(0))/2 :left 0,(screen_x-width(0))/2
 label sp_fin,verinAV,verinAR,capteur,auto,manu,vav,var,raz,help1,help0
 dim nobj,i,a,c,compt$
nobj=10 :affichtxt(nobj,20,150,18,"Simulation supervision en Panoramic")
nobj=20: voyant(nobj,100,100,"AUTO","V")
nobj=30 :voyant(nobj,100,350,"NANU","O")
nobj=40: voyant(nobj,100,600,"Verin_1 -- ","O")
nobj=50: voyant(nobj,100,750,"Verin_1 ++ ","O")
nobj=60: verin(nobj,300,600,"Vérin 1")
nobj=70: flip_flop(nobj,300,100,"Auto/Manu")
nobj=80: Bpvert(nobj,300,430,"V plus")
nobj=90: Bpvert(nobj,300,270,"V moin")
nobj=100: button_container(nobj,600,800,"F I N")
nobj=110: button_container(nobj,600,700,"Aide")
nobj=120: compteur(nobj,0,500,100,"Compteur")
nobj=130 :affichtxt(nobj,600,450,14,date$)
nobj=140:help(nobj,0,"Aide")
gosub manu :gosub capteur
on_click 82, verinAV
on_click 92, verinAR
on_click 72, auto
on_click 74, manu
on_click 101,sp_fin
on_click 123, raz
on_click 111, help1
on_click 142, help0
  ' ========
   end
  ' ========
 sp_fin:
 terminate
 return

 rem ============================

verinAV:
 color 82,22,184,78
 pause 500
color 82,84,249,141
vav:
if position(62) > 95 then return
for i= 10 to 100
pause 20
gosub capteur
position 62,i
next i
if a=1
compt$="0000"
c=c+1:compt$=compt$+ str$(c)
compt$=right$(compt$,4)
caption 122,compt$
end_if
return
' =======================
verinAR:
 color 92,22,184,78
 pause 500
color 92,84,249,141
var:
if position(62) < 15 then return
for i=100 to 10 step -1
pause 15
position 62,i
gosub capteur
next i
return
' =====================
capteur:
if i <20
font_color 63,255,0,0
color 42,255,255,102
else
font_color 63,0,0,255
color 42,204,153,51
end_if
if i >90
font_color 64,255,0,0
color 52,255,255,102
else
font_color 64,0,0,255
color 52,204,153,51
end_if
caption 63,"[%]"
caption 64,"[%]"
return
' =========================
auto:
 a=1
color 72,22,184,78
color 74,222,41,22
color 22,0,255,0
color 32,204,102,0
inactive 82 :inactive 92
while a=1
   gosub vav
   pause 500
   gosub var
   pause 500
end_while
return
' ================
 manu:
a=0
active 82:active 92
color 72,84,249,141
color 74,174,74,52
color 22,0,153,0
color 32,255,153,0
return
'  =============
raz:
if a=0
c=0:caption 122,"0000"
end_if
return
'  =============
help1:
show 140:inactive 0
return
'  =============
help0:
hide 140:active 0
return


rem =======sub===============


sub affichtxt(nxt,tpt,ltt,fsize,txt$)
container nxt::top nxt,tpt:left nxt,ltt
Alpha nxt+1:parent nxt+1,nxt:top nxt+1,20:left nxt+1,10
font_bold nxt+1:font_size nxt+1,fsize:caption nxt+1,txt$
width nxt,width(nxt+1)+40
height nxt,height(nxt+1)+40
end_sub
rem ===========================
sub voyant(ntp,ttp,ltp,txt$,col$)
container ntp:top ntp,ttp:left ntp,ltp
width ntp,80: height ntp,133
if len(txt$) > 9 then txt$=left$(txt$,9)
caption ntp,txt$
alpha ntp+1:parent ntp+1,ntp:top ntp+1,48:left ntp+1,7
width ntp+1,64: height ntp+1,44:color ntp+1,0,0,0
alpha ntp+2:parent ntp+2,ntp:top ntp+2,52:left ntp+2,11
width ntp+2,56: height ntp+2,36
if col$ ="R" or col$ ="r" then color ntp+2,153,0,0
if col$ ="O" or col$ ="o" then color ntp+2,204,102,0
if col$ ="J" or col$ ="j" then color ntp+2,204,153,51
if col$ ="B" or col$ ="b" then color ntp+2,51,153,153
if col$ ="V" or col$ ="v" then color ntp+2,0,153,0
end_sub
rem  ntp=10 ==>voyant  =12
rem ===========================
sub verin(nv,tpv,ltv,txt$)
 container nv:top nv,tpv:left nv,ltv:caption nv,txt$
 alpha nv+1:parent nv+1,nv:top nv+1,50 :left nv+1,30
 width nv+1,120 :height nv+1,40
 color nv+1,102,129,141
 progress_bar nv+2 :parent nv+2,nv:top nv+2,60:left nv+2,30+width(nv+1)
 position nv+2,10
 width nv,width(nv+1)+width(nv+2)+60
 alpha nv+3:parent nv+3,nv:top nv+3,30:left nv+3,30:caption nv+3,"[%]"
 font_color nv+3,255,0,0
 alpha nv+4:parent nv+4,nv:top nv+4,30:left nv+4,135:caption nv+4,"[%]"
 font_color nv+4,0,0,255
 rem pour nv =10 %r==> 13 & %s==> 14
end_sub
rem ===========================
sub flip_flop(ntp,ttp,ltp,txt$)
container ntp:top ntp,ttp:left ntp,ltp
width ntp,80: height ntp,133
if len(txt$) > 9 then txt$=left$(txt$,9)
caption ntp,txt$
alpha ntp+1:parent ntp+1,ntp:top ntp+1,25:left ntp+1,19
width ntp+1,40: height ntp+1,40:color ntp+1,0,0,0
alpha ntp+2:parent ntp+2,ntp:top ntp+2,27:left ntp+2,21
width ntp+2,36: height ntp+2,36:color ntp+2,84,249,141
alpha ntp+3:parent ntp+3,ntp:top ntp+3,75:left ntp+3,19
width ntp+3,40: height ntp+3,40:color ntp+3,0,0,0
alpha ntp+4:parent ntp+4,ntp:top ntp+4,77:left ntp+4,21
width ntp+4,36: height ntp+4,36:color ntp+4,222,41,22
end_sub
rem ntp=10 ==>bp1 =12 / bp2 = 14
rem  on_clich 12 ou 14 ==>sp
rem ===========================
sub Bpvert(ntp,ttp,ltp,txt$)
container ntp:top ntp,ttp:left ntp,ltp
width ntp,80: height ntp,133
if len(txt$) > 9 then txt$=left$(txt$,9)
caption ntp,txt$
alpha ntp+1:parent ntp+1,ntp:top ntp+1,50:left ntp+1,19
width ntp+1,40: height ntp+1,40:color ntp+1,0,0,0
alpha ntp+2:parent ntp+2,ntp:top ntp+2,52:left ntp+2,21
width ntp+2,36: height ntp+2,36:color ntp+2,84,249,141
end_sub
rem  ntp=10 ==>bp1 =12
rem ===========================
sub button_container(nbc,tpc,ltc,txt$)
container nbc:top nbc,tpc:left nbc, ltc
caption nbc ,txt$
button nbc+1:parent nbc+1,nbc:top nbc+1,30:left nbc+1,10
width nbc+1,30
width nbc,width(nbc+1)+20
height nbc,height(nbc+1)+40
end_sub
rem ===========================
sub compteur(nc,par,tpc,ltc,txt$)
container nc:parent nc,par:top nc,tpc:left nc,ltc
caption nc,txt$
alpha nc+1:parent nc+1,nc:top nc+1,40:left nc+1,10
color nc+1,0,0,0
alpha nc+2:parent nc+2,nc:top nc+2,45:left nc+2,15
color nc+2,255,0,0:font_size nc+2,20:caption nc+2,"0000"
height nc+1,height(nc+2)+10
button nc+3 :parent nc+3,nc:top nc+3,45:left nc+3,width(nc+1)+20
width nc+3 ,30:caption nc+3,"RAZ"
width nc,width(nc+1)+width(nc+3)+30
' affichage nc+2 nc=10  ==>12
' bp nc+3 nc=10  ==>13
end_sub

rem ==============================
sub help(nform,visi,txt$)
 form nform : top nform,(screen_y-height(nform))/2 :left nform,(screen_x-width(nform))/2
 width nform,500:height nform,350:if visi = 0 then hide nform
 memo nform+1:parent nform+1,nform:full_space nform+1
 caption nform,txt$
 item_add nform+1,"                      "
 item_add nform+1,"La supervision est une technique industrielle de suivi et de pilotage informatique de procédés de fabrication automatisés. La supervision concerne l'acquisition de données (mesures, alarmes, retour d'état de fonctionnement) et des paramètres de commande des processus généralement confiés à des automates programmables."
 item_add nform+1,"                      "
 item_add nform+1,"Wikipédia, l'encyclopédie libre"
 item_add nform+1," "
item_add nform+1,"Mode d'emploi"
item_add nform+1,"Bouton-poussoir de couleur verte."
item_add nform+1,"Cycle ''Auto'' :"
item_add nform+1," la tige du vérin, elle sort et elle rentre automatiquement."
item_add nform+1,"Le compteur incrémente."
item_add nform+1," bouton-poussoir de couleur rouge."
item_add nform+1,"''Manu'':"
item_add nform+1,"Les boutons poussoirs ''V plus'' ''V moins '' pour déplacer la tige du vérin."
item_add nform+1,"''RAZ'' bouton-poussoir de remise à zéro du compteur"

 inactive nform+1
 button nform+2 :parent nform+2,nform:top nform+2,250:left nform+2,300
 caption nform+2,"Quitter"
' button 202 pour nforme =200
end_sub
 rem ==============================


Aucun commentaire:

Enregistrer un commentaire