issues.rst 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Common Issues and Solutions
  2. ===========================
  3. Not all models will simulate flawlessly. Some problems may arise upon the
  4. initialization of the model, or during the simulation itself. Below, the
  5. most common exceptions and/or issues are shown.
  6. AssertionError: Can only add BaseBlock (subclass) instances to a CBD
  7. --------------------------------------------------------------------
  8. This error is thrown whenever you try adding a block using the
  9. :func:`pyCBD.Core.CBD.addBlock` function if that block does **not** inherit from
  10. the :class:`pyCBD.Core.BaseBlock` class.
  11. NotImplementedError: BaseBlock has nothing to compute
  12. -----------------------------------------------------
  13. When invalidly inheriting a :class:`pyCBD.Core.BaseBlock`, this error may occur.
  14. It is a consequence of not overwriting the :func:`pyCBD.Core.BaseBlock.compute`
  15. method.
  16. ValueError: Specified object/influencer/dependent is not member of this graph
  17. -----------------------------------------------------------------------------
  18. This issue is indicative of an error in the dependency graph construction. Usually,
  19. this is due to an invalid connection between blocks. Make sure to always connect
  20. blocks that have been added to the CBD model. I.e. always call
  21. :func:`pyCBD.Core.CBD.addBlock` **before** any :func:`pyCBD.Core.CBD.addConnection`
  22. that includes the same block.
  23. KeyError: 'X'
  24. -------------
  25. This exception occurs if :code:`X` cannot be found. Make sure that :code:`X` is
  26. actually a block or a port in your model.
  27. Cannot solve non-linear algebraic loop.
  28. ---------------------------------------
  29. The internal solver of the CBD simulator is a simple `Gaussian-Jordan Linear solver
  30. <https://en.wikipedia.org/wiki/Gaussian_elimination>`_
  31. (see :class:`pyCBD.solver.GaussianJordanLinearSolver`) that uses row reduction to solve
  32. the algebraic loop. However, if this loop represents a non-linear system, the solver
  33. cannot handle this. Make use of a :class:`pyCBD.lib.std.DelayBlock` to actively "break"
  34. the loop.
  35. **Hint:** Internally, the :class:`pyCBD.lib.std.DerivatorBlock` and the
  36. :class:`pyCBD.lib.std.IntegratorBlock` make use of a :class:`pyCBD.lib.std.DelayBlock`, hence
  37. they can be used to solve the issue.
  38. Warning: did not add this block as it has the same name X as an already existing block
  39. --------------------------------------------------------------------------------------
  40. A warning that's generated by the :func:`pyCBD.Core.CBD.addBlock` method if it shares the
  41. same name as an already existing block. This is meant to ensure uniqueness of names.
  42. ImportError: cannot import name 'Clock' from partially initialized module 'pyCBD.lib.std'
  43. -----------------------------------------------------------------------------------------
  44. Before importing the standard library, it is important to also import the :mod:`pyCBD.Core`
  45. module. This will solve the circular dependency and dissipate the error.