diff --git a/EENX15_LQR/Arduino_skal.h b/EENX15_LQR/Arduino_skal.h deleted file mode 100644 index a92c6b6..0000000 --- a/EENX15_LQR/Arduino_skal.h +++ /dev/null @@ -1,228 +0,0 @@ -// -// Academic License - for use in teaching, academic research, and meeting -// course requirements at degree granting institutions only. Not for -// government, commercial, or other organizational use. -// -// File: Arduino_skal.h -// -// Code generated for Simulink model 'Arduino_skal'. -// -// Model version : 1.1 -// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020 -// C/C++ source code generated on : Thu Apr 15 22:06:00 2021 -// -// Target selection: ert.tlc -// Embedded hardware selection: AMD->x86-64 (Windows64) -// Code generation objectives: -// 1. Execution efficiency -// 2. RAM efficiency -// Validation result: Not run -// -#ifndef RTW_HEADER_Arduino_skal_h_ -#define RTW_HEADER_Arduino_skal_h_ -//#include -#include "rtwtypes.h" -//#include "rtw_continuous.h" -//#include "rtw_solver.h" - -// Model Code Variants - -// Macros for accessing real-time model data structure -#ifndef rtmGetErrorStatus -#define rtmGetErrorStatus(rtm) ((rtm)->errorStatus) -#endif - -#ifndef rtmSetErrorStatus -#define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val)) -#endif - -#ifndef rtmGetStopRequested -#define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag) -#endif - -#ifndef rtmSetStopRequested -#define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val)) -#endif - -#ifndef rtmGetStopRequestedPtr -#define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag)) -#endif - -#ifndef rtmGetT -#define rtmGetT(rtm) (rtmGetTPtr((rtm))[0]) -#endif - -#ifndef rtmGetTPtr -#define rtmGetTPtr(rtm) ((rtm)->Timing.t) -#endif - -#ifndef ODE3_INTG -#define ODE3_INTG - -// ODE3 Integration Data -struct ODE3_IntgData { - real_T *y; // output - real_T *f[3]; // derivatives -}; - -#endif - -// Class declaration for model Arduino_skal -class Arduino_skalModelClass { - // public data and function members - public: - // Block signals and states (default storage) for system '' - struct DW { - real_T Sum4[4]; // '/Sum4' - }; - - // Continuous states (default storage) - struct X { - real_T Integrator1_CSTATE[4]; // '/Integrator1' - }; - - // State derivatives (default storage) - struct XDot { - real_T Integrator1_CSTATE[4]; // '/Integrator1' - }; - - // State disabled - struct XDis { - boolean_T Integrator1_CSTATE[4]; // '/Integrator1' - }; - - // Constant parameters (default storage) - struct ConstP { - // Expression: [100;200] - // Referenced by: '/vartejag' - - real_T vartejag_Value[2]; - - // Expression: A - // Referenced by: '/Gain4' - - real_T Gain4_Gain[16]; - - // Expression: C - // Referenced by: '/Gain6' - - real_T Gain6_Gain[8]; - - // Expression: L - // Referenced by: '/Gain2' - - real_T Gain2_Gain[8]; - - // Expression: B - // Referenced by: '/Gain3' - - real_T Gain3_Gain[4]; - }; - - // Real-time Model Data Structure - struct RT_MODEL { - const char_T *errorStatus; - //RTWSolverInfo solverInfo; - X *contStates; - int_T *periodicContStateIndices; - real_T *periodicContStateRanges; - real_T *derivs; - boolean_T *contStateDisabled; - boolean_T zCCacheNeedsReset; - boolean_T derivCacheNeedsReset; - boolean_T CTOutputIncnstWithState; - real_T odeY[4]; - real_T odeF[3][4]; - ODE3_IntgData intgData; - - // - // Sizes: - // The following substructure contains sizes information - // for many of the model attributes such as inputs, outputs, - // dwork, sample times, etc. - - struct { - int_T numContStates; - int_T numPeriodicContStates; - int_T numSampTimes; - } Sizes; - - // - // Timing: - // The following substructure contains information regarding - // the timing information for the model. - - struct { - uint32_T clockTick0; - time_T stepSize0; - uint32_T clockTick1; -// SimTimeStep simTimeStep; - boolean_T stopRequestedFlag; - time_T *t; - time_T tArray[2]; - } Timing; - }; - - // model initialize function - void initialize(); - - // model step function - void step(); - - // Constructor - Arduino_skalModelClass(); - - // Destructor - ~Arduino_skalModelClass(); - - // Real-Time Model get method - Arduino_skalModelClass::RT_MODEL * getRTM(); - - // private data and function members - private: - // Block signals and states - DW rtDW; - X rtX; // Block continuous states - - // Real-Time Model - RT_MODEL rtM; - - // Continuous states update member function - //void rt_ertODEUpdateContinuousStates(RTWSolverInfo *si ); - - // Derivatives member function - void Arduino_skal_derivatives(); -}; - -// Constant parameters (default storage) -extern const Arduino_skalModelClass::ConstP rtConstP; - -//- -// These blocks were eliminated from the model due to optimizations: -// -// Block '/Kr' : Eliminated nontunable gain of 1 - - -//- -// The generated code includes comments that allow you to trace directly -// back to the appropriate location in the model. The basic format -// is /block_name, where system is the system number (uniquely -// assigned by Simulink) and block_name is the name of the block. -// -// Use the MATLAB hilite_system command to trace the generated code back -// to the model. For example, -// -// hilite_system('') - opens system 3 -// hilite_system('/Kp') - opens and selects block Kp which resides in S3 -// -// Here is the system hierarchy for this model -// -// '' : 'Arduino_skal' - -#endif // RTW_HEADER_Arduino_skal_h_ - -// -// File trailer for generated code. -// -// [EOF] -// diff --git a/EENX15_LQR/LQR.ino b/EENX15_LQR/LQR.ino index 56869a3..f97f021 100644 --- a/EENX15_LQR/LQR.ino +++ b/EENX15_LQR/LQR.ino @@ -1,5 +1,5 @@ //LQR-stuff -#include "Arduino_skal.h" +//#include "Arduino_skal.h" // | /////////////////////////////////// // | //Row 24-52 in Arduino_skal_data.cpp @@ -102,7 +102,7 @@ int inputToControlSystem(float position_m, float angle_r){ // | /////////////////////////////////// // | //Row 215-225 in Arduino_skal.cpp // v /////////////////////////////////// - +/* void Arduino_skalModelClass::Arduino_skal_derivatives() { Arduino_skalModelClass::XDot *_rtXdot; @@ -113,4 +113,4 @@ void Arduino_skalModelClass::Arduino_skal_derivatives() _rtXdot->Integrator1_CSTATE[1] = rtDW.Sum4[1]; _rtXdot->Integrator1_CSTATE[2] = rtDW.Sum4[2]; _rtXdot->Integrator1_CSTATE[3] = rtDW.Sum4[3]; -} +}*/ diff --git a/EENX15_LQR/rtwtypes.h b/EENX15_LQR/rtwtypes.h deleted file mode 100644 index 78b9145..0000000 --- a/EENX15_LQR/rtwtypes.h +++ /dev/null @@ -1,106 +0,0 @@ -// -// Academic License - for use in teaching, academic research, and meeting -// course requirements at degree granting institutions only. Not for -// government, commercial, or other organizational use. -// -// File: rtwtypes.h -// -// Code generated for Simulink model 'Arduino_skal'. -// -// Model version : 1.1 -// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020 -// C/C++ source code generated on : Thu Apr 15 22:06:00 2021 -// -// Target selection: ert.tlc -// Embedded hardware selection: AMD->x86-64 (Windows64) -// Code generation objectives: -// 1. Execution efficiency -// 2. RAM efficiency -// Validation result: Not run -// - -#ifndef RTWTYPES_H -#define RTWTYPES_H - -// Logical type definitions -#if (!defined(__cplusplus)) -#ifndef false -#define false (0U) -#endif - -#ifndef true -#define true (1U) -#endif -#endif - -//=======================================================================* -// Target hardware information -// Device type: AMD->x86-64 (Windows64) -// Number of bits: char: 8 short: 16 int: 32 -// long: 32 long long: 64 -// native word size: 64 -// Byte ordering: LittleEndian -// Signed integer division rounds to: Zero -// Shift right on a signed integer as arithmetic shift: on -// ======================================================================= - -//=======================================================================* -// Fixed width word size data types: * -// int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * -// uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * -// real32_T, real64_T - 32 and 64 bit floating point numbers * -// ======================================================================= -typedef signed char int8_T; -typedef unsigned char uint8_T; -typedef short int16_T; -typedef unsigned short uint16_T; -typedef int int32_T; -typedef unsigned int uint32_T; -typedef long long int64_T; -typedef unsigned long long uint64_T; -typedef float real32_T; -typedef double real64_T; - -//===========================================================================* -// Generic type definitions: boolean_T, char_T, byte_T, int_T, uint_T, * -// real_T, time_T, ulong_T, ulonglong_T. * -// =========================================================================== -typedef double real_T; -typedef double time_T; -typedef unsigned char boolean_T; -typedef int int_T; -typedef unsigned int uint_T; -typedef unsigned long ulong_T; -typedef unsigned long long ulonglong_T; -typedef char char_T; -typedef unsigned char uchar_T; -typedef char_T byte_T; - -//=======================================================================* -// Min and Max: * -// int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * -// uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * -// ======================================================================= -#define MAX_int8_T ((int8_T)(127)) -#define MIN_int8_T ((int8_T)(-128)) -#define MAX_uint8_T ((uint8_T)(255U)) -#define MAX_int16_T ((int16_T)(32767)) -#define MIN_int16_T ((int16_T)(-32768)) -#define MAX_uint16_T ((uint16_T)(65535U)) -#define MAX_int32_T ((int32_T)(2147483647)) -#define MIN_int32_T ((int32_T)(-2147483647-1)) -#define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) -#define MAX_int64_T ((int64_T)(9223372036854775807LL)) -#define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) -#define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFULL)) - -// Block D-Work pointer type -typedef void * pointer_T; - -#endif // RTWTYPES_H - -// -// File trailer for generated code. -// -// [EOF] -//