Commit caabbdea93228f5ea6adf18939f6ace21096ece2

Authored by Etienne Pallier
1 parent 6a3f890b
Exists in dev

plantUML diagrams créés récursivement dans les dossiers doc/

README.md
... ... @@ -71,9 +71,9 @@ Date: 26/04/2019
71 71  
72 72 Author: E. Pallier
73 73  
74   -VERSION: 0.20.41
  74 +VERSION: 0.20.42
75 75  
76   -Comment: AgentDeviceTelescopeStatus : 1 seule ligne mise à jour dans la table
  76 +Comment: plantUML diagrams créés récursivement dans les dossiers doc/
77 77  
78 78 - Scenario de test :
79 79 - lancer agents A et B en mode simu (option -t): ./pyros.py -t start agentA,agentB
... ... @@ -88,6 +88,7 @@ Comment: AgentDeviceTelescopeStatus : 1 seule ligne mise à jour dans la table
88 88 - pour utiliser thread ou processus : il suffit de mettre la constante RUN_IN_THREAD de AgentA (ou AgentB ou AgentX) à False ou True
89 89  
90 90 - Historique des nouveautés implémentées :
  91 + - AgentDeviceTelescopeStatus : 1 seule ligne mise à jour dans la table
91 92 - AgentDevice + AgentDeviceTelescopeStatus + AgentTelescopeRequester :
92 93 - AgentDevice met à jour la table AgentDeviceTelescopeStatus
93 94 - AgentTelescopeRequester interroge AgentDevice
... ...
pyros.py
... ... @@ -484,16 +484,10 @@ def _update_python_packages_from_requirements():
484 484 return res
485 485  
486 486 def _update_plantuml_diags():
487   - change_dir("src")
488   - for entry in os.listdir("."):
489   - if os.path.isdir(entry):
490   - change_dir(entry)
491   - if glob.glob("*.pu"):
492   - fics = glob.glob("*.pu")
493   - for fic in fics:
494   - res = execProcessFromVenv("-m plantuml "+fic)
495   - change_dir("..")
496   - change_dir("..")
  487 + for dirpath, dirnames, files in os.walk('src'):
  488 + if os.path.basename(dirpath) == "doc":
  489 + diagrams = glob.glob(dirpath+os.sep+"*.pu")
  490 + for diag in diagrams: res = execProcessFromVenv("-m plantuml "+diag)
497 491 return res
498 492  
499 493 def _migrate():
... ...
src/agent/AgentDevice.py
... ... @@ -8,7 +8,7 @@ import time
8 8 ##from .Agent import Agent
9 9 sys.path.append("..")
10 10 from agent.Agent import Agent, extract_parameters
11   -from common.models import AgentDeviceTelescopeStatus
  11 +from common.models import AgentDeviceTelescopeStatus, get_or_create_unique_row_from_model
12 12 from devices_channel.client.telescope_controller_gemini import TelescopeControllerGEMINI
13 13  
14 14 ##log = L.setupLogger("AgentXTaskLogger", "AgentX")
... ... @@ -78,12 +78,15 @@ class AgentDevice(Agent):
78 78  
79 79 # Initialize the device table status
80 80 # If table is empty, create a default 1st row
  81 + self._agent_device_telescope_status = get_or_create_unique_row_from_model(AgentDeviceTelescopeStatus)
  82 + """
81 83 if not AgentDeviceTelescopeStatus.objects.exists():
82 84 print("CREATE first row")
83 85 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.create(id=1)
84 86 # Get 1st row (will be updated at each iteration by routine_process() with current device status)
85 87 print("GET first row")
86 88 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.get(id=1)
  89 + """
