diff --git a/.github/workflows/check_markdown_links.yaml b/.github/workflows/check_markdown_links.yaml index f33a5c95..82dc9840 100644 --- a/.github/workflows/check_markdown_links.yaml +++ b/.github/workflows/check_markdown_links.yaml @@ -22,7 +22,5 @@ jobs: - uses: actions/checkout@main - uses: byrnereese/github-action-mkdocs-link-check@1.0 with: - folder-path: 'docs/**' - file-path: './README.md' - local-only: true - + folder-path: 'docs/' + local-only: true \ No newline at end of file diff --git a/boaviztapi/data/archetypes/server.csv b/boaviztapi/data/archetypes/server.csv index 5ffdea5c..9253c797 100644 --- a/boaviztapi/data/archetypes/server.csv +++ b/boaviztapi/data/archetypes/server.csv @@ -206,4 +206,4 @@ c8g.metal-24xl,AWS,rack,1,,,Annapurna Labs Graviton4,,12,16,0,0,0,0,0,,0,2;2;2,2 m8g.metal-24xl,AWS,rack,1,,,Annapurna Labs Graviton4,,12,32,0,0,0,0,0,,0,2;2;2,2.99;1;5,50;0;100,1,52560,0.33;0.2;0.6, r8g.metal-24xl,AWS,rack,1,,,Annapurna Labs Graviton4,,12,64,0,0,0,0,0,,0,2;2;2,2.99;1;5,50;0;100,1,52560,0.33;0.2;0.6, x8g.metal-24xl,AWS,rack,1,,,Annapurna Labs Graviton4,,12,128,0,0,0,0,0,,0,2;2;2,2.99;1;5,50;0;100,1,52560,0.33;0.2;0.6, -i8g.metal-24xl,AWS,rack,1,,,Annapurna Labs Graviton4,,12,64,6,3750,0,0,0,,0,2;2;2,2.99;1;5,50;0;100,1,52560,0.33;0.2;0.6, +i8g.metal-24xl,AWS,rack,1,,,Annapurna Labs Graviton4,,12,64,6,3750,0,0,0,,0,2;2;2,2.99;1;5,50;0;100,1,52560,0.33;0.2;0.6, \ No newline at end of file diff --git a/boaviztapi/data/archetypes/user_terminal.csv b/boaviztapi/data/archetypes/user_terminal.csv index 81bdd35c..97889ced 100644 --- a/boaviztapi/data/archetypes/user_terminal.csv +++ b/boaviztapi/data/archetypes/user_terminal.csv @@ -12,4 +12,7 @@ smartwatch-default,peripheral,smartwatch,default,1,,0 box-default,terminal,box,default,1,43800,10;5;20 usb-stick-default,peripheral,usb_stick,default,0.05,43800,0.3;0.12;0.63 external-ssd-default,peripheral,external_ssd,default,0.05,43800,2.5;0.5;5 -hdd-default,peripheral,external_hdd,default,0.05,43800,7.75;6.5;9 \ No newline at end of file +hdd-default,peripheral,external_hdd,default,0.05,43800,7.75;6.5;9 +vr-headset-oled,terminal,vr_headset,oled,0.01,43800,710;710;710 +vr-headset-lcd,terminal,vr_headset,lcd,0.01,43800,692;692;692 +vr-controller-default,peripheral,vr_controller,default,0.01,43800,7.90;7.90;7.90 \ No newline at end of file diff --git a/boaviztapi/data/config.yml b/boaviztapi/data/config.yml index f66c34e5..d0eacebb 100644 --- a/boaviztapi/data/config.yml +++ b/boaviztapi/data/config.yml @@ -26,6 +26,8 @@ default_usb_stick: "usb-stick-default" default_external_ssd: "external-ssd-default" default_external_hdd: "hdd-default" default_iot_device: "iot-device-default" +default_vr_headset: "vr-headset-lcd" +default_vr_controller: "vr-controller-default" default_criteria: ["gwp", "adp", "pe"] diff --git a/boaviztapi/data/factors.yml b/boaviztapi/data/factors.yml index 66e7aba5..b6ef0631 100644 --- a/boaviztapi/data/factors.yml +++ b/boaviztapi/data/factors.yml @@ -2916,6 +2916,294 @@ } } + +"VR_CONTROLLER": { + "adpe": { + "impact": 1.07e-03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "adpf": { + "impact": 5.45e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ap": { + "impact": 4.28e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ctue": { + "impact": 5.11e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ctuh-c": { + "impact": 5.95e-08, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ctuh-nc": { + "impact": 1.85e-07, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "epf": { + "impact": 9.87e-05, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "epm": { + "impact": 4.28e-03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ept": { + "impact": 4.49e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "gwp": { + "impact": 4.22e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "gwpb": { + "impact": 1.97e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "gwpf": { + "impact": 4.20e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "gwplu": { + "impact": 4.14e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ir": { + "impact": 2.50e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "lu": { + "impact": 5.73e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "odp": { + "impact": 7.66e-07, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "pm": { + "impact": 2.22e-07, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "pocp": { + "impact": 1.46e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "wu": { + "impact": 3.99e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "mips": { + "impact": 5.47e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } +} + +"VR_HEADSET": { + "adpe": { + "lcd": { + "impact": 3.33e-03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 4.54e-03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "adpf": { + "lcd": { + "impact": 6.11e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.35e+03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ap": { + "lcd": { + "impact": 2.64e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 5.96e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ctue": { + "lcd": { + "impact": 6.82e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.68e+03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ctuh-c": { + "lcd": { + "impact": 1.31e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 5.00e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ctuh-nc": { + "lcd": { + "impact": 6.84e-07, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.02e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "epf": { + "lcd": { + "impact": 7.00e-04, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.11e-04, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "epm": { + "lcd": { + "impact": 3.74e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.22e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ept": { + "lcd": { + "impact": 3.69e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 7.69e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "gwp": { + "lcd": { + "impact": 4.59e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 8.94e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "gwpb": { + "lcd": { + "impact": 8.83e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 4.33e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "gwpf": { + "lcd": { + "impact": 4.30e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 8.89e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "gwplu": { + "lcd": { + "impact": 9.55e-05, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 4.73e-08, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ir": { + "lcd": { + "impact": 1.54e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 2.12e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "lu": { + "lcd": { + "impact": 1.71e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.18e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "odp": { + "lcd": { + "impact": 1.52e-05, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 8.39e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "pm": { + "lcd": { + "impact": 1.50e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 3.30e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "pocp": { + "lcd": { + "impact": 1.15e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 2.41e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "wu": { + "lcd": { + "impact": 1.27e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 4.29e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "mips": { + "lcd": { + "impact": 1.54e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 3.03e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + } +} + + "electricity": { "WOR": { "country": "World", @@ -19088,4 +19376,5 @@ "Albania": "ALB", "United Arab Emirates": "ARE" } -} \ No newline at end of file +} + diff --git a/boaviztapi/dto/device/user_terminal.py b/boaviztapi/dto/device/user_terminal.py index ee14d04d..a1e96553 100644 --- a/boaviztapi/dto/device/user_terminal.py +++ b/boaviztapi/dto/device/user_terminal.py @@ -5,7 +5,7 @@ from boaviztapi.dto.usage.usage import mapper_usage from boaviztapi.model.device import Device from boaviztapi.model.device.userTerminal import DeviceLaptop, DeviceDesktop, DeviceTablet, DeviceSmartphone, \ - DeviceTelevision, DeviceBox, DeviceUsbStick, DeviceSmartWatch, DeviceExternalHDD, DeviceMonitor, DeviceExternalSSD + DeviceTelevision, DeviceBox, DeviceUsbStick, DeviceSmartWatch, DeviceExternalHDD, DeviceMonitor, DeviceExternalSSD, DeviceVrController, DeviceVrHeadset from boaviztapi.service.archetype import get_arch_component @@ -56,6 +56,11 @@ class Monitor(UserTerminal): class ExternalSSD(UserTerminal): pass +class VrHeadset(UserTerminal): + type: Optional[str] = None + +class VrController(UserTerminal): + pass def mapper_user_terminal(user_terminal_dto: UserTerminal, archetype) -> Device: if type(user_terminal_dto) == Laptop: @@ -83,6 +88,11 @@ def mapper_user_terminal(user_terminal_dto: UserTerminal, archetype) -> Device: model = DeviceExternalSSD(archetype=archetype) elif type(user_terminal_dto) == Monitor: model = DeviceMonitor(archetype=archetype) + elif type(user_terminal_dto) == VrController: + model = DeviceVrController(archetype=archetype) + elif type(user_terminal_dto) == VrHeadset: + model = DeviceVrHeadset(archetype=archetype) + model.type.set_input(user_terminal_dto.type) else: raise Exception("User Terminal Type not found") diff --git a/boaviztapi/model/device/userTerminal.py b/boaviztapi/model/device/userTerminal.py index 9625d3f9..d55f4694 100644 --- a/boaviztapi/model/device/userTerminal.py +++ b/boaviztapi/model/device/userTerminal.py @@ -115,3 +115,20 @@ class DeviceMonitor(EndUserDevice, ABC): def __init__(self, archetype=get_user_terminal_archetype(config["default_monitor"]), **kwargs): super().__init__(archetype=archetype, **kwargs) + +class DeviceVrHeadset(EndUserDevice, ABC): + NAME = "VR_HEADSET" + + def __init__(self, archetype=get_user_terminal_archetype(config["default_vr_headset"]), **kwargs): + super().__init__(archetype=archetype, **kwargs) + self.type = Boattribute( + default=get_arch_value(archetype, 'type', 'default'), + min=get_arch_value(archetype, 'type', 'min'), + max=get_arch_value(archetype, 'type', 'max') + ) + +class DeviceVrController(EndUserDevice, ABC): + NAME = "VR_CONTROLLER" + + def __init__(self, archetype=get_user_terminal_archetype(config["default_vr_controller"]), **kwargs): + super().__init__(archetype=archetype, **kwargs) diff --git a/boaviztapi/routers/peripheral_router.py b/boaviztapi/routers/peripheral_router.py index c2acd56c..c1a48972 100644 --- a/boaviztapi/routers/peripheral_router.py +++ b/boaviztapi/routers/peripheral_router.py @@ -2,7 +2,7 @@ from fastapi import APIRouter, Query, Body from boaviztapi import config -from boaviztapi.dto.device.user_terminal import Monitor, UsbStick, ExternalSSD, ExternalHDD +from boaviztapi.dto.device.user_terminal import Monitor, UsbStick, ExternalSSD, ExternalHDD, VrController from boaviztapi.routers.openapi_doc.descriptions import all_archetype_user_terminals, all_peripheral_categories, \ get_archetype_config_desc, peripheral_description from boaviztapi.routers.openapi_doc.examples import end_user_terminal @@ -21,7 +21,8 @@ async def peripheral_get_all_categories(): "monitor": "v1/peripheral/monitor", "usb_stick": "v1/peripheral/usb_stick", "external_ssd": "v1/peripheral/external_ssd", - "external_hdd": "v1/peripheral/external_hdd" + "external_hdd": "v1/peripheral/external_hdd", + "vr_controller": "v1/peripheral/vr_controller" } @@ -171,3 +172,39 @@ async def external_hdd_impact(archetype: str = config["default_external_hdd"], duration=duration, criteria=criteria, archetype=archetype) + +@peripheral_router.get('/vr_controller/archetypes', + description=all_archetype_user_terminals) +async def vr_controller_get_all_archetype_name(): + return get_all_archetype_name('vr_controller') + + +@peripheral_router.get('/vr_controller/archetype_config', + description=get_archetype_config_desc) +async def vr_controller_get_archetype_config(archetype: str = Query(example=config["default_vr_controller"])): + return get_archetype_config(archetype) + + +@peripheral_router.post('/vr_controller', description=peripheral_description) +async def vr_controller_impact_from_configuration(vr_controller: VrController = Body(None, example=end_user_terminal), + verbose: bool = True, + duration: Optional[float] = config["default_duration"], + archetype: str = config["default_vr_controller"], + criteria: List[str] = Query(config["default_criteria"])): + return await user_terminal_impact(user_terminal_dto=vr_controller, + verbose=verbose, + duration=duration, + criteria=criteria, + archetype=archetype) + + +@peripheral_router.get('/vr_controller', description=peripheral_description) +async def vr_controller_impact(archetype: str = config["default_vr_controller"], + verbose: bool = True, + duration: Optional[float] = config["default_duration"], + criteria: List[str] = Query(config["default_criteria"])): + return await user_terminal_impact(user_terminal_dto=VrController(), + verbose=verbose, + duration=duration, + criteria=criteria, + archetype=archetype) \ No newline at end of file diff --git a/boaviztapi/routers/terminal_router.py b/boaviztapi/routers/terminal_router.py index 1d4ae9f0..478e7032 100644 --- a/boaviztapi/routers/terminal_router.py +++ b/boaviztapi/routers/terminal_router.py @@ -4,7 +4,7 @@ from fastapi import APIRouter, Query, Body, HTTPException from boaviztapi import config, data_dir -from boaviztapi.dto.device.user_terminal import UserTerminal, mapper_user_terminal, Laptop, Desktop, Smartphone, \ +from boaviztapi.dto.device.user_terminal import UserTerminal, VrHeadset, mapper_user_terminal, Laptop, Desktop, Smartphone, \ Television, Tablet, Box from boaviztapi.routers.openapi_doc.descriptions import all_archetype_user_terminals, all_terminal_categories, \ get_archetype_config_desc, terminal_description @@ -28,7 +28,8 @@ async def terminal_get_all_categories(): "smartphone": "v1/terminal/smartphone", "television": "v1/terminal/television", "tablet": "v1/terminal/tablet", - "box": "v1/terminal/box" + "box": "v1/terminal/box", + "vr_headset": "v1/terminal/vr_headset" } @@ -253,6 +254,42 @@ async def box_impact(archetype: str = config["default_box"], criteria=criteria, archetype=archetype) +@terminal_router.get('/vr_headset/archetypes', + description=all_archetype_user_terminals) +async def vr_headset_get_all_archetype_name(): + return get_all_archetype_name('vr_headset') + + +@terminal_router.get('/vr_headset/archetype_config', + description=get_archetype_config_desc) +async def vr_headset_get_archetype_config(archetype: str = Query(example=config["default_vr_headset"])): + return get_archetype_config(archetype) + + +@terminal_router.post('/vr_headset', description=terminal_description) +async def vr_headset_impact_from_configuration(vr_headset: VrHeadset = Body(None, example=end_user_terminal), + verbose: bool = True, + duration: Optional[float] = config["default_duration"], + archetype: str = config["default_vr_headset"], + criteria: List[str] = Query(config["default_criteria"])): + return await user_terminal_impact(user_terminal_dto=vr_headset, + verbose=verbose, + duration=duration, + criteria=criteria, + archetype=archetype) + + +@terminal_router.get('/vr_headset', description=terminal_description) +async def vr_headset_impact(archetype: str = config["default_vr_headset"], + verbose: bool = True, + duration: Optional[float] = config["default_duration"], + criteria: List[str] = Query(config["default_criteria"])): + return await user_terminal_impact(user_terminal_dto=VrHeadset(), + verbose=verbose, + duration=duration, + criteria=criteria, + archetype=archetype) + async def user_terminal_impact(user_terminal_dto: UserTerminal, archetype: str, diff --git a/boaviztapi/service/impacts_computation.py b/boaviztapi/service/impacts_computation.py index 02f515ba..98569a38 100644 --- a/boaviztapi/service/impacts_computation.py +++ b/boaviztapi/service/impacts_computation.py @@ -75,18 +75,21 @@ def simple_impact_use(impact_type: str, duration: int, model: Union[Component, D def simple_embedded(impact_type: str, duration: int, model: [Device, Component, Service]) -> ComputedImpacts: if hasattr(model, 'type') and model.type is not None: - impact = float(get_impact_factor(item=model.NAME, impact_type=impact_type)[model.type.value]["impact"]) * model.units.value - min_impact = float(get_impact_factor(item=model.NAME, impact_type=impact_type)[model.type.value]["impact"]) * model.units.min - max_impact = float(get_impact_factor(item=model.NAME, impact_type=impact_type)[model.type.value]["impact"]) * model.units.max - + impact = Impact( + value=float(get_impact_factor(item=model.NAME, impact_type=impact_type)[model.type.value]["impact"]) * model.units.value, + min=float(get_impact_factor(item=model.NAME, impact_type=impact_type)[model.type.value]["impact"]) * model.units.min, + max=float(get_impact_factor(item=model.NAME, impact_type=impact_type)[model.type.value]["impact"]) * model.units.max) else: - impact = float(get_impact_factor(item=model.NAME, impact_type=impact_type)["impact"]) * model.units.value - min_impact = float(get_impact_factor(item=model.NAME, impact_type=impact_type)["impact"]) * model.units.min - max_impact = float(get_impact_factor(item=model.NAME, impact_type=impact_type)["impact"]) * model.units.max + impact = Impact( + value=float(get_impact_factor(item=model.NAME, impact_type=impact_type)["impact"]) * model.units.value, + min=float(get_impact_factor(item=model.NAME, impact_type=impact_type)["impact"]) * model.units.min, + max=float(get_impact_factor(item=model.NAME, impact_type=impact_type)["impact"]) * model.units.max) + + impact.allocate(duration, model.usage.hours_life_time) warnings = ["Generic data used for impact calculation."] - return impact, min_impact, max_impact, warnings + return impact.value, impact.min, impact.max, warnings def cpu_impact_use(impact_type: str, duration: int, cpu: ComponentCPU) -> ComputedImpacts: @@ -645,4 +648,12 @@ def cloud_impact_use(impact_type: str, duration: int, cloud_instance: ServiceClo "use": simple_impact_use, "embedded": iot_functional_blocks_impact_embedded }, + "VR_CONTROLLER": { + "use": simple_impact_use, + "embedded": simple_embedded + }, + "VR_HEADSET": { + "use": simple_impact_use, + "embedded": simple_embedded + }, } diff --git a/docs/docs/Explanations/devices/terminals_&_peripherals.md b/docs/docs/Explanations/devices/terminals_&_peripherals.md index 20b35bdf..2baae99e 100644 --- a/docs/docs/Explanations/devices/terminals_&_peripherals.md +++ b/docs/docs/Explanations/devices/terminals_&_peripherals.md @@ -11,6 +11,8 @@ Terminals & peripherals may have several types (typically ```pro``` and ```perso ## Embedded impacts +Most embedded impacts are taken from the [Base IMPACTS® ADEME](https://base-impacts.ademe.fr/documents/Negaoctet.zip) database. When the data comes from another source, it is specified. + | Criteria | Implemented | Source | |----------|-------------|-------------------------------------------------------------------------------| | gwp | yes | [Base IMPACTS® ADEME](https://base-impacts.ademe.fr/documents/Negaoctet.zip) | @@ -428,3 +430,89 @@ In progress... | Name | Unit | Default values (default;min;max) | Description | Example | |------------|------------------------------|-----------------------------------|-----------------------------------------------|---------| | avg_power | Watt/hour | 0.0;0.0;0.0 | Average electrical consumption per hour | 1 | + + +## VR headset + +VR headset has two ```types```: ```lcd``` and ```oled```. + +### Embedded impacts + +| Criteria | Unit | lcd | oled | +|----------|--------------------|--------------|-----------| +| gwp | kgCO2eq | 4.59e+01 | 8.94e+01 | +| gwpb | kg CO2 eq. | 8.83e-02 | 4.33e-01 | +| gwpf | kg CO2 eq. | 4.30e+02 | 8.89e+01 | +| gwplu | kg CO2 eq. | 9.55e-05 | 4.73e-08 | +| ir | kg U235 eq. | 1.54e+01 | 2.12e+02 | +| lu | No dimension | 1.71e+00 | 1.18e+00 | +| odp | kg CFC-11 eq. | 1.52e-05 | 8.39e-06 | +| pm | Disease occurrence | 1.50e-06 | 3.30e-06 | +| pocp | kg NMVOC eq. | 1.15e-01 | 2.41e-01 | +| wu | m3 eq. | 1.27e+02 | 4.29e+02 | +| mips | kg | 1.54e+02 | 3.03e+02 | +| adpe | kg SB eq. | 3.33e-03 | 4.54e-03 | +| adpf | MJ | 6.11e+02 | 1.35e+03 | +| ap | mol H+ eq. | 2.64e-01 | 5.96e-01 | +| ctue | CTUe | 6.82e+02 | 1.68e+03 | +| ctuh-c | CTUh | 1.31e-06 | 5.00e-06 | +| ctuh-nc | CTUh | 6.84e-07 | 1.02e-06 | +| epf | kg P eq. | 7.00e-04 | 1.11e-04 | +| epm | kg N eq. | 3.74e-02 | 1.22e-01 | +| ept | mol N eq. | 3.69e-01 | 7.69e-01 | + +### Usage + +#### lcd + +| Name | Unit | Default values (default;min;max) | Description | Example | +|------------------|--------------|----------------------------------|------------------------------------------------------------------|----------| +| avg_power | Watt/hour | 692;692;692 | Average electrical consumption per hour | 1 | +| use_time_ratio | /1 | 0.01 | Proportion of time the device is used during the given duration. | 0.2 | +| hours_life_time | hours | 43800 | Life time of the device in hours | 1000 | + +#### oled + +| Name | Unit | Default values (default;min;max) | Description | Example | +|-----------------|-------------|----------------------------------|------------------------------------------------------------------|----------| +| avg_power | Watt/hour | 710;710;710 | Average electrical consumption per hour | 1 | +| use_time_ratio | /1 | 0.01 | Proportion of time the device is used during the given duration. | 0.2 | +| hours_life_time | hours | 43800 | Life time of the device in hours | 1000 | + + +## VR controller + +### Embedded impacts + +| Criteria | Unit | value | +|----------|--------------------|-----------| +| gwp | kgCO2eq | 4.22e+00 | +| gwpb | kg CO2 eq. | 1.97e-02 | +| gwpf | kg CO2 eq. | 4.20e+00 | +| gwplu | kg CO2 eq. | 4.14e-06 | +| ir | kg U235 eq. | 2.50e+00 | +| lu | No dimension | 5.73e-01 | +| odp | kg CFC-11 eq. | 7.66e-07 | +| pm | Disease occurrence | 2.22e-07 | +| pocp | kg NMVOC eq. | 1.46e-02 | +| wu | m3 eq. | 3.99e+01 | +| mips | kg | 5.47e+01 | +| adpe | kg SB eq. | 1.07e-03 | +| adpf | MJ | 5.45e+01 | +| ap | mol H+ eq. | 4.28e-02 | +| ctue | CTUe | 5.11e+01 | +| ctuh-c | CTUh | 5.95e-08 | +| ctuh-nc | CTUh | 1.85e-07 | +| epf | kg P eq. | 9.87e-05 | +| epm | kg N eq. | 4.28e-03 | +| ept | mol N eq. | 4.49e-02 | + +### Usage + +#### lcd + +| Name | Unit | Default values (default;min;max) | Description | Example | +|-------------------|--------------|----------------------------------|------------------------------------------------------------------|----------| +| avg_power | Watt/hour | 7.90;7.90;7.90 | Average electrical consumption per hour | 1 | +| use_time_ratio | /1 | 0.01 | Proportion of time the device is used during the given duration. | 0.2 | +| hours_life_time | hours | 43800 | Life time of the device in hours | 1000 | diff --git a/docs/docs/Reference/format/end_user_devices_route.md b/docs/docs/Reference/format/end_user_devices_route.md index ae30beed..69bcafe4 100644 --- a/docs/docs/Reference/format/end_user_devices_route.md +++ b/docs/docs/Reference/format/end_user_devices_route.md @@ -12,6 +12,8 @@ Available device : * usb_stick * external_ssd * external_hdd +* vr headset +* vr controller ## POST ```/v1/user_terminal/``` @@ -35,7 +37,7 @@ For some devices, you can set a type. See [end user device](../../Explanations/d ``` json { "usage":{...} -} +}git c ``` See [usage](usage.md) \ No newline at end of file diff --git a/docs/docs/Reference/routes.md b/docs/docs/Reference/routes.md index 5380c080..cfed6ebc 100644 --- a/docs/docs/Reference/routes.md +++ b/docs/docs/Reference/routes.md @@ -17,56 +17,60 @@ They all have the same query parameters. If no query parameters are provided, th Requesting the route with a GET method will return the impacts with the values taken from the archetype. -| Method | Routes | Description | -|--------|-----------------------------|-----------------------------------------------------| -| GET | /v1/server | Retrieve the impacts of a server archetype | -| GET | /v1/cloud | Retrieve the impacts of a cloud instance | -| GET | /v1/terminal/laptop | Retrieve the impacts of a laptop | -| GET | /v1/terminal/desktop | Retrieve the impacts of a desktop (without screen) | -| GET | /v1/terminal/smartphone | Retrieve the impacts of a smartphone | -| GET | /v1/terminal/tablet | Retrieve the impacts of a tablet | -| GET | /v1/terminal/television | Retrieve the impacts of a television | -| GET | /v1/terminal/box | Retrieve the impacts of a box | -| GET | /v1/peripheral/monitor | Retrieve the impacts of a monitor (computer screen) | -| GET | /v1/peripheral/usb_stick | Retrieve the impacts of a usb_stick | -| GET | /v1/peripheral/external_ssd | Retrieve the impacts of a external_ssd | -| GET | /v1/peripheral/external_hdd | Retrieve the impacts of a external_hdd | -| GET | /v1/component/cpu | Retrieve the impacts of a cpu | -| GET | /v1/component/ssd | Retrieve the impacts of a ssd | -| GET | /v1/component/ram | Retrieve the impacts of a ram | -| GET | /v1/component/hdd | Retrieve the impacts of a hdd | -| GET | /v1/component/motherboard | Retrieve the impacts of a motherboard | -| GET | /v1/component/power_supply | Retrieve the impacts of a power_supply | -| GET | /v1/component/case | Retrieve the impacts of a case | -| GET | /v1/iot/iot_device | Retrieve the impacts of an IoT device | - +| Method | Routes | Description | +|--------|------------------------------|-----------------------------------------------------| +| GET | /v1/server | Retrieve the impacts of a server archetype | +| GET | /v1/cloud | Retrieve the impacts of a cloud instance | +| GET | /v1/terminal/laptop | Retrieve the impacts of a laptop | +| GET | /v1/terminal/desktop | Retrieve the impacts of a desktop (without screen) | +| GET | /v1/terminal/smartphone | Retrieve the impacts of a smartphone | +| GET | /v1/terminal/tablet | Retrieve the impacts of a tablet | +| GET | /v1/terminal/television | Retrieve the impacts of a television | +| GET | /v1/terminal/box | Retrieve the impacts of a box | +| GET | /v1/terminal/vr_headset | Retrieve the impacts of a VR headset | +| GET | /v1/peripheral/monitor | Retrieve the impacts of a monitor (computer screen) | +| GET | /v1/peripheral/usb_stick | Retrieve the impacts of a usb_stick | +| GET | /v1/peripheral/external_ssd | Retrieve the impacts of a external_ssd | +| GET | /v1/peripheral/external_hdd | Retrieve the impacts of a external_hdd | +| GET | /v1/peripheral/vr_controller | Retrieve the impacts of a vr controller | +| GET | /v1/component/cpu | Retrieve the impacts of a cpu | +| GET | /v1/component/ssd | Retrieve the impacts of a ssd | +| GET | /v1/component/ram | Retrieve the impacts of a ram | +| GET | /v1/component/hdd | Retrieve the impacts of a hdd | +| GET | /v1/component/motherboard | Retrieve the impacts of a motherboard | +| GET | /v1/component/power_supply | Retrieve the impacts of a power_supply | +| GET | /v1/component/case | Retrieve the impacts of a case | +| GET | /v1/iot/iot_device | Retrieve the impacts of an IoT device | + ### POST Requesting the route with a POST method will return the impacts with the values taken from the body. Missing values will be taken from the archetype or set by default. The format section of the documentation details the format of the body for each route. -| Method | Routes | Description | -|--------|-----------------------------|-----------------------------------------------------------------------------------------| -| POST | /v1/server | Retrieve the impacts of a given usage and configuration for a server | -| POST | /v1/cloud | Retrieve the impacts of a given usage for a cloud instance | -| POST | /v1/terminal/laptop | Retrieve the impacts of a given usage and configuration for a laptop | -| POST | /v1/terminal/desktop | Retrieve the impacts of a given usage and configuration for a desktop (without screen) | -| POST | /v1/terminal/smartphone | Retrieve the impacts of a given usage and configuration for a smartphone | -| POST | /v1/terminal/tablet | Retrieve the impacts of a given usage and configuration for a tablet | -| POST | /v1/terminal/television | Retrieve the impacts of a given usage and configuration for a television | -| POST | /v1/terminal/box | Retrieve the impacts of a given usage and configuration for a box | -| POST | /v1/peripheral/monitor | Retrieve the impacts of a given usage and configuration for a monitor (computer screen) | -| POST | /v1/peripheral/usb_stick | Retrieve the impacts of a given usage and configuration for a usb_stick | -| POST | /v1/peripheral/external_ssd | Retrieve the impacts of a given usage and configuration for a external_ssd | -| POST | /v1/peripheral/external_hdd | Retrieve the impacts of a given usage and configuration for a external_hdd | -| POST | /v1/component/cpu | Retrieve the impacts of a given usage and configuration for a cpu | -| POST | /v1/component/ssd | Retrieve the impacts of a given usage and configuration for a ssd | -| POST | /v1/component/ram | Retrieve the impacts of a given usage and configuration for a ram | -| POST | /v1/component/hdd | Retrieve the impacts of a given usage and configuration for a hdd | -| POST | /v1/component/motherboard | Retrieve the impacts of a given usage and configuration for a motherboard | -| POST | /v1/component/power_supply | Retrieve the impacts of a given usage and configuration for a power_supply | -| POST | /v1/component/case | Retrieve the impacts of a given usage and configuration for a case | -| POST | /v1/iot/iot_device | Retrieve the impacts of an IoT device | +| Method | Routes | Description | +|----------|--------------------------------|-----------------------------------------------------------------------------------------| +| POST | /v1/server | Retrieve the impacts of a given usage and configuration for a server | +| POST | /v1/cloud | Retrieve the impacts of a given usage for a cloud instance | +| POST | /v1/terminal/laptop | Retrieve the impacts of a given usage and configuration for a laptop | +| POST | /v1/terminal/desktop | Retrieve the impacts of a given usage and configuration for a desktop (without screen) | +| POST | /v1/terminal/smartphone | Retrieve the impacts of a given usage and configuration for a smartphone | +| POST | /v1/terminal/tablet | Retrieve the impacts of a given usage and configuration for a tablet | +| POST | /v1/terminal/television | Retrieve the impacts of a given usage and configuration for a television | +| POST | /v1/terminal/box | Retrieve the impacts of a given usage and configuration for a box | +| POST | /v1/terminal/vr_headset | Retrieve the impacts of a given usage and configuration for a VR headset | +| POST | /v1/peripheral/monitor | Retrieve the impacts of a given usage and configuration for a monitor (computer screen) | +| POST | /v1/peripheral/usb_stick | Retrieve the impacts of a given usage and configuration for a usb_stick | +| POST | /v1/peripheral/external_ssd | Retrieve the impacts of a given usage and configuration for a external_ssd | +| POST | /v1/peripheral/external_hdd | Retrieve the impacts of a given usage and configuration for a external_hdd | +| POST | /v1/peripheral/vr_controller | Retrieve the impacts of a given usage and configuration for a vr controller | +| POST | /v1/component/cpu | Retrieve the impacts of a given usage and configuration for a cpu | +| POST | /v1/component/ssd | Retrieve the impacts of a given usage and configuration for a ssd | +| POST | /v1/component/ram | Retrieve the impacts of a given usage and configuration for a ram | +| POST | /v1/component/hdd | Retrieve the impacts of a given usage and configuration for a hdd | +| POST | /v1/component/motherboard | Retrieve the impacts of a given usage and configuration for a motherboard | +| POST | /v1/component/power_supply | Retrieve the impacts of a given usage and configuration for a power_supply | +| POST | /v1/component/case | Retrieve the impacts of a given usage and configuration for a case | +| POST | /v1/iot/iot_device | Retrieve the impacts of an IoT device | ## Consumption profile routes @@ -78,57 +82,61 @@ The format section of the documentation details the format of the body for each Utils routes are used to retrieve the list of possible values for some parameters, to retrieve the list of archetypes for a given asset or to use some specific features. -| Method | Routes | parameters | Description | -|--------|----------------------------------------------|-----------------|----------------------------------------------------------------------| -| GET | /v1/server/archetypes | | Get all available server archetype | -| GET | /v1/server/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/cloud/all_instances | ```provider``` | Get all available cloud instances for a given provider | -| GET | /v1/cloud/all_providers | | Get all available cloud providers | -| GET | /v1/server/archetype_config | ```instance``` | Get the config of a given instance | -| GET | /v1/terminal/all | | Get all available terminal with their route prefix | -| GET | /v1/terminal/laptop/archetypes | | Get all available archetype for a given laptop name | -| GET | /v1/terminal/laptop/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/terminal/desktop/archetypes | | Get all available archetype for a given desktop name | -| GET | /v1/terminal/desktop/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/terminal/smartphone/archetypes | | Get all available archetype for a given smartphone name | -| GET | /v1/terminal/smartphone/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/terminal/tablet/archetypes | | Get all available archetype for a given tablet name | -| GET | /v1/terminal/tablet/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/terminal/television/archetypes | | Get all available archetype for a given television name | -| GET | /v1/terminal/television/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/terminal/box/archetypes | | Get all available archetype for a given box name | -| GET | /v1/terminal/box/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/peripheral/all | | Get all available peripheral with their route prefix | -| GET | /v1/peripheral/monitor/archetypes | | Get all available archetype for a given monitor name | -| GET | /v1/peripheral/monitor/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/peripheral/usb_stick/archetypes | | Get all available archetype for a given usb_stick name | -| GET | /v1/peripheral/usb_stick/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/peripheral/external_hdd/archetypes | | Get all available archetype for a given external_hdd name | -| GET | /v1/peripheral/external_hdd/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/peripheral/external_ssd/archetypes | | Get all available archetype for a given external_ssd name | -| GET | /v1/peripheral/external_ssd/archetype_config | ```archetype``` | Get the config of a given archetype | -| GET | /v1/component/all | | Get all available components with their route prefix | -| GET | /v1/component/cpu/archetypes | | Get all available archetype for a cpu | -| GET | /v1/component/cpu/archetype_config | ```archetype``` | Get the config of a given cpu archetype | -| GET | /v1/component/ram/archetypes | | Get all available archetype for a ram | -| GET | /v1/component/ram/archetype_config | ```archetype``` | Get the config of a given ram archetype | -| GET | /v1/component/ssd/archetypes | | Get all available archetype for a ssd | -| GET | /v1/component/ssd/archetype_config | ```archetype``` | Get the config of a given ssd archetype | -| GET | /v1/component/hdd/archetypes | | Get all available archetype for a hdd | -| GET | /v1/component/hdd/archetype_config | ```archetype``` | Get the config of a given hdd archetype | -| GET | /v1/component/motherboard/archetypes | | Get all available archetype for a motherboard | -| GET | /v1/component/motherboard/archetype_config | ```archetype``` | Get the config of a given motherboard archetype | -| GET | /v1/component/case/archetypes | | Get all available archetype for a case | -| GET | /v1/component/case/archetype_config | ```archetype``` | Get the config of a given case archetype | -| GET | /v1/component/power_supply/archetypes | | Get all available archetype for a power_supply | -| GET | /v1/component/power_supply/archetype_config | ```archetype``` | Get the config of a given power_supply archetype | -| GET | /v1/iot/iot_device/archetypes | | Get all available archetype for an iot device | -| GET | /v1/iot/iot_device/archetype_config | ```archetype``` | Get the config of a given iot device archetype | -| GET | /v1/utils/country_code | | Get all available country code associated to its country name | -| GET | /v1/utils/cpu_model_range | | Get all available model_range | -| GET | /v1/utils/ssd_manufacturer | | Get all available ssd manufacturer | -| GET | /v1/utils/ram_manufacturer | | Get all available ram manufacturer | -| GET | /v1/utils/case_type | | Get all available case type | -| GET | /v1/utils/name_to_cpu | ```cpu_name``` | Get a description of a CPU from its name | -| GET | /v1/utils/cpu_name | | Get all available cpu name | -| GET | /v1/utils/impact_criteria | | Get all available impact criteria (name, code, description, unit) | \ No newline at end of file +| Method | Routes | parameters | Description | +|----------|------------------------------------------------|-----------------|--------------------------------------------------------------------| +| GET | /v1/server/archetypes | | Get all available server archetype | +| GET | /v1/server/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/cloud/all_instances | ```provider``` | Get all available cloud instances for a given provider | +| GET | /v1/cloud/all_providers | | Get all available cloud providers | +| GET | /v1/server/archetype_config | ```instance``` | Get the config of a given instance | +| GET | /v1/terminal/all | | Get all available terminal with their route prefix | +| GET | /v1/terminal/laptop/archetypes | | Get all available archetype for a given laptop name | +| GET | /v1/terminal/laptop/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/terminal/desktop/archetypes | | Get all available archetype for a given desktop name | +| GET | /v1/terminal/desktop/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/terminal/smartphone/archetypes | | Get all available archetype for a given smartphone name | +| GET | /v1/terminal/smartphone/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/terminal/tablet/archetypes | | Get all available archetype for a given tablet name | +| GET | /v1/terminal/tablet/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/terminal/television/archetypes | | Get all available archetype for a given television name | +| GET | /v1/terminal/television/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/terminal/box/archetypes | | Get all available archetype for a given box name | +| GET | /v1/terminal/box/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/terminal/vr_headset/archetypes | | Get all available archetype for a given vr_headset name | +| GET | /v1/terminal/vr_headset/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/peripheral/all | | Get all available peripheral with their route prefix | +| GET | /v1/peripheral/monitor/archetypes | | Get all available archetype for a given monitor name | +| GET | /v1/peripheral/monitor/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/peripheral/usb_stick/archetypes | | Get all available archetype for a given usb_stick name | +| GET | /v1/peripheral/usb_stick/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/peripheral/external_hdd/archetypes | | Get all available archetype for a given external_hdd name | +| GET | /v1/peripheral/external_hdd/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/peripheral/external_ssd/archetypes | | Get all available archetype for a given external_ssd name | +| GET | /v1/peripheral/external_ssd/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/peripheral/vr_controller/archetypes | | Get all available archetype for a given vr_controller name | +| GET | /v1/peripheral/vr_controller/archetype_config | ```archetype``` | Get the config of a given archetype | +| GET | /v1/component/all | | Get all available components with their route prefix | +| GET | /v1/component/cpu/archetypes | | Get all available archetype for a cpu | +| GET | /v1/component/cpu/archetype_config | ```archetype``` | Get the config of a given cpu archetype | +| GET | /v1/component/ram/archetypes | | Get all available archetype for a ram | +| GET | /v1/component/ram/archetype_config | ```archetype``` | Get the config of a given ram archetype | +| GET | /v1/component/ssd/archetypes | | Get all available archetype for a ssd | +| GET | /v1/component/ssd/archetype_config | ```archetype``` | Get the config of a given ssd archetype | +| GET | /v1/component/hdd/archetypes | | Get all available archetype for a hdd | +| GET | /v1/component/hdd/archetype_config | ```archetype``` | Get the config of a given hdd archetype | +| GET | /v1/component/motherboard/archetypes | | Get all available archetype for a motherboard | +| GET | /v1/component/motherboard/archetype_config | ```archetype``` | Get the config of a given motherboard archetype | +| GET | /v1/component/case/archetypes | | Get all available archetype for a case | +| GET | /v1/component/case/archetype_config | ```archetype``` | Get the config of a given case archetype | +| GET | /v1/component/power_supply/archetypes | | Get all available archetype for a power_supply | +| GET | /v1/component/power_supply/archetype_config | ```archetype``` | Get the config of a given power_supply archetype | +| GET | /v1/iot/iot_device/archetypes | | Get all available archetype for an iot device | +| GET | /v1/iot/iot_device/archetype_config | ```archetype``` | Get the config of a given iot device archetype | +| GET | /v1/utils/country_code | | Get all available country code associated to its country name | +| GET | /v1/utils/cpu_model_range | | Get all available model_range | +| GET | /v1/utils/ssd_manufacturer | | Get all available ssd manufacturer | +| GET | /v1/utils/ram_manufacturer | | Get all available ram manufacturer | +| GET | /v1/utils/case_type | | Get all available case type | +| GET | /v1/utils/name_to_cpu | ```cpu_name``` | Get a description of a CPU from its name | +| GET | /v1/utils/cpu_name | | Get all available cpu name | +| GET | /v1/utils/impact_criteria | | Get all available impact criteria (name, code, description, unit) | \ No newline at end of file diff --git a/tests/api/test_terminals_peripherals.py b/tests/api/test_terminals_peripherals.py index a8ecf9c5..c05ea0b4 100644 --- a/tests/api/test_terminals_peripherals.py +++ b/tests/api/test_terminals_peripherals.py @@ -48,60 +48,62 @@ async def test_smartphone(): assert res.status_code == 200 assert res.json() == {'impacts': {'adp': {'description': 'Use of minerals and fossil ressources', - 'embedded': 'not implemented', - 'unit': 'kgSbeq', - 'use': {'max': 5.235e-06, - 'min': 4.336e-08, - 'value': 4e-07}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 84.0, - 'min': 84.0, - 'value': 84.0, - 'warnings': ['Generic data used for impact ' - 'calculation.']}, - 'unit': 'kgCO2eq', - 'use': {'max': 17.74, 'min': 0.07555, 'value': 2.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': 'not implemented', - 'unit': 'MJ', - 'use': {'max': 9227.0, 'min': 0.0427, 'value': 100.0}}}, - 'verbose': {'adp_factor': {'max': 2.656e-07, - 'min': 1.32e-08, - 'source': 'ADEME Base IMPACTS ®', - 'status': 'DEFAULT', - 'unit': 'kg Sbeq/kWh', - 'value': 6.42e-08}, - 'avg_power': {'max': 3.0, - 'min': 0.5, - 'status': 'ARCHETYPE', - 'unit': 'W', - 'value': 1.0}, - 'duration': {'unit': 'hours', 'value': 21900.0}, - 'gwp_factor': {'max': 0.9, - 'min': 0.023, - 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' - 'Average of 27 european countries', - 'status': 'DEFAULT', - 'unit': 'kg CO2eq/kWh', - 'value': 0.38}, - 'hours_life_time': {'status': 'ARCHETYPE', - 'unit': 'hours', - 'value': 21900.0}, - 'pe_factor': {'max': 468.15, - 'min': 0.013, - 'source': 'ADPf / (1-%renewable_energy)', - 'status': 'DEFAULT', - 'unit': 'MJ/kWh', - 'value': 12.874}, - 'units': {'max': 1, 'min': 1, 'status': 'ARCHETYPE', 'value': 1}, - 'usage_location': {'status': 'DEFAULT', - 'unit': 'CodSP3 - NCS Country Codes - NATO', - 'value': 'EEE'}, - 'use_time_ratio': {'max': 0.3, - 'min': 0.3, - 'status': 'ARCHETYPE', - 'unit': '/1', - 'value': 0.3}}} + 'embedded': 'not implemented', + 'unit': 'kgSbeq', + 'use': {'max': 5.235e-06, + 'min': 4.336e-08, + 'value': 4e-07}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 84.0, + 'min': 84.0, + 'value': 84.0, + 'warnings': ['Generic data used for impact ' + 'calculation.']}, + 'unit': 'kgCO2eq', + 'use': {'max': 17.74, 'min': 0.07555, 'value': 2.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': 'not implemented', + 'unit': 'MJ', + 'use': {'max': 9227.0, 'min': 0.0427, 'value': 100.0}}}, + 'verbose': {'adp_factor': {'max': 2.656e-07, + 'min': 1.32e-08, + 'source': 'ADEME Base IMPACTS ®', + 'status': 'DEFAULT', + 'unit': 'kg Sbeq/kWh', + 'value': 6.42e-08}, + 'avg_power': {'max': 3.0, + 'min': 0.5, + 'status': 'ARCHETYPE', + 'unit': 'W', + 'value': 1.0}, + 'duration': {'unit': 'hours', 'value': 21900.0}, + 'gwp_factor': {'max': 0.9, + 'min': 0.023, + 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' + 'Average of 27 european countries', + 'status': 'DEFAULT', + 'unit': 'kg CO2eq/kWh', + 'value': 0.38}, + 'hours_life_time': {'max': 21900.0, + 'min': 21900.0, + 'status': 'ARCHETYPE', + 'unit': 'hours', + 'value': 21900.0}, + 'pe_factor': {'max': 468.15, + 'min': 0.013, + 'source': 'ADPf / (1-%renewable_energy)', + 'status': 'DEFAULT', + 'unit': 'MJ/kWh', + 'value': 12.874}, + 'units': {'max': 1, 'min': 1, 'status': 'ARCHETYPE', 'value': 1}, + 'usage_location': {'status': 'DEFAULT', + 'unit': 'CodSP3 - NCS Country Codes - NATO', + 'value': 'EEE'}, + 'use_time_ratio': {'max': 0.3, + 'min': 0.3, + 'status': 'ARCHETYPE', + 'unit': '/1', + 'value': 0.3}}} @pytest.mark.asyncio @@ -112,39 +114,41 @@ async def test_box(): assert res.status_code == 200 assert res.json() == {'impacts': {'adpe': {'description': 'Use of mineral and metal resources', - 'embedded': {'max': 4.41e-05, - 'min': 4.41e-05, - 'value': 4.41e-05, - 'warnings': ['Generic data used for impact ' - 'calculation.']}, - 'unit': 'kg SB eq.', - 'use': {'max': 0.0002327, - 'min': 2.891e-06, - 'value': 3e-05}}}, - 'verbose': {'adpe_factor': {'max': 2.656e-07, - 'min': 1.32e-08, - 'source': 'ADEME Base IMPACTS ®', - 'status': 'DEFAULT', - 'unit': 'kg Sbeq/kWh', - 'value': 6.42e-08}, - 'avg_power': {'max': 20.0, - 'min': 5.0, - 'status': 'ARCHETYPE', - 'unit': 'W', - 'value': 10.0}, - 'duration': {'unit': 'hours', 'value': 43800.0}, - 'hours_life_time': {'status': 'ARCHETYPE', - 'unit': 'hours', - 'value': 43800.0}, - 'units': {'max': 1, 'min': 1, 'status': 'ARCHETYPE', 'value': 1}, - 'usage_location': {'status': 'DEFAULT', - 'unit': 'CodSP3 - NCS Country Codes - NATO', - 'value': 'EEE'}, - 'use_time_ratio': {'max': 1.0, - 'min': 1.0, - 'status': 'ARCHETYPE', - 'unit': '/1', - 'value': 1.0}}} + 'embedded': {'max': 4.41e-05, + 'min': 4.41e-05, + 'value': 4.41e-05, + 'warnings': ['Generic data used for impact ' + 'calculation.']}, + 'unit': 'kg SB eq.', + 'use': {'max': 0.0002327, + 'min': 2.891e-06, + 'value': 3e-05}}}, + 'verbose': {'adpe_factor': {'max': 2.656e-07, + 'min': 1.32e-08, + 'source': 'ADEME Base IMPACTS ®', + 'status': 'DEFAULT', + 'unit': 'kg Sbeq/kWh', + 'value': 6.42e-08}, + 'avg_power': {'max': 20.0, + 'min': 5.0, + 'status': 'ARCHETYPE', + 'unit': 'W', + 'value': 10.0}, + 'duration': {'unit': 'hours', 'value': 43800.0}, + 'hours_life_time': {'max': 43800.0, + 'min': 43800.0, + 'status': 'ARCHETYPE', + 'unit': 'hours', + 'value': 43800.0}, + 'units': {'max': 1, 'min': 1, 'status': 'ARCHETYPE', 'value': 1}, + 'usage_location': {'status': 'DEFAULT', + 'unit': 'CodSP3 - NCS Country Codes - NATO', + 'value': 'EEE'}, + 'use_time_ratio': {'max': 1.0, + 'min': 1.0, + 'status': 'ARCHETYPE', + 'unit': '/1', + 'value': 1.0}}} @pytest.mark.asyncio @@ -155,37 +159,84 @@ async def test_tv_archetype_perso(): assert res.status_code == 200 assert res.json() == {'impacts': {'adpe': {'description': 'Use of mineral and metal resources', - 'embedded': {'max': 0.0383, - 'min': 0.0383, - 'value': 0.0383, - 'warnings': ['Generic data used for impact ' - 'calculation.']}, - 'unit': 'kg SB eq.', - 'use': {'max': 0.006701, - 'min': 1.665e-05, - 'value': 0.0004}}}, - 'verbose': {'adpe_factor': {'max': 2.656e-07, - 'min': 1.32e-08, - 'source': 'ADEME Base IMPACTS ®', - 'status': 'DEFAULT', - 'unit': 'kg Sbeq/kWh', - 'value': 6.42e-08}, - 'avg_power': {'max': 1200.0, - 'min': 60.0, - 'status': 'ARCHETYPE', - 'unit': 'W', - 'value': 300.0}, - 'duration': {'unit': 'hours', 'value': 70080.0}, - 'hours_life_time': {'status': 'ARCHETYPE', - 'unit': 'hours', - 'value': 70080.0}, - 'type': {'status': 'ARCHETYPE', 'value': 'perso'}, - 'units': {'max': 1, 'min': 1, 'status': 'ARCHETYPE', 'value': 1}, - 'usage_location': {'status': 'DEFAULT', - 'unit': 'CodSP3 - NCS Country Codes - NATO', - 'value': 'EEE'}, - 'use_time_ratio': {'max': 0.3, - 'min': 0.3, - 'status': 'ARCHETYPE', - 'unit': '/1', - 'value': 0.3}}} + 'embedded': {'max': 0.0383, + 'min': 0.0383, + 'value': 0.0383, + 'warnings': ['Generic data used for impact ' + 'calculation.']}, + 'unit': 'kg SB eq.', + 'use': {'max': 0.006701, + 'min': 1.665e-05, + 'value': 0.0004}}}, + 'verbose': {'adpe_factor': {'max': 2.656e-07, + 'min': 1.32e-08, + 'source': 'ADEME Base IMPACTS ®', + 'status': 'DEFAULT', + 'unit': 'kg Sbeq/kWh', + 'value': 6.42e-08}, + 'avg_power': {'max': 1200.0, + 'min': 60.0, + 'status': 'ARCHETYPE', + 'unit': 'W', + 'value': 300.0}, + 'duration': {'unit': 'hours', 'value': 70080.0}, + 'hours_life_time': {'max': 70080.0, + 'min': 70080.0, + 'status': 'ARCHETYPE', + 'unit': 'hours', + 'value': 70080.0}, + 'type': {'status': 'ARCHETYPE', 'value': 'perso'}, + 'units': {'max': 1, 'min': 1, 'status': 'ARCHETYPE', 'value': 1}, + 'usage_location': {'status': 'DEFAULT', + 'unit': 'CodSP3 - NCS Country Codes - NATO', + 'value': 'EEE'}, + 'use_time_ratio': {'max': 0.3, + 'min': 0.3, + 'status': 'ARCHETYPE', + 'unit': '/1', + 'value': 0.3}}} + + +@pytest.mark.asyncio +async def test_tv_archetype_perso_duration(): + transport = ASGITransport(app=app) + async with AsyncClient(transport=transport, base_url="http://test") as ac: + res = await ac.get('/v1/terminal/television?verbose=true&criteria=gwp&archetype=tv-perso&duration=1') + + assert res.status_code == 200 + assert res.json() == {'impacts': {'gwp': {'description': 'Total climate change', + 'embedded': {'max': 0.005137, + 'min': 0.005137, + 'value': 0.005137, + 'warnings': ['Generic data used for impact ' + 'calculation.']}, + 'unit': 'kgCO2eq', + 'use': {'max': 0.324, 'min': 0.000414, 'value': 0.03}}}, + 'verbose': {'avg_power': {'max': 1200.0, + 'min': 60.0, + 'status': 'ARCHETYPE', + 'unit': 'W', + 'value': 300.0}, + 'duration': {'unit': 'hours', 'value': 1.0}, + 'gwp_factor': {'max': 0.9, + 'min': 0.023, + 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' + 'Average of 27 european countries', + 'status': 'DEFAULT', + 'unit': 'kg CO2eq/kWh', + 'value': 0.38}, + 'hours_life_time': {'max': 70080.0, + 'min': 70080.0, + 'status': 'ARCHETYPE', + 'unit': 'hours', + 'value': 70080.0}, + 'type': {'status': 'ARCHETYPE', 'value': 'perso'}, + 'units': {'max': 1, 'min': 1, 'status': 'ARCHETYPE', 'value': 1}, + 'usage_location': {'status': 'DEFAULT', + 'unit': 'CodSP3 - NCS Country Codes - NATO', + 'value': 'EEE'}, + 'use_time_ratio': {'max': 0.3, + 'min': 0.3, + 'status': 'ARCHETYPE', + 'unit': '/1', + 'value': 0.3}}} diff --git a/tests/data/config.yml b/tests/data/config.yml index 23dad93e..236172b1 100644 --- a/tests/data/config.yml +++ b/tests/data/config.yml @@ -25,6 +25,8 @@ default_usb_stick: "usb-stick-default" default_external_ssd: "external-ssd-default" default_external_hdd: "hdd-default" default_iot_device: "iot-device-default" +default_vr_headset: "vr-headset-lcd" +default_vr_controller: "vr-controller-default" default_criteria: ["gwp", "adp", "pe"] diff --git a/tests/data/factors.yml b/tests/data/factors.yml index 6477d4e0..ae8ed968 100644 --- a/tests/data/factors.yml +++ b/tests/data/factors.yml @@ -19088,4 +19088,290 @@ "source": "Adapted by Tide from 'Assessing the embodied carbon footprint of IoT edge devices with a bottom-up life-cycle approach', 2021; Thibault Pirson et David Bol (Université catholique de Louvain, ICTEAM/ECS, Louvain-la-Neuve, Belgique)" } } -} \ No newline at end of file +} + +"VR_CONTROLLER": { + "adpe": { + "impact": 1.07e-03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "adpf": { + "impact": 5.45e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ap": { + "impact": 4.28e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ctue": { + "impact": 5.11e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ctuh-c": { + "impact": 5.95e-08, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ctuh-nc": { + "impact": 1.85e-07, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "epf": { + "impact": 9.87e-05, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "epm": { + "impact": 4.28e-03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ept": { + "impact": 4.49e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "gwp": { + "impact": 4.22e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "gwpb": { + "impact": 1.97e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "gwpf": { + "impact": 4.20e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "gwplu": { + "impact": 4.14e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "ir": { + "impact": 2.50e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "lu": { + "impact": 5.73e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "odp": { + "impact": 7.66e-07, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "pm": { + "impact": 2.22e-07, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "pocp": { + "impact": 1.46e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "wu": { + "impact": 3.99e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "mips": { + "impact": 5.47e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } +} + +"VR_HEADSET": { + "adpe": { + "lcd": { + "impact": 3.33e-03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 4.54e-03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "adpf": { + "lcd": { + "impact": 6.11e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.35e+03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ap": { + "lcd": { + "impact": 2.64e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 5.96e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ctue": { + "lcd": { + "impact": 6.82e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.68e+03, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ctuh-c": { + "lcd": { + "impact": 1.31e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 5.00e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ctuh-nc": { + "lcd": { + "impact": 6.84e-07, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.02e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "epf": { + "lcd": { + "impact": 7.00e-04, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.11e-04, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "epm": { + "lcd": { + "impact": 3.74e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.22e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ept": { + "lcd": { + "impact": 3.69e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 7.69e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "gwp": { + "lcd": { + "impact": 4.59e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 8.94e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "gwpb": { + "lcd": { + "impact": 8.83e-02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 4.33e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "gwpf": { + "lcd": { + "impact": 4.30e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 8.89e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "gwplu": { + "lcd": { + "impact": 9.55e-05, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 4.73e-08, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "ir": { + "lcd": { + "impact": 1.54e+01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 2.12e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "lu": { + "lcd": { + "impact": 1.71e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 1.18e+00, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "odp": { + "lcd": { + "impact": 1.52e-05, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 8.39e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "pm": { + "lcd": { + "impact": 1.50e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 3.30e-06, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "pocp": { + "lcd": { + "impact": 1.15e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 2.41e-01, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "wu": { + "lcd": { + "impact": 1.27e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 4.29e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + }, + "mips": { + "lcd": { + "impact": 1.54e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + }, + "oled": { + "impact": 3.03e+02, + "source": "CEPIR : Cas d'Étude Pour un Immersif Responsable, 2022" + } + } +}