Subsystem.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * File: Subsystem.c
  3. *
  4. * Code generated for Simulink model 'Subsystem'.
  5. *
  6. * Model version : 1.2
  7. * Simulink Coder version : 9.4 (R2020b) 29-Jul-2020
  8. * C/C++ source code generated on : Fri Oct 14 20:06:32 2022
  9. *
  10. * Target selection: ert.tlc
  11. * Embedded hardware selection: ARM Compatible->ARM Cortex-M
  12. * Code generation objectives:
  13. * 1. Execution efficiency
  14. * 2. RAM efficiency
  15. * Validation result: Not run
  16. */
  17. #include "Subsystem.h"
  18. /* Block signals and states (default storage) */
  19. DW rtDW;
  20. /* External inputs (root inport signals with default storage) */
  21. ExtU rtU;
  22. /* External outputs (root outports fed by signals with default storage) */
  23. ExtY rtY;
  24. /* Model step function */
  25. void Subsystem_step(void)
  26. {
  27. real_T rtb_DiscreteTimeIntegrator;
  28. /* Outputs for Atomic SubSystem: '<Root>/Subsystem' */
  29. /* DiscreteIntegrator: '<S1>/Discrete-Time Integrator' */
  30. rtb_DiscreteTimeIntegrator = rtDW.DiscreteTimeIntegrator_DSTATE;
  31. /* Outport: '<Root>/target' incorporates:
  32. * DiscreteIntegrator: '<S1>/Discrete-Time Integrator1'
  33. */
  34. rtY.target = rtDW.DiscreteTimeIntegrator1_DSTATE;
  35. /* Update for DiscreteIntegrator: '<S1>/Discrete-Time Integrator' incorporates:
  36. * DiscreteIntegrator: '<S1>/Discrete-Time Integrator1'
  37. * Gain: '<S1>/Gain'
  38. * Gain: '<S1>/Gain1'
  39. * Inport: '<Root>/in'
  40. * Inport: '<Root>/time'
  41. * Math: '<S1>/Math Function'
  42. * Product: '<S1>/Product'
  43. * Product: '<S1>/Product1'
  44. * Sum: '<S1>/Sum'
  45. * Sum: '<S1>/Sum1'
  46. */
  47. rtDW.DiscreteTimeIntegrator_DSTATE += ((rtDW.DiscreteTimeIntegrator1_DSTATE -
  48. rtU.in) * -(rtU.time * rtU.time) + -2.0 * rtU.time *
  49. rtDW.DiscreteTimeIntegrator_DSTATE) * 6.25E-5;
  50. /* Update for DiscreteIntegrator: '<S1>/Discrete-Time Integrator1' */
  51. rtDW.DiscreteTimeIntegrator1_DSTATE += 6.25E-5 * rtb_DiscreteTimeIntegrator;
  52. /* End of Outputs for SubSystem: '<Root>/Subsystem' */
  53. /* Outport: '<Root>/diff' */
  54. rtY.diff = rtb_DiscreteTimeIntegrator;
  55. }
  56. /* Model initialize function */
  57. void Subsystem_initialize(void)
  58. {
  59. /* (no initialization code required) */
  60. }
  61. /*
  62. * File trailer for generated code.
  63. *
  64. * [EOF]
  65. */