Midnight Sun Firmware
Loading...
Searching...
No Matches
soc_ekf_matlab.h
1#pragma once
2
3/************************************************************************************************
4 * @file soc_ekf_matlab.h
5 *
6 * @brief Soc Ekf Matlab
7 *
8 * @date 2025-10-31
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13
14/* Inter-component Headers */
15#include "rtwtypes.h"
16
17/* Intra-component Headers */
18
25/*
26 * Academic License - for use in teaching, academic research, and meeting
27 * course requirements at degree granting institutions only. Not for
28 * government, commercial, or other organizational use.
29 *
30 * File: soc_ekf_matlab.h
31 *
32 * Code generated for Simulink model 'soc_ekf_matlab'.
33 *
34 * Model version : 1.43
35 * Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
36 * C/C++ source code generated on : Thu Oct 30 18:39:26 2025
37 *
38 * Target selection: ert.tlc
39 * Embedded hardware selection: ARM Compatible->ARM Cortex-M
40 * Code generation objectives:
41 * 1. Execution efficiency
42 * 2. RAM efficiency
43 * Validation result: Not run
44 */
45
46#ifndef RTW_HEADER_soc_ekf_matlab_h_
47#define RTW_HEADER_soc_ekf_matlab_h_
48#ifndef soc_ekf_matlab_COMMON_INCLUDES_
49#define soc_ekf_matlab_COMMON_INCLUDES_
50#endif /* soc_ekf_matlab_COMMON_INCLUDES_ */
51
52/* Macros for accessing real-time model data structure */
53#ifndef rtmGetErrorStatus
54#define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
55#endif
56
57#ifndef rtmSetErrorStatus
58#define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
59#endif
60
61#define soc_ekf_matlab_M (rtM)
62
63/* Forward declaration for rtModel */
64typedef struct tag_RTM RT_MODEL;
65
66#ifndef DEFINED_TYPEDEF_FOR_battery_bus_
67#define DEFINED_TYPEDEF_FOR_battery_bus_
68
69typedef struct {
70 real_T N_series;
71 real_T N_parallel;
72 real_T Q_cell_Ah;
73 real_T R0_cell;
74 real_T R1_cell;
75 real_T C1_cell;
76 real_T Q_pack_Ah;
77 real_T R0_pack;
78 real_T R1_pack;
79 real_T C1_pack;
80 real_T Q_proc[4];
81 real_T R_meas;
82 real_T rest_thresh;
83 int32_T rest_window;
84 real_T alpha;
85 real_T SOC_OCV_table_size;
86 real_T SOC_table[100];
87 real_T OCV_table[100];
89
90#endif
91
92/* Block signals and states (default storage) for system '<Root>' */
93typedef struct {
94 real_T Fd[4];
95 real_T P_pred[4];
96 real_T P_new_tmp[4];
97 real_T Fd_m[4];
98 real_T Fd_c[4];
99 real_T kalman_gain[2];
100 real_T tau;
101 real_T soc_m;
102} DW;
103
104/* External inputs (root inport signals with default storage) */
105typedef struct {
106 real_T x_prev[2]; /* '<Root>/x_prev' */
107 real_T P_prev[4]; /* '<Root>/P_prev' */
108 real_T u_k; /* '<Root>/u_k' */
109 real_T z_k; /* '<Root>/z_k' */
110 battery_bus params; /* '<Root>/params' */
111 real_T dt; /* '<Root>/dt' */
112} ExtU;
113
114/* External outputs (root outports fed by signals with default storage) */
115typedef struct {
116 real_T x_new[2]; /* '<Root>/x_new' */
117 real_T P_new[4]; /* '<Root>/P_new' */
118 real_T y_pred; /* '<Root>/y_pred' */
119} ExtY;
120
121/* Real-time Model Data Structure */
122struct tag_RTM {
123 const char_T *volatile errorStatus;
124};
125
126/* Block signals and states (default storage) */
127extern DW rtDW;
128
129/* External inputs (root inport signals with default storage) */
130extern ExtU rtU;
131
132/* External outputs (root outports fed by signals with default storage) */
133extern ExtY rtY;
134
135/* Model entry point functions */
136extern void soc_ekf_matlab_initialize(void);
137extern void soc_ekf_matlab_step(void);
138
139/* Real-time Model object */
140extern RT_MODEL *const rtM;
141
142/*-
143 * The generated code includes comments that allow you to trace directly
144 * back to the appropriate location in the model. The basic format
145 * is <system>/block_name, where system is the system number (uniquely
146 * assigned by Simulink) and block_name is the name of the block.
147 *
148 * Note that this particular code originates from a subsystem build,
149 * and has its own system numbers different from the parent model.
150 * Refer to the system hierarchy for this subsystem below, and use the
151 * MATLAB hilite_system command to trace the generated code back
152 * to the parent model. For example,
153 *
154 * hilite_system('ekf_soc_estimator/soc_ekf_matlab') - opens subsystem ekf_soc_estimator/soc_ekf_matlab
155 * hilite_system('ekf_soc_estimator/soc_ekf_matlab/Kp') - opens and selects block Kp
156 *
157 * Here is the system hierarchy for this model
158 *
159 * '<Root>' : 'ekf_soc_estimator'
160 * '<S1>' : 'ekf_soc_estimator/soc_ekf_matlab'
161 */
162#endif /* RTW_HEADER_soc_ekf_matlab_h_ */
163
164/*
165 * File trailer for generated code.
166 *
167 * [EOF]
168 */
169
Definition: soc_ekf_matlab.h:93
Definition: soc_ekf_matlab.h:105
Definition: soc_ekf_matlab.h:115
Definition: soc_ekf_matlab.h:69
Definition: soc_ekf_matlab.h:122