Test_Example.aadl 7.64 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
SYSTEM Bank
END Bank;

SYSTEM IMPLEMENTATION Bank.others
SUBCOMPONENTS
  Customer : PROCESS Bank_P::Customer.impl;
  AccountData : PROCESS Bank_P::AccountData.impl;
  Account : PROCESS Bank_P::Account.impl;
CONNECTIONS
		EVENT DATA PORT Customer.Request_out-> AccountData.Request_in;
		EVENT DATA PORT Customer.NumCard_out -> AccountData.NumCard_in;
		EVENT DATA PORT AccountData.session_id_out -> Customer.session_id_in;
		EVENT DATA PORT Customer.session_id_out-> Account.session_id_in;
		EVENT DATA PORT Customer.cmd_out -> Account.cmd_in;
		EVENT DATA PORT Customer.amount_out ->Account.amount_in;
		EVENT DATA PORT Account.result_out -> Customer.result_in;
END Bank.others;

PACKAGE Bank_P
PUBLIC

  PROCESS Customer
  FEATURES
    NumCard_in : IN EVENT DATA PORT Integer_Type;
    Code_in : IN EVENT DATA PORT Integer_Type;
    result_in : IN EVENT DATA PORT Integer_Type;
    session_id_in : IN EVENT DATA PORT Integer_Type;
    NumCard_out : OUT EVENT DATA PORT Integer_Type;
    cmd_out : OUT EVENT DATA PORT Integer_Type;
    amount_out: OUT EVENT DATA PORT Integer_Type;
    session_id_out : OUT EVENT DATA PORT Integer_Type;
    Request_out : OUT EVENT DATA PORT Integer_Type;
  END Customer;

  PROCESS IMPLEMENTATION Customer.impl
  
  SUBCOMPONENTS
		GUI: THREAD GUIThread.Impl;
		validation: THREAD ValidationThread.Impl;

  CONNECTIONS
		EVENT DATA PORT NumCard_in -> GUI.NumCard_in;
		EVENT DATA PORT Code_in -> GUI.Code_in;
		EVENT DATA PORT result_in -> GUI.result_in;
		EVENT DATA PORT session_id_in -> validation.session_id_in;
		EVENT DATA PORT validation.NumCard_out -> NumCard_out;
		EVENT DATA PORT GUI.session_id_out -> session_id_out ;
		EVENT DATA PORT GUI.cmd_out -> cmd_out;
		EVENT DATA PORT GUI.amount_out -> amount_out;
		EVENT DATA PORT validation.Request_out-> Request_out;
		EVENT DATA PORT GUI.Control_out-> validation.Request_in;
		EVENT DATA PORT GUI.NumCard_out-> validation.NumCard_in;
		EVENT DATA PORT GUI.Code_out-> validation.Code_in;
		EVENT DATA PORT validation.session_id_out-> GUI.session_id_in;
		EVENT DATA PORT validation.Ok_out-> GUI.Ok_in;
		EVENT DATA PORT validation.RestoreCode_out-> GUI.RestoreCode_in;
		EVENT DATA PORT validation.RejectedCard_out-> GUI.RejectedCard_in;
  
  
  END Customer.impl;

  PROCESS AccountData
   FEATURES
    Request_in : IN EVENT DATA PORT Integer_Type;
    NumCard_in : IN EVENT DATA PORT Integer_Type;
    session_id_out : OUT EVENT DATA PORT Integer_Type;
  END AccountData;

  PROCESS IMPLEMENTATION AccountData.impl
    SUBCOMPONENTS
		AccountDataT: THREAD AccountDataThread.Impl;

	CONNECTIONS
		EVENT DATA PORT Request_in -> AccountDataT.Request_in;
		EVENT DATA PORT NumCard_in -> AccountDataT.NumCard_in;
		EVENT DATA PORT AccountDataT.session_id_out ->session_id_out;
  
  END AccountData.impl;

  PROCESS Account
   FEATURES
    cmd_in : IN EVENT DATA PORT Integer_Type;
    amount_in : IN EVENT DATA PORT Integer_Type;
    session_id_in : IN EVENT DATA PORT Integer_Type; 
    result_out : OUT EVENT DATA PORT Integer_Type;
  END Account;

  PROCESS IMPLEMENTATION Account.impl
  SUBCOMPONENTS
		AccountT: THREAD AccountThread.Impl;

  CONNECTIONS
		EVENT DATA PORT cmd_in -> AccountT.cmd_in;
		EVENT DATA PORT amount_in -> AccountT.amount_in;
		EVENT DATA PORT AccountT.result_out -> result_out;
		EVENT DATA PORT session_id_in -> AccountT.session_id_in ;
  END Account.impl;
  
   THREAD GUIThread
    FEATURES
       	NumCard_in: IN EVENT DATA PORT Integer_Type;
		Code_in: IN EVENT DATA PORT Integer_Type;
		result_in: IN EVENT DATA PORT Integer_Type;
		RejectedCard_in: IN EVENT DATA PORT Integer_Type;
		OK_in: IN EVENT DATA PORT Integer_Type;
		RestoreCode_in: IN EVENT DATA PORT Integer_Type;
		session_id_in: IN EVENT DATA PORT Integer_Type;
		Control_out: OUT EVENT DATA PORT Integer_Type;
		NumCard_out:  OUT EVENT DATA PORT Integer_Type;
		Code_out: OUT EVENT DATA PORT Integer_Type;
		cmd_out: OUT EVENT DATA PORT Integer_Type;
		amount_out: OUT EVENT DATA PORT Integer_Type;
		session_id_out: OUT EVENT DATA PORT Integer_Type;
   END GUIThread;
   
  
  THREAD IMPLEMENTATION GUIThread.impl

    PROPERTIES
		Dispatch_protocol => Sporadic;
		Period => 10 Ms;
		deadline => 10 Ms;
		Compute_Execution_Time => 0 ms..3 ms;
		cheddar_Properties::Fixed_Priority => 1;
  END GUIThread.impl;
  
   THREAD ValidationThread
    FEATURES
        Request_in: IN EVENT DATA PORT Integer_Type;
		NumCard_in: IN EVENT DATA PORT Integer_Type;
		Code_in: IN EVENT DATA PORT Integer_Type;
		session_id_in: IN EVENT DATA PORT Integer_Type;
		RejectedCard_out: OUT EVENT DATA PORT Integer_Type;
		OK_out: OUT EVENT DATA PORT Integer_Type;
		RestoreCode_out: OUT EVENT DATA PORT Integer_Type;
		NumCard_out: OUT EVENT DATA PORT Integer_Type;
		Request_out: OUT EVENT DATA PORT Integer_Type;
		session_id_out: OUT EVENT DATA PORT Integer_Type;

   END ValidationThread;
   
  
  THREAD IMPLEMENTATION ValidationThread.impl

    PROPERTIES
		Dispatch_protocol => Sporadic;
		Period => 10 Ms;
		deadline => 10 Ms;
		Compute_Execution_Time => 0 ms..3 ms;
		cheddar_Properties::Fixed_Priority => 2;
    ANNEX ao4aadl {**
		
		aspect CheckCode {

			pointcut pointcut1 ( a:Integer_Type,  b:String_Type ): 
						execution inport (RestoreCode_out (..)) && args (a,b);
			
			pointcut Verification (): call outport (RestoreCode_out (..));

			advice around(): Verification(){

				variables {
				     a,b,c : Integer_Type;
				     s : String_Type;
				}

				initially {
					  a := 10;
				}
				
 				c:=a+b;
			
			}

			advice before(a:Integer_Type, b:String_Type): pointcut1(a,b){
				
				variables {
					  a : Integer_Type;
				}

				initially {
				      a := 5;
				}
				a:=a+1;
			}

			advice around(a:Integer_Type, b:String_Type): pointcut1(a,b){
				
				variables {
					  a : Integer_Type;
				}

				initially {
				      a := 5;
				}
				a:=a+3;
	
			}


		}
		
		aspect Logging {
		
		pointcut log (): call subprogram (* (..));

  		advice after (): log () {
		       	variables {
					  a : Integer_Type;
				}

				initially {
				      a := 5;
				      a := 10;
				      a := 115;
				}
				a:=a+6;

     		}

  }
		
   **};

  END ValidationThread.impl;
  
  
   THREAD AccountDataThread
    FEATURES
        Request_in: IN EVENT DATA PORT Integer_Type;
		NumCard_in: IN EVENT DATA PORT Integer_Type;
		session_id_out: OUT EVENT DATA PORT Integer_Type;
   END AccountDataThread;
  
  THREAD IMPLEMENTATION AccountDataThread.impl
    CALLS{
		findSession_Sbg: subprogram FindSession;
	};
	
	CONNECTIONS
		PARAMETER NumCard_in -> findSession_Sbg.NumCard_in;
		PARAMETER findSession_Sbg.session_id_out -> session_id_out;

    PROPERTIES
		Dispatch_protocol => Sporadic;
		Period => 10 Ms;
		deadline => 10 Ms;
		Compute_Execution_Time => 0 ms..3 ms;
		cheddar_Properties::Fixed_Priority => 3;
  END AccountDataThread.impl;

  THREAD AccountThread
    FEATURES
        cmd_in: IN EVENT DATA PORT Integer_Type;
		amount_in: IN EVENT DATA PORT Integer_Type;
		session_id_in: IN EVENT DATA PORT Integer_Type;
		result_out: OUT EVENT DATA PORT Integer_Type;

  END AccountThread;
  
  THREAD IMPLEMENTATION AccountThread.impl
    PROPERTIES
		Dispatch_protocol => Sporadic;
		Period => 10 Ms;
		deadline => 10 Ms;
		Compute_Execution_Time => 0 ms..3 ms;
		cheddar_Properties::Fixed_Priority => 4;
  END AccountThread.impl;
  
  
  
  SUBPROGRAM FindSession
    FEATURES
        NumCard_in: IN PARAMETER Integer_Type;
        session_id_out: OUT PARAMETER Integer_Type;
  END FindSession;

  SUBPROGRAM IMPLEMENTATION FindSession.impl
  ANNEX behavior_specification {**
  **};
  END FindSession.impl;

  DATA Integer_Type
  PROPERTIES
	Data_Model::Data_Representation => integer;
  END Integer_Type;

  DATA String_Type
  PROPERTIES
	Data_Model::Data_Representation => string;
  END String_Type;

END Bank_P;