Add 06/21 by Matteo

This commit is contained in:
Marco Realacci 2022-11-14 16:30:34 +01:00
parent 970467fe89
commit 1be2085d94
169 changed files with 962 additions and 0 deletions

View file

@ -0,0 +1,14 @@
class Monitor
InputReal x, y, z; // plant output
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 50) and (x < 0.6*y) and (x + y <= 0.3*z);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1,4 @@
Si consideri il seguente requisito:
RQ: Dopo 50 unità di tempo dall'inizio dell'esecuzione vale la seguente proprietà:
se la variabile x è minore del 60% della variabile y allora la somma di x ed y è maggiore del 30% della variabile z
Quale dei seguenti monitor meglio descrive il requisito RQ ?

View file

@ -0,0 +1,14 @@
class Monitor
InputReal x, y, z; // plant output
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 50) and (x >= 0.6*y) and (x + y <= 0.3*z);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1,14 @@
class Monitor
InputReal x, y, z; // plant output
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 50) and (x < 0.6*y) and (x + y > 0.3*z);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1,14 @@
model System
Integer y;
Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
equation
y = if (r1024 <= 0.3) then 1 else 0;
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
end when;
end System;

View file

@ -0,0 +1 @@
Si consideri l'ambiente (use case) che consiste di un utente che, ad ogni unità di tempo (ad esempio, un secondo) manda al nostro sistema input 1 (ad esempio, esegue una prenotazione) con probabilità 0.3 oppure input 0 con probabilità 0.7. Quale dei seguenti modelli Modelica rappresenta correttamente tale ambiente.

View file

@ -0,0 +1,13 @@
model System
Integer y; Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
equation
y = if (r1024 <= 0.3) then 0 else 1;
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
end when;
end System;

View file

@ -0,0 +1,13 @@
model System
Integer y; Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
equation
y = if (r1024 >= 0.3) then 1 else 0;
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
end when;
end System;

View file

@ -0,0 +1 @@
Per tutti gli istanti di tempo della forma 1 + 4*k (con k = 0, 1, 2, 3, ...) x vale 1.

View file

@ -0,0 +1,13 @@
Si consideri il seguente modello Modelica:
<html>
class System
Integer x;
initial equation
x = 0;
equation
when sample(0, 2) then
x = 1 - pre(x);
end when;
end System;
</html>
Quale delle seguenti affermazioni è vera per la variabile intera x?

View file

@ -0,0 +1 @@
Per tutti gli istanti di tempo della forma 3 + 4*k (con k = 0, 1, 2, 3, ...) x vale 1.

View file

@ -0,0 +1 @@
Per tutti gli istanti di tempo della forma 1 + 4*k (con k = 0, 1, 2, 3, ...) x vale 0.

View file

@ -0,0 +1,13 @@
class Monitor
InputReal x, y;
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 60) and (delay(x, 10) > 0) and (y >= 0);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1,5 @@
Si consideri il seguente requisito:
RQ: Dopo 60 unità di tempo dall'inizio dell'esecuzione vale la seguente proprietà:
se 10 unità di tempo nel passato x era maggiore di 0 allora ora y è negativa.
Tenendo presente che, al tempo time, delay(z, w) ritorna 0 se time <= w e ritorna il valore che z aveva al tempo (time - w), se time = w.
Quale dei seguenti monitor meglio descrive il requisito RQ ?

View file

@ -0,0 +1,13 @@
class Monitor
InputReal x, y;
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 60) and (delay(x, 10) <= 0) and (y >= 0);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1,14 @@
class Monitor
InputReal x, y;
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 60) or (delay(x, 10) > 0) or (y >= 0);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1,4 @@
L'input ad un sistema è costituito da un utente (umano) che preme due pulsanti etichettati, rispettivamente, con 1 ed 2.
L'utente può anche decidere di non premere alcun pulsante.
Con probabilità 0.2 l'utente preme il pulsante 1, con probabilità 0.3 l'utente preme il pulsante 2, con probabilità 0.5 non fa nulla (pulsante 0 per convenzione).
Quale dei seguenti modelli Modelica fornisce un modello ragionevole per l'utente di cui sopra?

