FEDRA emulsion software from the OPERA Collaboration
AcqSerialPlateChanger.h
Go to the documentation of this file.
1#ifndef ROOT_AcqSerialPlateChanger
2#define ROOT_AcqSerialPlateChanger
4// //
5// AcqSerialPlateChanger //
6// //
7// Interface to Bern emulsion plate changer //
8// //
9// //
11
12
13#include <cstdio>
14#include <cstdlib>
15#include <string>
16#include <ctime>
17
18#include <cmath>
19
20
21#include "TObject.h"
22#include "AcqStage1.h"
23#include "AcqCOM.h"
24
25
26#define MAX_NUMBER_OF_PLATES 100
27#define VPOS_UP 0
28#define VPOS_DOWN 1
29#define VPOS_DOWN_TO_STAGE 2
30#define VPOS_ABOVE_STAGE 3
31
33{
34 int Part[4];
35};
36
37
38
39struct TPlateS
40{
43 int InBank;
45
46};
47
48struct TBankS
49{
50 int Number; //0- microscope, 1-3 banks
51 int NEmulsions; //how many plates it contains
52 int NSeparators; //how many plates it contains
54};
55
56
57
58//______________________________________________________________________________
59class AcqSerialPlateChanger : public TObject {
60
61private:
62 float StX,StY,StZ; //stage coordinates to save before arm power-on
65 public:
67 virtual ~AcqSerialPlateChanger();
68
69// Low level hardware control functions
70void OnReset(); //Here we write all 0 in ports P4 and P5
71int Initialize(AcqStage1* Stage=NULL);
72int PowerON(int timeout=100);
73int PowerOFF(int timeout=100);
74int ArmVacuumControl(bool VacOn, int timeout);
75int TableVacuumControl(bool VacOn, int timeout, bool BlowOn=false);
76int GoOnHAxis(int position, int timeout);
77int GoOnVAxis(int position, int timeout);
78
79// Consistency and bank information management
80int ReadStatusFile();
81void UpdateStatusFile();
82void ResetBanks();
83virtual void Print();
84TPlateS* TakeFromBank(int bnk);
85void AddToBank(int bnk, TPlateS* plate);
86int FindEmulsion(IdentifierS id, int Bank);
87void LoadBrick(int Brick, int Nemulsions=57, int SrcBank=1, int DestBank=2, bool Separators=true, bool FirstIsSeparator=true);
88void UnloadBrick();
89int GetLoadedId(int *id0=NULL, int *id1=NULL,int *id2=NULL,int *id3=NULL); //returns 0 if not loaded
90
91// COM port settings
94
95// Emulsion and arm manipulation methods
96 int Park(int idst);
97 int MoveEmulsion(int isrc, int idst);
98 int UnloadPlate(bool TurnPowerOff=true);
99 int LoadPlate(IdentifierS id);
100 int LoadPlate(int id0, int id1, int id2=0, int id3=0);
101
102
103 bool InitDone; // flag set when Initialize() is done
104 bool Ready; // flag set when banks are filled from status file
105 bool StageError; // flag is set if the stage position changed during robot operation
106 // this is to catch a "stage jump" bug in stage firmware
107 // when this condition is detected stage must be re-homed by host script
108 int SourceBank; // source bank (1 to NumberOfBanks)
109 int DestinationBank; // source bank (1 to NumberOfBanks
110 int PositionTimeout; // Timeout in x100ms to position the arm
111 int VacuumTimeout; // Timeout in x100ms to reach the vacuum on table or arm
112 int NumberOfBanks; // Number of banks on the table
113 bool LiftCorners; // if set - arm tries first to lift corners of the emulsion
114 // when taking it from the stage
115 int NumberOfAttempt; // max number of attempts to take emulsion from the plate
116 int SeparationAttempts; // number of up-down movements against brushes in bank
117 // to separate emulsion from separator
118
119 float XLoadPosition; //stage positions for safe emulsion load/unload
122
123 AcqStage1 *ST; // pointer to stage
124
125// Auxiliary members
126 bool Debug;
127 ClassDef(AcqSerialPlateChanger,1)
128
129};
130
131
132
133#endif /* ROOT_AcqSerialPlateChanger */
TBank Bank[5]
Definition: AcqPlateChanger.cxx:15
#define MAX_NUMBER_OF_PLATES
Definition: AcqSerialPlateChanger.h:26
MFTYPE32 long position
Definition: Milproto.h:644
Definition: AcqCOM.h:14
Definition: AcqSerialPlateChanger.h:59
AcqSerialPlateChanger()
Definition: AcqSerialPlateChanger.cxx:30
int ArmVacuumControl(bool VacOn, int timeout)
Definition: AcqSerialPlateChanger.cxx:209
bool StageError
Definition: AcqSerialPlateChanger.h:105
bool Ready
Definition: AcqSerialPlateChanger.h:104
int UnloadPlate(bool TurnPowerOff=true)
Definition: AcqSerialPlateChanger.cxx:856
int PowerOFF(int timeout=100)
Definition: AcqSerialPlateChanger.cxx:173
int PositionTimeout
Definition: AcqSerialPlateChanger.h:110
int SourceBank
Definition: AcqSerialPlateChanger.h:108
float XLoadPosition
Definition: AcqSerialPlateChanger.h:119
bool LiftCorners
Definition: AcqSerialPlateChanger.h:113
void AddToBank(int bnk, TPlateS *plate)
Definition: AcqSerialPlateChanger.cxx:733
int Park(int idst)
Definition: AcqSerialPlateChanger.cxx:911
AcqCOM * port
Definition: AcqSerialPlateChanger.h:63
float YLoadPosition
Definition: AcqSerialPlateChanger.h:120
virtual ~AcqSerialPlateChanger()
Definition: AcqSerialPlateChanger.cxx:79
int ComPort
Definition: AcqSerialPlateChanger.h:92
void LoadBrick(int Brick, int Nemulsions=57, int SrcBank=1, int DestBank=2, bool Separators=true, bool FirstIsSeparator=true)
Definition: AcqSerialPlateChanger.cxx:463
int LoadPlate(IdentifierS id)
Definition: AcqSerialPlateChanger.cxx:783
int MoveEmulsion(int isrc, int idst)
Definition: AcqSerialPlateChanger.cxx:591
float ZLoadPosition
Definition: AcqSerialPlateChanger.h:121
int Initialize(AcqStage1 *Stage=NULL)
Definition: AcqSerialPlateChanger.cxx:105
int ComBaud
Definition: AcqSerialPlateChanger.h:93
int ReadStatusFile()
Definition: AcqSerialPlateChanger.cxx:382
int GetLoadedId(int *id0=NULL, int *id1=NULL, int *id2=NULL, int *id3=NULL)
Definition: AcqSerialPlateChanger.cxx:576
int GoOnHAxis(int position, int timeout)
Definition: AcqSerialPlateChanger.cxx:278
int PowerON(int timeout=100)
Definition: AcqSerialPlateChanger.cxx:138
int SeparationAttempts
Definition: AcqSerialPlateChanger.h:116
int NumberOfAttempt
Definition: AcqSerialPlateChanger.h:115
float StZ
Definition: AcqSerialPlateChanger.h:62
void ResetBanks()
Definition: AcqSerialPlateChanger.cxx:557
int FindEmulsion(IdentifierS id, int Bank)
Definition: AcqSerialPlateChanger.cxx:896
float StY
Definition: AcqSerialPlateChanger.h:62
int DestinationBank
Definition: AcqSerialPlateChanger.h:109
bool Debug
Definition: AcqSerialPlateChanger.h:126
int VacuumTimeout
Definition: AcqSerialPlateChanger.h:111
int NumberOfBanks
Definition: AcqSerialPlateChanger.h:112
char VacRegister
Definition: AcqSerialPlateChanger.h:64
int TableVacuumControl(bool VacOn, int timeout, bool BlowOn=false)
Definition: AcqSerialPlateChanger.cxx:243
void UpdateStatusFile()
Definition: AcqSerialPlateChanger.cxx:346
virtual void Print()
Definition: AcqSerialPlateChanger.cxx:55
TPlateS * TakeFromBank(int bnk)
Definition: AcqSerialPlateChanger.cxx:750
void OnReset()
Definition: AcqSerialPlateChanger.cxx:85
AcqStage1 * ST
Definition: AcqSerialPlateChanger.h:123
bool InitDone
Definition: AcqSerialPlateChanger.h:103
void UnloadBrick()
Definition: AcqSerialPlateChanger.cxx:445
float StX
Definition: AcqSerialPlateChanger.h:62
int GoOnVAxis(int position, int timeout)
Definition: AcqSerialPlateChanger.cxx:313
Definition: AcqStage1.h:134
Int_t plate
Definition: merge_Energy_SytematicSources_Electron.C:1
#define NULL
Definition: nidaqmx.h:84
Definition: AcqSerialPlateChanger.h:33
int Part[4]
Definition: AcqSerialPlateChanger.h:34
Definition: AcqSerialPlateChanger.h:49
int NEmulsions
Definition: AcqSerialPlateChanger.h:51
TPlateS * Plates[MAX_NUMBER_OF_PLATES *2]
Definition: AcqSerialPlateChanger.h:53
int Number
Definition: AcqSerialPlateChanger.h:50
int NSeparators
Definition: AcqSerialPlateChanger.h:52
Definition: AcqSerialPlateChanger.h:40
bool IsSeparator
Definition: AcqSerialPlateChanger.h:44
int InBank
Definition: AcqSerialPlateChanger.h:43
int SeqNumber
Definition: AcqSerialPlateChanger.h:42
IdentifierS id
Definition: AcqSerialPlateChanger.h:41