8def add_daphne_conf(oksfile:str, object_name:str, json_file:str, timeout_ms:int = 1500):
9 """Script to add a new DaphneConf object from a given json file"""
10
11 print( "Adding file", json_file, "to object", object_name)
12
14
15 with open(json_file, 'r') as file:
16 data = file.read()
17
18 schemafile='schema/appmodel/PDS.schema.xml'
20
21
22 def_channel = dal.DaphneV2Channel( "daphne-v2-default-channel",
23 channel_id=100,
24 gain=1,
25 offset=2200,
26 trim=0 )
27 db.update_dal(def_channel)
28
29 def_adc = dal.DaphneV2ADC( "daphne-v2-default-adc",
30 low_resolution=False,
31 output_offset_binary=True,
32 MSB_first=True)
33 db.update_dal(def_adc)
34
35 def_pga = dal.DaphneV2PGA( "daphne-v2-default-pga",
36 lpf_cut_frequency=4,
37 integrator_disable=True,
38 gain=False)
39 db.update_dal(def_pga)
40
41 def_lna = dal.DaphneV2LNA( "daphne-v2-default-lna",
42 clamp=0,
43 integrator_disable=True,
44 gain=2)
45 db.update_dal(def_lna)
46
47 def_afe = dal.DaphneV2AFE( "daphne-v2-default-afe",
48 afe_id=100,
49 attenuator=2666,
50 v_bias=0,
51 adc=def_adc,
52 pga=def_pga,
53 lna=def_lna)
54 db.update_dal(def_afe)
55
56 def_board = dal.DaphneV2BoardConf( "daphne-v2-default-board",
57 bias_ctrl=0,
58 self_trigger_threshold=0,
59 default_channel=def_channel,
60 default_afe=def_afe )
61 db.update_dal(def_board)
62
63 new_conf = dal.DaphneConf(object_name,
64 timeout_ms=timeout_ms,
65 json_file=data,
66 default_v2_settings=def_board )
67 db.update_dal(new_conf)
68
69 db.commit()
70
71
module(name, schema, other_dals=[], backend='oksconflibs', db=None)