View file

@ -0,0 +1,19 @@
model Env
Integer x; // Pulsante premuto dall'utente (0 nessun pulsante)
Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
x := 0;
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= 0.5)
then x := 0;
else
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= 0.4) then x := 1; else x:= 0; end if;
end if;
end when;
end Env;

View file

@ -0,0 +1,19 @@
model Env
Integer x; // Pulsante premuto dall'utente (0 nessun pulsante)
Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
x := 0;
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= 0.5)
then x := 0;
else
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= 0.3) then x := 0; else x:= 1; end if;
end if;
end when;
end Env;

View file

@ -0,0 +1,19 @@
model Env
Integer x; // Pulsante premuto dall'utente (0 nessun pulsante)
Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
x := 0;
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= 0.5)
then x := 0;
else
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= 0.2) then x := 1; else x:= 0; end if;
end if;
end when;
end Env;

View file

@ -0,0 +1 @@
Sviluppo plan-driven.

View file

@ -0,0 +1 @@
Si pianifica di sviluppare un software gestionale per una università. Considerando che questo può essere considerato un sistema mission-critical, quali dei seguenti modelli di processi software generici è più adatto per lo sviluppo di tale software.

View file

@ -0,0 +1 @@
Sviluppo Iterativo

View file

@ -0,0 +1 @@
Sviluppo Agile.

View file

@ -0,0 +1 @@
Testare l'interazione tra le componenti del sistema (cioè, integrazione di molte unità di sistema).

View file

@ -0,0 +1 @@
Il system testing si concentra su:

View file

@ -0,0 +1 @@
Testare le interfacce per ciascuna componente.

View file

@ -0,0 +1 @@
Testare le funzionalità di unità software individuali, oggetti, classi o metodi.

View file

@ -0,0 +1 @@
Testare funzionalità di unità software individuali, oggetti, classi o metodi.

View file

@ -0,0 +1 @@
Unit testing si concentra su:

View file

@ -0,0 +1 @@
Testare le interfacce di ciascuna componente.

View file

@ -0,0 +1 @@
Testare l'interazione tra componenti.

View file

@ -0,0 +1 @@
1/1000

View file

@ -0,0 +1 @@
Il rischio R può essere calcolato come R = P*C, dove P è la probabilità dell'evento avverso (software failure nel nostro contesto) e C è il costo dell'occorrenza dell'evento avverso. Si consideri un software il cui costo per la failure è C = 1000000 EUR. Volendo un rischio non superiore a 1000 EUR quale è il valore massimo della probabilità di failure P accettabile?

View file

@ -0,0 +1 @@
1/10

View file

@ -0,0 +1 @@
1/100

View file

@ -0,0 +1,13 @@
class Monitor
InputReal x, y;
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 60) and (delay(x, 10) > 0) and (y <= 0);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1,5 @@
Si consideri il seguente requisito:
RQ: Dopo 60 unità di tempo dall'inizio dell'esecuzione vale la seguente proprietà:
se 10 unità di tempo nel passato era stata richiesta una risorsa (variabile x positiva) allora ora è concesso l'accesso alla risorsa (variabile y positiva)
Tenendo presente che, al tempo time, delay(z, w) ritorna 0 se time < w e ritorna il valore che z aveva al tempo (time - w), se time >= w.
Quale dei seguenti monitor meglio descrive il requisito RQ ?

View file

@ -0,0 +1,14 @@
class Monitor
InputReal x, y;
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 60) or (delay(x, 10) > 0) or (y <= 0);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1,13 @@
class Monitor
InputReal x, y;
OutputBoolean wy;
Boolean wz;
initial equation
wy = false;
equation
wz = (time > 60) and (delay(x, 10) > 0) and (y > 0);
algorithm
when edge(wz) then
wy := true;
end when;
end Monitor;

View file

@ -0,0 +1 @@
2*A*(p +1)

