Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC YAML scenario parser #271

Closed
markaren opened this issue Jun 18, 2019 · 0 comments · Fixed by #275
Closed

PoC YAML scenario parser #271

markaren opened this issue Jun 18, 2019 · 0 comments · Fixed by #275
Assignees
Labels
discussion needed Let's have a discussion about this enhancement New feature or request

Comments

@markaren
Copy link
Contributor

markaren commented Jun 18, 2019

If there are no objections I want to add a proof of concept scenario parser that uses YAML instead of JSON. YAML is easier to write, looks better and supports comments.

Compare

{
  "defaults": {
    "model": "slave uno",
    "variable": "realOut",
    "causality": "input",
    "type": "integer",
    "action": "override"
  },
  "events": [
    {
      "time": 0.5,
      "variable": "realIn",
      "type": "real",
      "action": "bias",
      "value": 1.001
    },
    {
      "time": 0.2,
      "causality": "output",
      "type": "real",
      "value": -1.0
    },
    {
      "time": 0.3,
      "causality": "output",
      "type": "real",
      "action": "reset"
    },
    {
      "time": 0.65,
      "variable": "intIn",
      "value": 2
    },
    {
      "time": 0.8,
      "variable": "intOut",
      "causality": "output",
      "value": 5
    }
  ],
  "end": 1.0
}

to

---
defaults:
  model: slave uno
  variable: realOut
  causality: input
  type: integer
  action: override
events:
- time: 0.5
  variable: realIn
  type: real
  action: bias
  value: 1.001
- time: 0.2
  causality: output
  type: real
  value: -1
- time: 0.3
  causality: output
  type: real
  action: reset
- time: 0.65
  variable: intIn
  value: 2
- time: 0.8
  variable: intOut
  causality: output
  value: 5
end: 1

Since scenario_parser.hpp is implementation agnostic, we could potentially support both. But we should probably decide on a final format at some point.

C++ YAML parser is available from: conan: https://github.com/bincrafters/conan-yaml-cpp

No timeline given. Don't know when I'll have time.

@markaren markaren added enhancement New feature or request discussion needed Let's have a discussion about this labels Jun 18, 2019
@markaren markaren self-assigned this Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion needed Let's have a discussion about this enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant