---
# System prepended metadata

title: New Cloud System Specfication
tags: [modern system]

---

###### tags: `modern system`

# New Cloud System Specfication

## Change Log
| Version No. | Date | Description | Author |
| :---------: | :--: | ----------- | :----: |
| 1.0.0 | 2020-01-10 | [Change of details](#1.1.0) | Greg |
| 1.0.0 | N/A | The first release | Ruby |

:::warning
## QA
### Tripo Ver. 1.0.0.e
10. 操作車輛啟動，parking>engineStart>duringTrip。接著檢查tripHistories，相同的imei可以檢索到兩條數據。eventType分別是duringTrip與parking  {deviceId:”351918068642899"}
11. 操作車輛停駛，duringTrip>engineOff>sleepStart。接著檢查tripHistories，{tripId:"1580455952642899"}可以檢索到”17”筆數據
> L1 若速度最大值，是否判斷為無效Engine Start
### Sensol Ver. 2.0.0
issue：
941-High Tire Pressure942-Low Tire Pressure這兩個事件觸發後，檢查sensol沒有向alerto上報的log。
用來觸發胎壓過高，界限值=lowerPressure="-29",upperPressure="-10“
用來觸發胎壓過低，界限值=lowerPressure="20",upperPressure="50“

Change Request
1.sensol給alerto的payload, 添加field：經緯度
```jsonld
{  
"imei": "351918068643087", 
"latitude": "121.3662942",
"longitude": "25.0171608",
"reportTime": "1567756506",
"alertList": [{ 
"alertId": "940", 
    "data": {  
    "sensorId": "00791",       
    "current": "60",      
    "upper": "50"  
    }
}]
}
```
2.如果车辆没有绑定胎压监测器（attached.tpmsIDs为空），而Sensol接收到了胎压数据，数据都是0，超过5min后，不需要上报alerto-945事件
3. vehicle.ATTACHED -> vehicle.attached


:::

## 1.0.0 (2020-02-03)

### WatchOVO OAO?!
> 處理完後透過SQS傳給Alerto

### Zono
- provide formula convert UTM coordinates (x, y) to latitude, longitude

### Converto
- [x] 新增zeroRPMPeriod in "fuel_stats" event from L3 report
    
### Tripo
- [ ] 手動打點功能(介面可能透過SQS or HTTP)
    - 用途是為了讓Alerto新增event point
- Bug
    - [ ] 當收到during_trip後會打包vehicle_statuses

### Vehicol
- [ ] 新增字段
    - [ ] zeroRpmPeriod, minSpeed至vehicle_statuses.dashboard.vehicle.journeyData 
    - [ ] avgGpsSpeed, avgVssSpeed至 vehicle_statuses.dashboard.vehicle.obd2Reading (即時速度資訊)
- [ ] 修正
    - [ ] 字段名稱打錯
    dashboard.vehicle.obd2Reading.anbientTemperature ->             dashboard.vehicle.obd2Reading.ambientTemperature

### Drivo
- [x] 更正vehicle_statuses中dashboard.driver欄位
    - [x] 新增brakePeriod字段
    - [x] 新增accPeriod字段
    - 該字段由converto傳給Drivero的driver_pedal_pattern event獲得
       ```json
        {
        "eventType": "driver_pedal_pattern",
        "dateTime": int,
        "IMEI": string,
        // gps info
        "longitude" : double,
        "latitude" : double,
        "accuracy" : number,

        // pedal pattern
        "observePeriod": int,
        "idlePeriod" : int,
        "accPeriod" : int,
        "brakePeriod" : int,
        "coastPeriod" : int;
        }
        ```
    -  idlePeriod, accPeriod, brakePeriod, 及coastPeriod 此四欄位合稱為pedal pattern。且pedal pattern及observePeriod之值為不斷累加直到trip結束，才需被清成初始值0。
    - Ideally, idlePeriod + accPeriod + brakePeriod + coastPeriod = observationPeriod
### Devicio
- [x] 更改打包机制，添加0点打包，此时除了operatingMin字段不用打包外，其他字段均进行打包，打包后更新vehicleStatus对应数据
    -  sleepMin：每次0点打包时，去summary里面取一次数据，若小于1天，就用这个值进行打包，若大于1天，那么值就为24小时。当tripo 发送 sleep_end事件时，会传递sleep的时间，这个时间需要再进行判断，若大于当前时间，那么此时使用当前时间进行打包，若小于当前时间，就以传递过来的时间进行打包。

### Sensol
- [x] vehicle.ATTACHED -> vehicle.attached


## 1.0.0 (2020-01-20)
> 規格異動內容參考 [會議記錄](https://hackmd.io/@Ye0fx7gRQ76VNKwJJyVYdA/BJsvxqfWI)


### Zono
- [ ] 新增Data至DB
    > 自己Parsing
- [ ] OpenData在DB中格式
    > 自行定義
     

### Vehicol
- [x] 機制更新
    - [x] 取during trip值時，需由reportType，區分L1/L2 Report 
    - [x] 收到非法字元(e.g., 0或null)則忽略不採用
        (e.g., L1中avgRPM為0或null，則不更新DB中avgRPM的值)
- [x] 待修正
    - [x] 打包動作
        - [x] 同步更新vehicle.dailyRecords, vehicle.weeklyRecords, vehicle.monthlyRecords
        - [x] 清空fuelStats的值 
### Tripo
- [x] 效能問題
    - [x] 當5至10台OBD2時，ecs container (0.25 vCPU, 0.5GB Mem) CPU loading已達97%
    :::info
    1.0.0.E 優化aggregation操作, 已經有改善, 須在模擬觀察
    :::

### Sensol
- [x] 新增sensol -> alerto queue
- [x] 事件字段調整
    - [x] sensol -> alerto的event中，移除tripId
    - [x] 移除暫存機制
- [x] 資料庫表格名稱調整
    - [x] vehicle_info調整成vehicles

## 1.0.0 (2020-01-15)
### Tripo
 - [ ] 新增SQS轉發事件
    - [ ] trip_end event to zono
    - [ ] trip_start event to zono
 
### Zono
 - [ ]private interest zone 指到vehicle zoneID OAO?!
![](https://i.imgur.com/Vu6MIb0.png)
>> 不走到ZONO走到FRONTO吧

 一個array 存放 zoneId = "zoneId[]"
    (應該是先做這兩個功能)先分析 哪裡是home 哪裡是office，如果是貨車可能就判斷不出來了

 
## 1.0.0 (2020-01-10)
> 規格異動內容參考 [會議記錄](https://hackmd.io/t9mQHqNESLq7_jdB56PtIQ)
### Converto
- [x] 新增SQS轉發事件
    - [x] sleep_start event
- [x] 事件字段調整
    - [x] during_trip新增字段`reportType`
    - [x] during_trip新增接收端`Drivo`

### Tripo
- [x] vehicle_statuses.summary新增字段
    - [x] gpsDistance
    - [x] gpsSpeedDistance
    - [x] speedDistance
    - [x] 刪除字段curObdTime
    - [x] 新增字段reportTime 
        - [x] level1LastReportTime
        - [x] curObdTime (將原本的curObdTime移至此字段內)
    - [ ] 新增sleepMin (OBD還未實作, 可先忽略)
- [x] 新增SQS轉發事件
    - [x] trip_end event 
    - [x] sleep_end event
- [x] 調整tripPoint.tripInfo數據定義 (都是從起點累積至該點的狀態) 
- [x] trip_points 刪除字段
    - [x] vehicleInfo.motionState

### Sensol
- [x] 增加 tpms_data event (解析ble_data from Converto, 如有TPMS資料則產生該事件並送給Vehicol, Drivo)

### Vehicol
- [x] 打包時機調整
    - [x] subscribe trip_end from Tripo via SQS
    - [x] record拆成三個collection, daily, weekly and monthly
    - [x] 依序打包daily -> weekly -> monthly
- [x] vehicle_statuses.dashborad.vehicle.journeyData刪除字段
    - [x] duration
    - [x] heading
    - [x] gpsDistance
    - [x] gpsSpeedDistance
    - [x] speedDistance
    - [x] fuelRate
    - [x] fuelLevel 
    - [x] fuelUsed
    - [x] fuelTankCapacity
- [x] vehicle_statuses.dashborad.vehicle.obd2Reading刪除字段
    - [x] fuelTankCapacity
- [x] vehicle_statuses.dashborad.vehicle.calculated刪除字段
    - [x] fuelLevel
    - [x] fuelTankCapacity
- [x] vehicle_statuses.dashborad.vehicle新增字段
    - [x] fuelStates (收到fuel_stats就直接填入此array) 

### Drivo
- [x] 打包時機調整
    - [x] subscribe trip_end from Tripo via SQS
    - [x] record拆成三個collection, daily, weekly and monthly
    - [x] 依序打包daily -> weekly -> monthly
- [x] 15分鐘平均速度計算調整
    - [x] 採用即時計算而不是旅程結束後透過tripPoint計算
    - [x] vehicle_statuses.dashboard.driver新增字段
        - [x] fifteenMinsRecord


### Devicio
- [x] 打包時機調整
    - [x] subscribe trip_end from Tripo via SQS
    - [x] subscribe sleep_end from Tripo via SQS
    - [x] record拆成三個collection, daily, weekly and monthly
    - [x] 依序打包daily -> weekly -> monthly
- [x] vehicle_statuses.dashborad.device新增字段
    - [x] cellularLossMin
    - [x] gpsLossMin (新增在gps字段裡面)