87 90  
88 91 # Initialize the device socket
89 92 # Port local AK 8085 = redirigé sur l’IP du tele 192.168.0.12 sur port 11110
... ...
src/agent/Agent_activity_diag.pu renamed to src/agent/doc/Agent_activity_diag.pu
src/common/models_Command_state_diag.pu renamed to src/common/doc/models_Command_state_diag.pu
src/common/models.py
... ... @@ -158,6 +158,12 @@ class Company(models.Model):
158 158 """
159 159  
160 160  
  161 +# ---
  162 +# --- Utility functions
  163 +# ---
  164 +def get_or_create_unique_row_from_model(model:models.Model):
  165 + return model.objects.get(id=1) if model.objects.exists() else model.objects.create(id=1)
  166 +
161 167  
162 168 """
163 169 ------------------------
... ...
src/devices_channel/client/Device_controller_abstract_activity_diag.pu deleted
... ... @@ -1,177 +0,0 @@
1   -
2   -@startuml
3   -
4   -' UML class Diagram : can be displayed with PlantUML (plugin for Eclipse or for PyCharm)
5   -
6   -' PlantUML:
7   -' - How to install : https://projects.irap.omp.eu/projects/pyros/wiki/Project_Development#PlantUML
8   -' - Eclipse plugin : http://plantuml.com/eclipse
9   -' - class diagrams : http://plantuml.com/class-diagram
10   -' - sequence diagrams : http://plantuml.com/sequence-diagram
11   -' - state diagrams : http://plantuml.com/state-diagram
12   -' - Use Case diagrams : http://plantuml.com/use-case-diagram
13   -' - OLD Activity diagrams : http://plantuml.com/activity-diagram-legacy
14   -' - NEW Activity diagrams : http://plantuml.com/activity-diagram-beta
15   -' - Pre-processing (include...) : http://plantuml.com/preprocessing
16   -' - GANTT diagrams : http://plantuml.com/gantt-diagram
17   -' - REAL WORLD EXAMPLES !!! : https://real-world-plantuml.com/
18   -' - For Python:
19   -' - https://github.com/SamuelMarks/python-plantuml
20   -' - https://pythonhosted.org/plantuml/
21   -
22   -' UML diagrams theory : https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/index.html
23   -
24   -
25   -title
26   -__**DeviceController and ClientChannel classes diagram (1 - composition)**__
27   -<i>(ClientChannel is a COMPONENT of DeviceController)</i>
28   -end title
29   -
30   -
31   -/' Channels '/
32   -ClientChannel <|-- ClientSerial
33   -ClientChannel <|-- ClientSocket
34   -ClientChannel <|-- ClientUSB
35   -
36   -abstract class ClientChannel {
37   - my_channel # socket or serial or usb...
38   - {abstract} connect_to_server()
39   - {abstract} read()
40   - {abstract} put()
41   - put_read()
42   - {abstract} send_data()
43   - {abstract} receive_data()
44   - {abstract} close()
45   -}
46   -
47   -class ClientSocket {
48   - my_channel # (socket)
49   - --
50   - connect_to_server()
51   - send_data()
52   - receive_data()
53   - close()
54   -}
55   -
56   -
57   -/' Abstract Devices Controllers '/
58   -DeviceControllerAbstract o-- ClientChannel
59   -
60   -DeviceControllerAbstract <|-- TelescopeControllerAbstract
61   -DeviceControllerAbstract <|-- PLCControllerAbstract
62   -DeviceControllerAbstract <|-- CameraControllerAbstract
63   -
64   -abstract class DeviceControllerAbstract {
65   - my_channel # socket or serial or usb...
66   - _cmd = {start, stop, park...}
67   - class GenericResult
68   - --
69   - {abstract} connect_to_device()
70   - {abstract} _format_data_to_send()
71   - {abstract} _unformat_received_data()
72   - available_commands()
73   - execute()
74   - execute_generic_cmd()
75   - execute_native_cmd()
76   - execute_native_cmd()
77   - send_data()
78   - receive_data()
79   - ---
80   - **Abstract GET/SET/DO commands :**
81   - {abstract} get_timezone(), set_timezone()
82   - {abstract} get_date(), set_date()
83   - {abstract} get_time(), set_time()
84   - {abstract} do_park()
85   - {abstract} do_start()
86   - {abstract} do_stop()
87   - {abstract} do_init()
88   -}
89   -
90   -abstract class TelescopeControllerAbstract {
91   - _cmd = {get_ra, get_dec, do_goto...}
92   - ----
93   - **Abstract GET/SET/DO commands :**
94   - {abstract} get_ack()
95   - {abstract} get_ra(), set_ra()
96   - {abstract} get_dec(), set_dec()
97   - get_radec(), set_radec()
98   - {abstract} get_lat(), set_lat()
99   - {abstract} get_long(), set_long()
100   - {abstract} set_speed()
101   - {abstract} do_warm_start()
102   - {abstract} do_prec_refr()
103   - ----
104   - **Generic MACRO commands:**
105   - do_init()
106   - do_goto()
107   - do_move()
108   -}
109   -
110   -abstract class PLCControllerAbstract {
111   - _cmd = {get_status, set_light...}
112   -}
113   -
114   -abstract class CameraControllerAbstract {
115   - _cmd = {set_pose, do_start_acq...}
116   -}
117   -
118   -/' Concrete Devices Controllers '/
119   -
120   -TelescopeControllerAbstract <|-- TelescopeControllerMeade
121   -TelescopeControllerAbstract <|-- TelescopeControllerGemini
122   -TelescopeControllerAbstract <|-- TelescopeControllerColibri
123   -
124   -PLCControllerAbstract <|-- PLCControllerAK
125   -PLCControllerAbstract <|-- PLCControllerColibri
126   -
127   -CameraControllerAbstract <|-- CameraControllerVIS_AK
128   -CameraControllerAbstract <|-- CameraControllerCAGIRE
129   -CameraControllerAbstract <|-- CameraControllerDDRAGO
130   -
131   -class TelescopeControllerGemini {
132   - _cmd = {get_ra, get_dec, do_goto...}
133   - format_data_to_send()
134   - unformat_received_data()
135   -}
136   -
137   -TelescopeControllerMeade : _cmd = {get_ra, get_dec, do_goto...}
138   -
139   -@enduml
140   -'''
141   -
142   -
143   -'''
144   -@startuml
145   -
146   -title
147   -__**DeviceController and ClientChannel classes diagram (2 - multi-inheritance)**__
148   -<i>(TelescopeGemini heritates both from DeviceController and ClientChannel)</i>
149   -
150   -end title
151   -
152   -
153   -/' Abstract Devices Controllers '/
154   -DeviceControllerAbstract <|-- PLCControllerAbstract
155   -DeviceControllerAbstract <|-- CameraControllerAbstract
156   -DeviceControllerAbstract <|-- TelescopeControllerAbstract
157   -
158   -/' Concrete Devices Controllers '/
159   -
160   -TelescopeControllerAbstract <|-- TelescopeControllerMeade
161   -TelescopeControllerAbstract <|-- TelescopeControllerGemini
162   -ClientSocket <|-- TelescopeControllerGemini
163   -TelescopeControllerAbstract <|-- TelescopeControllerColibri
164   -
165   -PLCControllerAbstract <|-- PLCControllerAK
166   -PLCControllerAbstract <|-- PLCControllerColibri
167   -
168   -CameraControllerAbstract <|-- CameraControllerVIS_AK
169   -CameraControllerAbstract <|-- CameraControllerCAGIRE
170   -CameraControllerAbstract <|-- CameraControllerDDRAGO
171   -
172   -/' Channels '/
173   -ClientChannel <|-- ClientSocket
174   -ClientChannel <|-- ClientSerial
175   -ClientChannel <|-- ClientUSB
176   -
177   -@enduml
src/devices_channel/doc/device_controller_class_diagram.txt renamed to src/devices_channel/doc/Device_controller_abstract_activity_diag.pu 100644 → 100755
  1 +
  2 +@startuml
  3 +
1 4 /'
2 5 UML class Diagram : can be displayed with PlantUML (plugin for Eclipse or for PyCharm)
3 6  
... ... @@ -20,16 +23,12 @@ PlantUML:
20 23 UML diagrams theory : https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/index.html
21 24 '/
22 25  
23   -
24   -
25   -@startuml
26   -
27 26 title
28   -__**DeviceController and ClientChannel classes diagram (1 - composition)**__
  27 +__**DeviceController and ClientChannel classes diagram (composition)**__
29 28 <i>(ClientChannel is a COMPONENT of DeviceController)</i>
30   -
31 29 end title
32 30  
  31 +
33 32 /' Channels '/
34 33 ClientChannel <|-- ClientSerial
35 34 ClientChannel <|-- ClientSocket
... ... @@ -69,8 +68,8 @@ abstract class DeviceControllerAbstract {
69 68 class GenericResult
70 69 --
71 70 {abstract} connect_to_device()
72   - {abstract} format_data_to_send()
73   - {abstract} unformat_received_data()
  71 + {abstract} _format_data_to_send()
  72 + {abstract} _unformat_received_data()
74 73 available_commands()
75 74 execute()
76 75 execute_generic_cmd()
... ...
src/devices_channel/doc/device_controller_class_diagram_multiinheritance.txt renamed to src/devices_channel/doc/Device_controller_abstract_activity_diag_multiinheritance.pu 100644 → 100755
  1 +
  2 +/'
  3 +UML class Diagram : can be displayed with PlantUML (plugin for Eclipse or for PyCharm)
  4 +
  5 +PlantUML:
  6 +- How to install : https://projects.irap.omp.eu/projects/pyros/wiki/Project_Development#PlantUML
  7 +- Eclipse plugin : http://plantuml.com/eclipse
  8 +- class diagrams : http://plantuml.com/class-diagram
  9 +- sequence diagrams : http://plantuml.com/sequence-diagram
  10 +- state diagrams : http://plantuml.com/state-diagram
  11 +- Use Case diagrams : http://plantuml.com/use-case-diagram
  12 +- OLD Activity diagrams : http://plantuml.com/activity-diagram-legacy
  13 +- NEW Activity diagrams : http://plantuml.com/activity-diagram-beta
  14 +- Pre-processing (include...) : http://plantuml.com/preprocessing
  15 +- GANTT diagrams : http://plantuml.com/gantt-diagram
  16 +- REAL WORLD EXAMPLES !!! : https://real-world-plantuml.com/
  17 +- For Python:
  18 + - https://github.com/SamuelMarks/python-plantuml
  19 + - https://pythonhosted.org/plantuml/
  20 +
  21 +UML diagrams theory : https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/index.html
  22 +'/
  23 +
  24 +
1 25 @startuml
2 26  
3 27 title
4   -__**DeviceController and ClientChannel classes diagram (2 - multi-inheritance)**__
  28 +__**DeviceController and ClientChannel classes diagram (multi-inheritance)**__
5 29 <i>(TelescopeGemini heritates both from DeviceController and ClientChannel)</i>
6 30  
7 31 end title
... ...
src/devices_channel/doc/generate_diagrams.sh
... ... @@ -2,4 +2,4 @@
2 2 # https://github.com/SamuelMarks/python-plantuml
3 3 # https://pythonhosted.org/plantuml/
4 4  
5   -python3 -m plantuml device_controller_class_diagram*.txt
  5 +python3 -m plantuml *.pu
... ...