View file

@ -0,0 +1 @@
Si consideri un software sviluppato seguendo un approccio iterativo implementato con due fasi: F1 seguita da F2. Ciascuna fase ha costo A e deve essere ripetuta una seconda volta con probabilità p. Qual'e' il costo atteso dello sviluppo dell'intero software?

View file

@ -0,0 +1 @@
3*A*(p + 1)

View file

@ -0,0 +1 @@
2*A*(p + 2)

View file

@ -0,0 +1 @@
Ad ogni istante di tempo della forma 1 + 4*k (k = 0, 1, 2, 3, ...), x vale "true".

View file

@ -0,0 +1,13 @@
Si consideri il seguente modello Modelica.
<html>
class System
Boolean x;
initial equation
x = false;
equation
when sample(0, 2) then
x = not (pre(x));
end when;
end System;
</html>
Quale delle seguenti affermazioni vale per la variabile booleana x ?

View file

@ -0,0 +1 @@
At time instants of form 1 + 4*k (with k = 0, 1, 2, 3, ...) x takes value "false".

View file

@ -0,0 +1 @@
Ad ogni istante di tempo della forma 3 + 4*k (k = 0, 1, 2, 3, ...), x vale "true".

View file

@ -0,0 +1 @@
6*A

View file

@ -0,0 +1 @@
Si consideri un software sviluppato seguendo un approccio plan-driven implementato con tre fasi: F1, F2, F3 ciascuna con costo A. Le "change request" possono arrivare solo al fine di una fase e provocano la ripetizione (con relativo costo) di tutte le fasi che precedono. Si assuma che dopo la fase F3 (cioè al termine dello sviluppo) arriva una change request. Qual'e' il costo totale per lo sviluppo del software in questione.

View file

@ -0,0 +1 @@
5*A

View file

@ -0,0 +1 @@
4*A

View file

@ -0,0 +1 @@
S = (1/b)*ln(C/R)

View file

@ -0,0 +1 @@
Il rischio R può essere calcolato come R = P*C, dove P è la probabilità dell'evento avverso (software failure nel nostro contesto) e C è il costo dell'occorrenza dell'evento avverso. Assumiamo che la probabilità P sia legata al costo di sviluppo S dalla formula P = exp(-b*S), dove b è una opportuna costante note da dati storici aziendali. Quale sarà il costo dello sviluppo S di un software il cui costo della failure è C ed il rischio ammesso è R?

View file

@ -0,0 +1 @@
S = b*ln(R/C)

View file

@ -0,0 +1 @@
S = (1/b)*ln(R/C)

View file

@ -0,0 +1 @@
A*(2 + p)

View file

@ -0,0 +1 @@
Si consideri un software costituito da due fasi F1 ed F2 ciascuna di costo A. Con probabilità p la fase F1 deve essere ripetuta (a causa di change requests) e con probabilità (1 - p) si passa alla fase F2 e poi al completamento (End) dello sviluppo. Qual'eè il costo atteso per lo sviluppo del software seguendo il processo sopra descritto ?

View file

@ -0,0 +1 @@
3*A*p

View file

@ -0,0 +1 @@
A*(1 + p)

Binary file not shown.

After

(image error) Size: 30 KiB

Binary file not shown.

After

(image error) Size: 24 KiB

Binary file not shown.

After

(image error) Size: 21 KiB

View file

@ -0,0 +1 @@
img=https://i.imgur.com/LSxqSIl.png

View file

@ -0,0 +1 @@
Si consideri un software sviluppato seguendo un approccio plan-driven implementato con tre fasi: F1, F2, F3. Dopo ogni fase c'e' una probabilità p di dover ripeter la fase precedente ed una probabilità (1 - p) di passare alla fase successiva (sino ad arrivare al termine dello sviluppo). Quale delle seguenti catene di Markov modella il processo software descritto sopra?

View file

@ -0,0 +1 @@
img=https://i.imgur.com/yGc7Zf2.png

View file

