Skip to content

Commit

Permalink
Generate doc.
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Rule (VM/EMT3) <[email protected]>
  • Loading branch information
timrulebosch committed Feb 5, 2025
1 parent c59b9de commit 35ee01b
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 122 deletions.
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ DOC_C_MODULES := fmimcl fmimodelc fmu fmigateway
.PHONY: examples
examples:
cd ..;mkdir -p doc/content/apis/fmi/examples/fmu
cd ..;cp dse/examples/fmu/counter/fmu.c doc/content/apis/fmi/examples/fmu/fmu.c
cd ..;cp dse/examples/fmu/counter/counter.c doc/content/apis/fmi/examples/fmu/fmu.c

.PHONY: index
index:
Expand Down
22 changes: 12 additions & 10 deletions doc/content/apis/fmi/examples/fmu/fmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,36 @@
//
// SPDX-License-Identifier: Apache-2.0

#include <dse/clib/util/strings.h>
#include <dse/clib/collections/hashmap.h>
#include <dse/fmu/fmu.h>

#define UNUSED(x) ((void)x)
#define VR_COUNTER "1"
typedef struct {
double counter;
} VarTable;

int fmu_create(FmuInstanceData* fmu)
{
UNUSED(fmu);
VarTable* v = malloc(sizeof(VarTable));
*v = (VarTable){
.counter = fmu_register_var(fmu, 1, false, offsetof(VarTable, counter)),
};
fmu_register_var_table(fmu, v);
return 0;
}

int fmu_init(FmuInstanceData* fmu)
{
hashmap_set_double(&(fmu->variables.scalar.output), VR_COUNTER, 0.0);
UNUSED(fmu);
return 0;
}

int fmu_step(
FmuInstanceData* fmu, double CommunicationPoint, double stepSize)
int fmu_step(FmuInstanceData* fmu, double CommunicationPoint, double stepSize)
{
UNUSED(CommunicationPoint);
UNUSED(stepSize);
VarTable* v = fmu_var_table(fmu);

/* Increment the counter. */
double* counter = hashmap_get(&fmu->variables.scalar.output, VR_COUNTER);
if (counter) *counter += 1;
v->counter += 1;
return 0;
}

Expand Down
68 changes: 42 additions & 26 deletions doc/content/apis/fmi/fmigateway/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,6 @@
title: FMI Gateway FMU API Reference
linkTitle: Gateway FMU
---
## fmu_signals_reset


Resets the binary signals of the gateway to a length of 0, if the signals have
not been reseted yet.

> Required by FMU.
### Parameters

fmu (FmuInstanceData*)
: The FMU Descriptor object representing an instance of the FMU Model.



## fmu_signals_setup


Expand Down Expand Up @@ -155,14 +140,37 @@ fmu (FmuInstanceData*)



## fmu_signals_reset


Resets the binary signals of the gateway to a length of 0, if the signals have
not been reseted yet.

> Required by FMU.
### Parameters

fmu (FmuInstanceData*)
: The FMU Descriptor object representing an instance of the FMU Model.



## Typedefs

### FmiGateway

```c
typedef struct FmiGateway {
int * model;
struct (anonymous struct at dse/fmigateway/fmigateway.h:75:5) settings;
int* model;
struct {
int* doc_list;
const char** yaml_files;
double step_size;
double end_time;
int log_level;
const char* log_location;
FmiGatewaySession* session;
} settings;
int binary_signals_reset;
}
```
Expand All @@ -171,9 +179,19 @@ typedef struct FmiGateway {

```c
typedef struct FmiGatewaySession {
WindowsModel * w_models;
struct (anonymous struct at dse/fmigateway/fmigateway.h:61:5) init;
struct (anonymous struct at dse/fmigateway/fmigateway.h:65:5) shutdown;
const char* model_stack;
int* model_stack_file;
WindowsModel* w_models;
WindowsModel* simbus;
WindowsModel* transport;
struct {
int models;
int simbus;
int transport;
} visibility;
const char* init_cmd;
const char* shutdown_cmd;
int envar;
double last_step;
}
```
Expand All @@ -182,17 +200,15 @@ typedef struct FmiGatewaySession {

```c
typedef struct WindowsModel {
const char * path;
const char * file;
int show_process;
const char * name;
const char* exe;
const char* name;
double step_size;
double end_time;
int log_level;
const char * yaml;
char* yaml;
double current_step;
double timeout;
void * w_process;
void* w_process;
}
```

Expand Down
12 changes: 10 additions & 2 deletions doc/content/apis/fmi/fmimcl/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ model (ModelDesc*)
typedef struct FmuData {
int count;
const char** name;
uint32_t* binary_len;
struct {
double* scalar;
void** binary;
} binary_len;
int* kind;
int* mg_table;
}
Expand All @@ -265,7 +268,12 @@ typedef struct FmuModel {
void* m_doc;
void* adapter;
FmuData data;
struct (anonymous struct at dse/fmimcl/fmimcl.h:266:5) measurement;
struct {
char* file_name;
void* file;
int* cg;
int mdf;
} measurement;
}
```

Expand Down
Loading

0 comments on commit 35ee01b

Please sign in to comment.