ATLAS Offline Software
Loading...
Searching...
No Matches
ComputeStaveServices.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "CcawUtils.h"
7#include <iostream>
8using namespace std;
9
11 int nModulesPerStave, int nChipsPerModule,
12 MsgStream& msg) const
13
14{
15 msg << MSG::DEBUG << "Computing services for " << DetType::name( type, part) << " layer " << layerNumber
16 << " with " << nModulesPerStave << " modulesPerStave and "
17 << nChipsPerModule << " chipsPerModule" << endmsg;
18
19 // The input parameters to the calculation of services per stave.
20 // FIXME: They must be eventually stored in the DB, and not hard-wired in the code
21
22 const int HV_grouping = 4; // FIXME: hard-wired number
23 const int nDCS_Pixel = 10; // FIXME: hard-wired number
24 const int nDCS_Strip = 10; // FIXME: hard-wired number
25 const int max_SP_group_size = 8; // FIXME: hard-wired number
26
27 // HV part
28 int nHV = nModulesPerStave / HV_grouping;
29 if (nModulesPerStave % HV_grouping != 0) ++nHV;
30
31 // DCS part
32 int nDCS;
33 if ( type == DetType::Pixel) {
34 nDCS = nDCS_Pixel; // FIXME
35 }
36 else {
37 nDCS = nDCS_Strip;
38 }
39
40 // Data part
41 int Data_grouping = 10; // FIXME: hard-wired number
42 if (layerNumber > 2) Data_grouping = 20; // FIXME: hard-wired number
43 int nChips = nModulesPerStave * nChipsPerModule;
44 int nData = nChips/Data_grouping;
45 if (nChips % Data_grouping != 0) ++nData;
46
47 // LV part
48 double chipCurrent = 0.5; // FIXME: hard-wired number
49 double chipVoltage = 2.4; // FIXME: hard-wired number
50 double poweringLoss = 0.2; // FIXME: hard-wired number
51 double lossInCable = 0.1; // FIXME: hard-wired number
52 double cableLen = 3.0; // FIXME: hard-wired number
53
54 double moduleCurrent = chipCurrent * nChipsPerModule; // chips are powered in parallel inside a pixel module
55 double moduleVoltage = chipVoltage;
56
57 int nGroups = 1;
58 int nModules = nModulesPerStave;
59
60 if (nModulesPerStave > max_SP_group_size) {
61 nGroups = nModulesPerStave / max_SP_group_size;
62 if (nModulesPerStave % max_SP_group_size != 0) nGroups++;
63 nModules = max_SP_group_size;
64 msg << MSG::DEBUG << "Using " << nGroups << " powering groups with " << max_SP_group_size << " modules each" << endl;
65 }
66
67 int lvGauge = computeLVGaugeSerial( type, part, layerNumber,
68 nModules, moduleCurrent, moduleVoltage,
69 poweringLoss, lossInCable, cableLen,
70 msg);
71
72 std::vector<int> lvg( nGroups, lvGauge);
73 return StaveServices( type, part, layerNumber, nHV, nDCS, nData, lvg);
74}
75/*
76int computeLVGauge( int nModules, double moduleCurrent, double moduleVoltage, int poweringScheme,
77 double poweringLoss, double lossInCable, double cableLen)
78{
79 // poweringSheme: 0 for serial, 1 for DC-DC
80 if (poweringScheme == 0) {
81 // serial powering
82 double cableCurrent = moduleCurrent;
83 double staveVoltage = moduleVoltage * nModules / (1.-poweringLoss);
84 double stavePower = cableCurrent*staveVoltage;
85 double cablePowerDissipation = stavePower * lossInCable;
86 double cableResistivity = cablePowerDissipation / (cableCurrent*cableCurrent);
87 double resistivityPerMeter = cableResistivity / (2*cableLen);
88
89 }
90}
91*/
93 int nModules, double moduleCurrent, double moduleVoltage,
94 double poweringLoss, double lossInCable, double cableLen,
95 MsgStream& msg) const
96{
97 /*
98 cout << "computeLVGaugeSerial: nModules = " << nModules
99 << " moduleCurrent " << moduleCurrent
100 << " moduleVoltage " << moduleVoltage
101 << " poweringLoss " << poweringLoss
102 << " lossInCable " << lossInCable
103 << " cableLen " << cableLen
104 << endl;
105 */
106 // serial powering
107 double cableCurrent = moduleCurrent;
108 double staveVoltage = moduleVoltage * nModules / (1.-poweringLoss);
109 double stavePower = cableCurrent*staveVoltage;
110 double cablePowerDissipation = stavePower * lossInCable;
111 if (cablePowerDissipation < 2.) cablePowerDissipation = 2.; // we can always accept 2 W power loss in cable
112
113 double cableResistivity = cablePowerDissipation / (cableCurrent*cableCurrent);
114 double resistivityPerMeter = cableResistivity / (2*cableLen);
115
116 int gauge = ccaw::closestResistivityCcawGauge( resistivityPerMeter);
117
118 msg << MSG::DEBUG << DetType::name( type, part) << " layer " << layerNumber
119 << " SP loop power " << stavePower << " [W], current " << moduleCurrent
120 // << " [A], cablePowerLoss " << cablePowerDissipation
121 << " [W], desired resistivity " << resistivityPerMeter
122 << " [Ohm/m], closest gauge " << gauge << endl;
123
124 return gauge;
125}
126
#define endmsg
StaveServices compute(DetType::Type, DetType::Part, int layerNumber, int nModulesPerStave, int nChipsPerModule, MsgStream &msg) const
int computeLVGaugeSerial(DetType::Type, DetType::Part, int layerNumber, int nModules, double moduleCurrent, double moduleVoltage, double poweringLoss, double lossInCable, double cableLen, MsgStream &msg) const
Class storing all the services of a stave (or a petal, etc...) classifying them by function and by nu...
@ Pixel
Definition DetType.h:13
std::string name(Type t)
Definition DetType.h:16
int closestResistivityCcawGauge(double res)
Definition CcawUtils.h:50
STL namespace.
MsgStream & msg
Definition testRead.cxx:32