@ -0,0 +1 @@
img=https://i.imgur.com/3t92wEw.png

View file

@ -0,0 +1,15 @@
class Monitor
InputReal x; // plant output
OutputBoolean y;
Boolean z;
initial equation
y = false;
equation
z = (time > 0) and ((x >= 5) or (x <= 0)) and ((x >= 15) or (x <= 10)) ;
algorithm
when edge(z) then
y := true;
end when;
end Monitor;

View file

@ -0,0 +1,3 @@
Si consideri il seguente requisito:
RQ1: Durante l'esecuzione del programma (cioè per tutti gli istanti di tempo positivi) la variabile x è sempre nell'intervallo [0, 5] oppure [10, 15]
Quale dei seguenti monitor meglio descrive il requisito RQ1 ?

View file

@ -0,0 +1,15 @@
class Monitor
InputReal x; // plant output
OutputBoolean y;
Boolean z;
initial equation
y = false;
equation
z = (time > 0) and ((x >= 0) or (x <= 5)) and ((x >= 10) or (x <= 15)) );
algorithm
when edge(z) then
y := true;
end when;
end Monitor;

View file

@ -0,0 +1,15 @@
class Monitor
InputReal x; // plant output
OutputBoolean y;
Boolean z;
initial equation
y = false;
equation
z = (time > 0) and ( ((x >= 0) and (x <= 5)) or ((x >= 10) and (x <= 15)) );
algorithm
when edge(z) then
y := true;
end when;
end Monitor;

View file

@ -0,0 +1 @@
La variabile x è nell'intervallo [1, 4] oppure nell'intervallo [15, 20].

View file

@ -0,0 +1,17 @@
Si consideri il monitor seguente che ritorna true appena il sistema viola il requisito monitorato.
<html>
block Monitor
input Real x;
output Boolean y;
Boolean w;
initial equation
y = false;
equation
w = ((x < 1) or (x > 4)) and ((x < 15) or (x > 20));
algorithm
when edge(w) then
y := true;
end when;
end Monitor;
</html>
Quale delle seguenti affermazioni meglio descrive il requisito monitorato?

View file

@ -0,0 +1 @@
La variabile x è fuori dall'intervallo [1, 4] e fuori dall'intervallo [15, 20].

View file

@ -0,0 +1 @@
La variabile x è nell'intervallo [1, 4] e fuori dall'intervallo [15, 20].

View file

@ -0,0 +1,12 @@
class System
Real x; // MB in buffer
Real u; // input pulse
initial equation
x = 3;
u = 0;
equation
when sample(0, 1) then
u = 1 - pre(u);
end when;
der(x) = 2*u - 1.0;
end System;

View file

@ -0,0 +1 @@
Un I/O buffer è alimentato da una componente che fornisce un input periodico di periodo 2 secondi. Durante la prima metà del periodo, l'input rate è 2MB/s mentre durante la seconda metà del periodo l'input rate è 0. Quindi l'input rate medio è di 1MB/s. L' I/O buffer, a sua volta, alimenta una componente che richiede (in media) 1MB/s. Quale dei seguenti modelli Modelica è un modello ragionevole per il sistema descritto sopra ?

View file

@ -0,0 +1,12 @@
class System
Real x; // MB in buffer
Real u; // input pulse
initial equation
x = 3;
u = 0;
equation
when sample(0, 1) then
u = 1 - pre(u);
end when;
der(x) = 2*u - 2.0;
end System;

View file

@ -0,0 +1,12 @@
class System
Real x; // MB in buffer
Real u; // input pulse
initial equation
x = 3;
u = 0;
equation
when sample(0, 1) then
u = 1 - pre(u);
end when;
der(x) = 2*u + 1.0;
end System;

View file

@ -0,0 +1 @@
Testare le interfacce per ciascun componente.

View file

@ -0,0 +1 @@
Il component testing si concentra su:

View file

@ -0,0 +1 @@
Testare funzionalità di unità software individuali, oggetti, classi o metodi.

View file

