B&R motion controle

Partie du forum pour tout ce qui concerne les automates industriels B&R, Beckhoff, Phoenix Contact etc...
TOUDOUFT
Apprend le binaire
Apprend le binaire
Messages : 1
Inscription : 01 janv. 2021, 14:53

B&R motion controle

Message par TOUDOUFT »

Hello I have this following program and I would like to be able to integrate the second Y axis to be able to control it and be able to program the two axes.

______________________________________________________________
PROGRAM _INIT

//Vitesse et acceleration par defaut
aNom := 5.0; //[mm/s^2]
vNom := 10.0; // [mm/s]

//Deplacement
x0 := 150.0; //[mm]
Pas:= 20.0 ; //[mm]

END_PROGRAM

PROGRAM _CYCLIC
CASE etat OF
0: //Attente demande de demarrage
IF ihm_on THEN
etat := 10;
gAxeCmd01.BpOn := TRUE;

END_IF

10: //Demarrage de l'axe
IF gAxeInfo01.PowerOn THEN
etat := 11;
gAxeCmd01.BpHome := TRUE;
END_IF

11://Attente fin prise d'origine
IF gAxeInfo01.Standstill THEN
gAxeCmd01.BpMoveAbsolute := TRUE;
etat := 12;
END_IF
12: //Passage en mode de commande "Deplacement absolu"
IF gAxeInfo01.StandstillAbs THEN
etat := 20;
END_IF

20: //Attente action utilisateur
IF ihm_start THEN //demande depart mouvement
ihm_start := FALSE;
gAxeCmd01.MoveAbsolute.Acc := aNom;
gAxeCmd01.MoveAbsolute.Vit := vNom;
gAxeCmd01.MoveAbsolute.Pos := x0;
gAxeCmd01.MoveAbsolute.BpMove := TRUE;
etat := 100;
ELSIF NOT ihm_on THEN
gAxeCmd01.BpMoveAbsolute := FALSE;
etat := 21;
END_IF
21://Sortie mode "deplacement absolu"
IF gAxeInfo01.Standstill THEN
gAxeCmd01.BpOn := FALSE;
etat := 22;
END_IF
22://Arret moteur
IF NOT gAxeInfo01.PowerOn THEN
etat := 30;
END_IF
30://Attente action utilisateur : demande de demarrage
IF ihm_on THEN
gAxeCmd01.BpOn := TRUE;
etat := 31;

END_IF
31://Demarrage moteur
IF gAxeInfo01.PowerOn THEN
gAxeCmd01.BpMoveAbsolute := TRUE;
etat := 12;
END_IF

//------------------------
//Deplacement aller-retour
//------------------------
100://Deplacement en x0
IF gAxeInfo01.StandstillAbs THEN //Information "mouvement termine"
gAxeCmd01.MoveAbsolute.Acc := aNom;
gAxeCmd01.MoveAbsolute.Vit := vNom;
gAxeCmd01.MoveAbsolute.Pos := 0;
gAxeCmd01.MoveAbsolute.BpMove := TRUE;
etat := 101;
END_IF
101://Retour en 0
IF gAxeInfo01.StandstillAbs THEN
etat := 20;
END_IF
END_CASE

//Actualisation de la position et de la vitesse courante
Position.x := gAxeInfo01.S_act;
Vitesse.x := gAxeInfo01.V_act;

END_PROGRAM
dealyouz
Apprend le binaire
Apprend le binaire
Messages : 3
Inscription : 04 août 2021, 21:20
Contact :

Re: B&R motion controle

Message par dealyouz »

You have to add your Y axis to your hardware configuration and configure it.
Then you can create other program section and declare other variables with the same type or structure as the your current axis (gAxeCmd01, gAxeInfo01,...). Something like this :
______________________________________________________________
PROGRAM _INIT

//Vitesse et acceleration par defaut
aNomY := 5.0; //[mm/s^2]
vNomY := 10.0; // [mm/s]

//Deplacement
y0 := 150.0; //[mm]
PasY:= 20.0 ; //[mm]

END_PROGRAM

PROGRAM _CYCLIC
CASE etatAxisY OF
0: //Attente demande de demarrage
IF ihmy_on THEN
etatAxisY := 10;
gAxeCmdY.BpOn := TRUE;

END_IF

10: //Demarrage de l'axe
IF gAxeInfoY.PowerOn THEN
etatAxisY := 11;
gAxeCmdY.BpHome := TRUE;
END_IF

11://Attente fin prise d'origine
IF gAxeInfoY.Standstill THEN
gAxeCmdY.BpMoveAbsolute := TRUE;
etatAxisY := 12;
END_IF
12: //Passage en mode de commande "Deplacement absolu"
IF gAxeInfoY.StandstillAbs THEN
etatAxisY := 20;
END_IF

20: //Attente action utilisateur
IF ihmy_start THEN //demande depart mouvement
ihmy_start := FALSE;
gAxeCmdY.MoveAbsolute.Acc := aNom;
gAxeCmdY.MoveAbsolute.Vit := vNom;
gAxeCmdY.MoveAbsolute.Pos := x0;
gAxeCmdY.MoveAbsolute.BpMove := TRUE;
etatAxisY := 100;
ELSIF NOT ihmy_on THEN
gAxeCmdY.BpMoveAbsolute := FALSE;
etatAxisY := 21;
END_IF
21://Sortie mode "deplacement absolu"
IF gAxeInfoY.Standstill THEN
gAxeCmdY.BpOn := FALSE;
etatAxisY := 22;
END_IF
22://Arret moteur
IF NOT gAxeInfoY.PowerOn THEN
etatAxisY := 30;
END_IF
30://Attente action utilisateur : demande de demarrage
IF ihmy_on THEN
gAxeCmdY.BpOn := TRUE;
etatAxisY := 31;

END_IF
31://Demarrage moteur
IF gAxeInfoY.PowerOn THEN
gAxeCmdY.BpMoveAbsolute := TRUE;
etatAxisY := 12;
END_IF

//------------------------
//Deplacement aller-retour
//------------------------
100://Deplacement en x0
IF gAxeInfoY.StandstillAbs THEN //Information "mouvement termine"
gAxeCmdY.MoveAbsolute.Acc := aNom;
gAxeCmdY.MoveAbsolute.Vit := vNom;
gAxeCmdY.MoveAbsolute.Pos := 0;
gAxeCmdY.MoveAbsolute.BpMove := TRUE;
etatAxisY := 101;
END_IF
101://Retour en 0
IF gAxeInfoY.StandstillAbs THEN
etatAxisY := 20;
END_IF
END_CASE

//Actualisation de la position et de la vitesse courante
Position.y := gAxeInfoY.S_act;
Vitesse.y := gAxeInfoY.V_act;

END_PROGRAM

And create other program section to control the Y axis (the same as X axis code : you didn't show in your message).
In automation studio you can simulate your configuration and see if your code is working.
Répondre