Tool Libs
UMIT-TIROL Institute of Automation and Control Engineering library collection
 
Loading...
Searching...
No Matches
sim.h
1#pragma once
2#include <core/kern.h>
3#include <cstdlib>
4
10static uint16_t getSimTimeStep(int argc, char *argv[]) {
11 switch (argc) {
12 case 1:
13 k.log.info("using default simulation time step = 1ms\n");
14 return 1000;
15 case 2: break;
16 default:
17 k.log.warn("usage: %s [time_factor]\n", argv[0]);
18 k.exit(EXIT_FAILURE);
19 }
20 uint16_t factor = strtol(argv[1],nullptr,10);
21 if (factor < 1 || factor > 1000) {
22 k.log.warn("factor _must_ be in range [1, 1000]\n");
23 k.exit(EXIT_FAILURE);
24 }
25 uint16_t ret = 1000/factor;
26 k.log.info("using simulation time step = %dus\n", ret);
27 return ret;
28}
void exit(int code=0)
stop kernel
Definition kern.h:52
Copyright (c) 2023 IACE.