Skip to content

Commit

Permalink
[Upd] Reformat according to prettier rules
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Feb 25, 2024
1 parent 96106f1 commit 41fc064
Show file tree
Hide file tree
Showing 203 changed files with 9,705 additions and 9,297 deletions.
5 changes: 1 addition & 4 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ module.exports = {
settings: { react: { version: "18.2" } },
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
},
};
5 changes: 2 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ name: Docker Image CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
workflow_dispatch:

env:
REGISTRY: ghcr.io

jobs:

build:
# Skip if PR is from a fork
if: github.event_name != 'pull_request' || github.event.repository.full_name == github.event.pull_request.head.repo.full_name
Expand Down
56 changes: 29 additions & 27 deletions deploy/.docker/error.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<head>
<meta charset="utf-8" />
<title>
<!--# echo var="status" default="" --> <!--# echo var="status_text" default="Something goes wrong" -->
|
<!--# echo var="status" default="" --> <!--# echo var="status_text" default="Something goes wrong" --> |
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--# if expr="$status = 502" -->
<meta http-equiv="refresh" content="2">
<meta http-equiv="refresh" content="2" />
<!--# endif -->
</head>
<style type="text/css">
</head>
<style type="text/css">
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #fff;
height: 100vh;
margin: 0;
background: #263238 linear-gradient(5deg, #057fa5 0%, #263238 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
color: #fff;
height: 100vh;
margin: 0;
background: #263238 linear-gradient(5deg, #057fa5 0%, #263238 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>
<body>
<!--# if expr="$status = 502" -->
<h1>We are updating our website </h1>
<p>This is only for a few seconds, you will be redirected.</p>
<!--# else -->
<h1><!--# echo var="status" default="" --> <!--# echo var="status_text" default="Something goes wrong" --></h1>
<!--# endif -->
</body>
</html>
</style>
<body>
<!--# if expr="$status = 502" -->
<h1>We are updating our website</h1>
<p>This is only for a few seconds, you will be redirected.</p>
<!--# else -->
<h1>
<!--# echo var="status" default="" -->
<!--# echo var="status_text" default="Something goes wrong" -->
</h1>
<!--# endif -->
</body>
</html>
4 changes: 1 addition & 3 deletions deploy/no-proxy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: "3.8"

services:
fta-fmea:
Expand All @@ -12,7 +12,6 @@ services:
depends_on:
- fta-fmea-server


fta-fmea-server:
image: ghcr.io/kbss-cvut/fta-fmea:latest
ports:
Expand All @@ -22,7 +21,6 @@ services:
environment:
REPOSITORY_URL: ${REPOSITORY_URL:-http://db-server:7200/repositories/fta-fmea}


db-server:
build:
context: ../shared/db-server
Expand Down
44 changes: 24 additions & 20 deletions doc/fta-construction-algorithm.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ represent intermediate events and the root fault event. Boolean operators “AND
logic gate shapes between intermediate events and contributory factors or other intermediate events.

## System Modelling

The tool allows to model a system and its parts where parts are allowed to belong to only one whole.

The behavioral model of a system is defined by a set of behaviours and a set of relations among them. There are two types
of behaviors, i.e. _functions_ and _failure modes_ which are used to describe expected and unwanted behaviors
The behavioral model of a system is defined by a set of behaviours and a set of relations among them. There are two types
of behaviors, i.e. _functions_ and _failure modes_ which are used to describe expected and unwanted behaviors
respectively. The behavioral relationships are _part-whole_, _required_ and _impairing_ relation.

The part-whole relationship is used to describe how a complex behavior is composed
of its parts. Furthermore, the tool distinguishes two types of compositions of behavioral parts. The first is _AND_
composition, used to model that the whole is manifested only when all its parts are manifested. The second is _OR_
composition, used to model that the whole is manifested only when all its parts are manifested. The second is _OR_
composition, used to model that the whole is manifested if one of its parts is manifested.

The _required_ relationship is used to specify dependence between behaviors, e.g. functions of a computer require the
Expand All @@ -27,6 +28,7 @@ The _impairing_ relation among behaviors is used to specify mutual exclusion, e.
the failure mode of the CPU to overheat and burn.

## FTA Construction Algorithm

The algorithm to construct a fault tree from a function behavior is described by the recursive procedure GENERATE_FAULT_TREE
which takes as input a behavior. Given a function behavior as input the procedure generates a fault tree where the top
fault event is the failure of the input function behavior. The root causes of the top fault event, i.e. the basic events
Expand All @@ -37,26 +39,27 @@ The procedure converts the input behaviour into a fault event **fault-event**. T
constructed based on input the behaviour's type and its behavioral relations. A fault tree event corresponding to a
function behaviour is constructed with an OR gate, i.e. the event occurs when any of its causes occurs. Function's fault
event occurs if one of the following causes occur:

- cause corresponding to function parts
- for OR functions - all its function parts fail
- for AND functions - one of its function parts fails
- for OR functions - all its function parts fail
- for AND functions - one of its function parts fails
- causes corresponding to required functions - the function's fault event occurs if any of its required function's fault
event occurs.
- causes corresponding to impairing failure modes - the function's fault event occurs if any of the function's impairing
failure modes occurs.

A fault tree event corresponding to a failure mode behaviour is constructed with an AND gate, i.e. the event occurs when
A fault tree event corresponding to a failure mode behaviour is constructed with an AND gate, i.e. the event occurs when
all of its causes occurs and none of its impairing behaviors occur. Failure mode's fault event occurs if all the
following causes occur:

- cause corresponding to failure mode parts
- for OR functions - one of its failure mode parts occurs
- for AND functions - all of its failure mode parts occur
- for OR functions - one of its failure mode parts occurs
- for AND functions - all of its failure mode parts occur
- causes corresponding to required failure modes - the failure mode's fault event occurs if all of its required failure
modes occur
- causes corresponding to impairing functions - the failure mode's fault event occurs if all the failure mode's impairing
functions fail.


```
GENERATE_FAULT_TREE(behaviour: Behaviour)
BEGIN
Expand All @@ -65,51 +68,52 @@ BEGIN
fault-evnt.gate = OR
ELSE IF behaviour is FailureMode
fault-evnt.gate = AND
IF behaviour.child_behaviours is not empty
IF behaviour.child_behaviours is not empty
fault-event-due-to-parts = Create FaultEvent with GATE(behaviour.gateType)
fault-event.add(fault-event-due-to-parts)
FOR EACH behaviourPart IN behaviour.behaviourParts
FOR EACH behaviourPart IN behaviour.behaviourParts
fault-event-due-to-parts.add(GENERATE_FAULT_TREE(behaviourPart))
FOR EACH b IN behaviour.required_behaviours;
fault-event.add(GENERATE_FAULT_TREE(b))
FOR EACH b IN behaviour.impairing_behaviors;
fault-event.add(GENERATE_FAULT_TREE(b))
RETUNR fault-event
END
```

```
GATE(behaviour: Behaviour):
BEGIN
IF (behaviour is Function)
IF (behaviour is Function)
RETURN negate(behaviour.behaviourType)
IF (behaviour is FailureMode)
IF (behaviour is FailureMode)
RETURN behaviour.behaviourType
END
```

## Example 1 - Or Behaviour

Demonstrates transformation of OR behavior.
![convert-require-imapair-behavior-model-to-fault-tree](https://user-images.githubusercontent.com/18463762/134146813-8a257931-26bb-4350-b954-c29ac7601c9c.png)

## Example 2 - And Behaviour

Demonstrates transformation of AND behavior.
![convert-require-imapair-behavior-model-to-fault-tree-example-2](https://user-images.githubusercontent.com/18463762/137472141-065769d1-8f6c-4267-ac5e-4fc85c16a0c4.png)

## Example 3 - Live Demo
This example is a study by [1]. The analyzed system (as shown in the following picture taken from [1]) is aircraft fuel system, including its subsystems (fuel transportation, fuel supplying and monitoring subsystem). The link (https://kbss.felk.cvut.cz/fta-fmea-demo/system/instance589946784) shows the part of system that is created by the tool.

This example is a study by [1]. The analyzed system (as shown in the following picture taken from [1]) is aircraft fuel system, including its subsystems (fuel transportation, fuel supplying and monitoring subsystem). The link (https://kbss.felk.cvut.cz/fta-fmea-demo/system/instance589946784) shows the part of system that is created by the tool.

![image](https://user-images.githubusercontent.com/30232007/159237410-f43eeff7-477e-4f9f-9c56-6534669d725f.png)

The link (https://kbss.felk.cvut.cz/fta-fmea-demo/fta/instance-1287330450) shows a fault tree that is created by this tool.


## References

[1] Wei, Q., Jiao, J., Fan, J. & Zhao, T. (2016). An optimized method for generating fault tree from a counter-example. In 2016
Annual Reliability and Maintainability Symposium (RAMS). IEEE.

7 changes: 3 additions & 4 deletions doc/user-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,22 @@ After the FTA is automatically generated, the user sees the complete tree that c

![auto_FTA](https://user-images.githubusercontent.com/94048408/176183358-bc7d5f01-6249-4a00-9cbf-fe244faf0313.png)


### 2.5.2 Manual FTA trees

Manual FTA trees can be composed directly by the user, by specifying events. In this case, the user starts from main dashboard, the "+" button in bottom right corner, and selecting "Fault tree". This will open a dialogue, where the user can specify the tree and top fault of the new FTA analysis. The user has the option to select from existing events (if already defined in the FTA/FMEA tool within some previous manual analysis), or define a new event, that will become the top event in the new FTA. Note, that "Type" for top events has to be selected "INTERMEDIATE", and it is not possible to start the FTA from a "BASIC" event type as the manual FTA can be created only downwards from the first (top) event. Lastly, the dialogue asks for a gateway, that will be used to connect next (intermediate or basic) events to the top event. The user can select from a predefined list of managed gateways in the tool. After clicking the "CREATE FAULT TREE" button, a canvas opens with a top event.

![manual_FTA](https://user-images.githubusercontent.com/94048408/176170280-a4f4b829-4375-4ca1-9ee6-86f5444868db.png)

In the canvas, after clicking the top event, the user is shown a dialogue bar, that allows editing the event. The dialogue shows the same datafields as when new manual FTA is created.
In the canvas, after clicking the top event, the user is shown a dialogue bar, that allows editing the event. The dialogue shows the same datafields as when new manual FTA is created.

![manual_FTA_2](https://user-images.githubusercontent.com/94048408/176171413-92173133-cc5d-46e4-b8b1-d7b31523d4ff.png)

To add intermediate events, the user must right-click the top event, that will pop-up an option to add "new event". After clicking this "new event", a dialogue is displayed, that allows definition of an intermediate event with the same logic, as the top event was created. It means selecting from the existing events or defining a new event by its type, name, description and probability. The user can again select "Gate Type", if the intermediate event type was selected (i.e. the tree will continue downwards). In case the event will be a leaf of the FTA tree, then the user sets the event type to "BASIC" in the "Type" data field and the option to select "Gate Type" disappears. Note, that other gate types are supported in line with the standard FTA (i.e. external, undeveloped or conditioning). Note also, that probability can be defined only for basic, undeveloped or external event types. All other event types will have their probability automatically computed.
To add intermediate events, the user must right-click the top event, that will pop-up an option to add "new event". After clicking this "new event", a dialogue is displayed, that allows definition of an intermediate event with the same logic, as the top event was created. It means selecting from the existing events or defining a new event by its type, name, description and probability. The user can again select "Gate Type", if the intermediate event type was selected (i.e. the tree will continue downwards). In case the event will be a leaf of the FTA tree, then the user sets the event type to "BASIC" in the "Type" data field and the option to select "Gate Type" disappears. Note, that other gate types are supported in line with the standard FTA (i.e. external, undeveloped or conditioning). Note also, that probability can be defined only for basic, undeveloped or external event types. All other event types will have their probability automatically computed.

![manual_FTA_new_event](https://user-images.githubusercontent.com/94048408/176174063-786167db-7f14-45e8-b91b-69f9edafcf08.png)
![manual_FTA_new_event_dialogie](https://user-images.githubusercontent.com/94048408/176173946-06b0eecf-e469-4d80-a263-0d7bb2fa01ce.png)

After clicking the button "CREATE EVENT", the new event will be added to the diagram and connected with the existing tree events. This way, the entire FTA tree can be created.
After clicking the button "CREATE EVENT", the new event will be added to the diagram and connected with the existing tree events. This way, the entire FTA tree can be created.

## 2.6 Creating new FMEA analysis

Expand Down
12 changes: 6 additions & 6 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interface Window {
__config__: {
FTA_FMEA_API_URL: string;
FTA_FMEA_ADMIN_REGISTRATION_ONLY: string;
FTA_FMEA_TITLE: string;
}
}
__config__: {
FTA_FMEA_API_URL: string;
FTA_FMEA_ADMIN_REGISTRATION_ONLY: string;
FTA_FMEA_TITLE: string;
};
}
14 changes: 7 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="manifest" href="/webmanifest.json">
<link rel="manifest" href="/webmanifest.json" />
<!-- Runtime environment variables -->
<!-- With Vite, type must be text/javascript, see:
https://stackoverflow.com/questions/70617812/change-environmet-variables-at-runtime-react-vite-with-docker-and-nginx-->
<script type="text/javascript" src="/config.js"></script>
<title>FTA/FMEA Analysis</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
3 changes: 1 addition & 2 deletions public/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// Dynamic configuration
window.__config__ = {
}
window.__config__ = {};
6 changes: 3 additions & 3 deletions public/locales/cs/translation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": {
"appBarHeader": "Řídicí panel"
}
"main": {
"appBarHeader": "Řídicí panel"
}
}
6 changes: 3 additions & 3 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": {
"appBarHeader": "Dashboard"
}
"main": {
"appBarHeader": "Dashboard"
}
}
12 changes: 11 additions & 1 deletion public/webmanifest.json
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
{
"name": "",
"short_name": "",
"icons": [
{ "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Loading

0 comments on commit 41fc064

Please sign in to comment.