@ -0,0 +1 @@
Testare l'interazione tra molte componenti (cioè integrazione di molte unità).

View file

@ -0,0 +1 @@
Requisito utente.

View file

@ -0,0 +1 @@
Si consideri il seguente requisito: "Il sistema fornisce l'elenco dei clienti in ordine alfabetico". Di che tipo di requisito si tratta?

View file

@ -0,0 +1 @@
Requisito di sistema.

View file

@ -0,0 +1 @@
Requisito non-funzionale.

Binary file not shown.

After

(image error) Size: 21 KiB

View file

@ -0,0 +1,33 @@
model System
parameter Integer F1 = 1;
parameter Integer F2 = 2;
parameter Integer F3 = 3;
parameter Integer End = 4;
parameter Real p = 0.3;
parameter Real A[4, 4] =
[
0, 1, 0, 0;
p, 0, 1-p, 0;
0, p, 0, 1-p;
0, 0, 0, 1
];
Integer x; Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
x := F1;
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= A[x, F1]) then
x := F1;
elseif (r1024 <= A[x, F1] + A[x, F2]) then
x := F2;
elseif (r1024 <= A[x, F1] + A[x, F2] + A[x, F3]) then
x := F3;
else
x := End;
end if;
end when;
end System;

View file

@ -0,0 +1,3 @@
img=https://i.imgur.com/t1KV4Qy.png
Si consideri la seguente Markov Chain:
Quale dei seguenti modelli Modelica fornisce un modello ragionevole per la Markov Chain di cui sopra?

View file

@ -0,0 +1,33 @@
model System
parameter Integer F1 = 1;
parameter Integer F2 = 2;
parameter Integer F3 = 3;
parameter Integer End = 4;
parameter Real p = 0.3;
parameter Real A[4, 4] =
[
0, 1, 0, 0;
p, 0, 0, 1-p;
0, 0, p, 1-p;
0, 0, 0, 1
];
Integer x; Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
x := F1;
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= A[x, F1]) then
x := F1;
elseif (r1024 <= A[x, F1] + A[x, F2]) then
x := F2;
elseif (r1024 <= A[x, F1] + A[x, F2] + A[x, F3]) then
x := F3;
else
x := End;
end if;
end when;
end System;

View file

@ -0,0 +1,33 @@
model System
parameter Integer F1 = 1;
parameter Integer F2 = 2;
parameter Integer F3 = 3;
parameter Integer End = 4;
parameter Real p = 0.3;
parameter Real A[4, 4] =
[
0, 1, 0, 0;
p, 1-p, 0, 0;
0, 0, p, 1-p;
0, 0, 0, 1
];
Integer x; Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
x := F1;
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= A[x, F1]) then
x := F1;
elseif (r1024 <= A[x, F1] + A[x, F2]) then
x := F2;
elseif (r1024 <= A[x, F1] + A[x, F2] + A[x, F3]) then
x := F3;
else
x := End;
end if;
end when;
end System;

View file

@ -0,0 +1 @@
1.5*A

View file

@ -0,0 +1 @@
Si consideri un software sviluppato seguendo un approccio plan-driven implementato con due fasi: F1, F2. La fase F1 ha costo A e la fase F2 ha costo il 50% di A. Qual'e' il costo dello sviluppo del software?

View file

@ -0,0 +1 @@
0.5*A

View file

@ -0,0 +1 @@
A

View file

@ -0,0 +1 @@
Una release del software è resa disponibile agli utenti (beta users) per permettergli di sperimentare e quindi segnalare eventuali problemi rilevati agli sviluppatori.

View file

@ -0,0 +1 @@
Quale delle seguenti affermazione è vera riguardo al beta testing ?

View file

@ -0,0 +1 @@
Test automatizzato sono eseguiti sulla versione finale del sistema presso il sito di sviluppo del software.

View file

@ -0,0 +1 @@
Test automatizzato sono eseguiti sulla versione finale del sistema presso il cliente.

Some files were not shown because too many files have changed in this diff Show more