{"id":44426277,"url":"https://github.com/alliander-opensource/measure","last_synced_at":"2026-02-12T10:34:02.461Z","repository":{"id":40667541,"uuid":"507827830","full_name":"alliander-opensource/measure","owner":"alliander-opensource","description":"Work with units of measurement ","archived":false,"fork":false,"pushed_at":"2025-11-04T10:27:20.000Z","size":201,"stargazers_count":2,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-04T12:15:32.119Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alliander-opensource.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-06-27T08:37:02.000Z","updated_at":"2025-11-04T10:26:15.000Z","dependencies_parsed_at":"2024-03-07T15:01:07.391Z","dependency_job_id":"4a183917-a379-49d6-b45e-ad8d7043ba0f","html_url":"https://github.com/alliander-opensource/measure","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/alliander-opensource/measure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliander-opensource%2Fmeasure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliander-opensource%2Fmeasure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliander-opensource%2Fmeasure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliander-opensource%2Fmeasure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alliander-opensource","download_url":"https://codeload.github.com/alliander-opensource/measure/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliander-opensource%2Fmeasure/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29363184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-12T10:34:01.421Z","updated_at":"2026-02-12T10:34:02.448Z","avatar_url":"https://github.com/alliander-opensource.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: 2021-2022 Alliander N.V.\n\nSPDX-License-Identifier: MPL-2.0\n--\u003e\n\n# Measure\n\n`measure` is a Kotlin library for working with units of measurement that are - for example - used in the power system sector.\n\n## Motivation\nProjects often need a way to express different quantities. For example, building software for electric grids one encounters quantities like power, energy, amperage etcetera.\n\nWhen one choses to represent this quantities as `BigDecimal`, one needs to be very vigilant when calculating with these quantities. It is easy to add power and energy when they both are represented as a `BigDecimal`, even though it does not make sense on physical grounds.\n\nRather, one would represents quantities as a multiple of a [*unit of measurement*][wikipedia:unit]. This project provides exactly that.\n\n## Usage\nIn using *measure* library there are two parts. The generic `Measure` and `Units` provided by the measure library, and the specific units that your project are interested in.\n\n```kotlin\nval power: Measure\u003cPower\u003e = 10 * kiloWatt\nval duration: Measure\u003cTime\u003e = 15 * minutes\n\nval energy: Measure\u003cEnergy\u003e = power * duration\n\nassertThat(energy `as` megaJoule).equals(9 * megaJoule)\n```\n\nThe code above demonstrates a fully annotated calculation with quantities. Often times the compiler can infer the corresponding types.\n\n## Development\nThis project is written in [Kotlin][kotlin] and uses [Gradle][gradle] as a build tool. To see which tasks are available run\n\n```\n./gradlew tasks\n```\n\n### Model\nThe code found in the `measure` module is generated from a model. The model is a [`System`](https://github.com/alliander-opensource/measure/blob/master/measure-generator/src/main/kotlin/com/alliander/open/measure/generator/System.kt) which describes units and their multiplications. An [application](https://github.com/alliander-opensource/measure/blob/master/measure-generator/src/main/kotlin/com/alliander/open/measure/generator/App.kt) can read a representation of a system and output the source.\n\nIf one wants to add a specific unit one can add it to the [units](https://github.com/alliander-opensource/measure/blob/master/measure-generator/src/main/resources/units.json) as found in the resources of the `measure-generator` module.\n\nIf the functionality of `Measure` should change one should make the intended changes in the [`measure.vtl`](https://github.com/alliander-opensource/measure/blob/master/measure-generator/src/main/resources/templates/measure.vtl) template or its companion [`specific.vtl`](https://github.com/alliander-opensource/measure/tree/master/measure-generator/src/main/resources/templates) that describes how specific units like *power*, *energy* or *time*.\n\n# License\nThis project is licensed under the Mozilla Public License, version 2.0 - see [LICENSE](LICENSE) for details.\n\n# Licenses third-party libraries\nThis project includes third-party libraries, \nwhich are licensed under their own respective Open-Source licenses.\nSPDX-License-Identifier headers are used to show which license is applicable. \nThe concerning license files can be found in the LICENSES directory.\n\n# Contributing\nPlease read [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) and [CONTRIBUTING](CONTRIBUTING.md) for details on the process \nfor submitting pull requests to us.\n\n# Contact\nPlease read [SUPPORT](SUPPORT.md) for how to connect and get into contact with the Measure project.\n\n[wikipedia:unit]: https://en.wikipedia.org/wiki/Unit_of_measurement\n[github:create-from-template]: https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/creating-a-repository-from-a-template\n[kotlin]: https://kotlinlang.org/\n[gradle]: https://gradle.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falliander-opensource%2Fmeasure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falliander-opensource%2Fmeasure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falliander-opensource%2Fmeasure/lists"}