1. 24 Mar, 2021 16 commits
  2. 08 Feb, 2021 1 commit
    • Bert Van Raemdonck's avatar
      Fix initial volume calculation bug · 269ff7f5
      Bert Van Raemdonck authored
      In the previous version, is the first datapoint of the PV curve was the
      closest one to the initial pressure, the initial volume was set to zero
      rather than the first volume datapoint of the PV curve.
  3. 05 Feb, 2021 4 commits
  4. 03 Feb, 2021 2 commits
  5. 19 Jan, 2021 1 commit
    • Bert Van Raemdonck's avatar
      Fix actuator initial volume calculation · 9bb6ef89
      Bert Van Raemdonck authored
      Previously, the calculation of the initial actuator volume on actuator
      initialization would generate an error if provided with a pv curve that
      does not cross the initial pressure. Change the behavior to return the
      volume that yields the pressure closest to the desired initial pressure
      if no crossings were found instead. Move the calculation to the PV curve
      object as it is in the end purely an operation on the PV curve.
  6. 15 Jan, 2021 3 commits
    • Bert Van Raemdonck's avatar
      System connectivity check · 44d90454
      Bert Van Raemdonck authored
      On creating the Simulation object, check whether in the provided system
      all components are connected together or not and issue a warning if it
      is not the case. It is possible that a user might want to simulate two
      disconnected networks in the same system, but most likely the user
      forgot to connect a component. The warning ought to remind him of that
    • Bert Van Raemdonck's avatar
      Auto-add components on connection · 08b43471
      Bert Van Raemdonck authored
      Automatically add the components to the system on connecting them
      together if the user hasn't done so previously. As long as the user
      refers to the components with pointers rather than with labels, he can
      therefore skip the step altogether. Mainly, it's a defense against the
      user to forget adding a particular component though.
    • Bert Van Raemdonck's avatar
      Separate Node class · b29dc469
      Bert Van Raemdonck authored
      Nodes are now treated as instances of a separate class rather than as
      sets in keeping with the OOP paradigm. This allows for the simulation to
      be written agnosically of the implementation of the nodes as sets as in
      the previous iteration.
      Also make the generation of the network equations more robust by not
      assuming that every terminal features the across or through variable
      being equated. In the previous iteration this would have resulted in an
      error and now the terminal is simply skipped over
  7. 13 Jan, 2021 2 commits
    • Bert Van Raemdonck's avatar
      Adaptive solver timestep manipulation update · a47f3de1
      Bert Van Raemdonck authored
      Further updates to the stepping logic of the adaptive solver to make it
      more robust.
      1. Also check the state variables (and not just the arguments) for large
         changes to reduce the time step to better handle discontinuities
      2. If decreasing the time step did not work, try slowly increasing the
         time step again for a number of times. This helps to overcome
         situations in which the solver would otherwise converge to a local
         optimum. Combining this change with the pchip interpolator allows to
         solve problems with snapping actuators with no flow restrictors
         present in the system at all, which previously led to undesireable
    • Bert Van Raemdonck's avatar
      Allow solver to terminate simulation · 438fbd98
      Bert Van Raemdonck authored
      Previously, the solver had no control over the simulation flow, which
      could resulted in for instance simulations keeping running even though
      the solver could not reach convergence and the results were not useable.
      Therefore, provide solvers with the option to return a boolean value to
      the simulation object that terminates the simulation prematurely and a
      string that explains why it was terminated.
  8. 04 Jan, 2021 11 commits
    • Bert Van Raemdonck's avatar
      Fix error fluid density in actuators · 41e3aaf6
      Bert Van Raemdonck authored
      The case for compressible and incompressible fluids were accidentally
      switched in calculating the density of the fluid for finding the initial
      mass of fluid in an actuator.
    • Bert Van Raemdonck's avatar
      Conservative time stepping · fa8cd545
      Bert Van Raemdonck authored
      A disadvantage of an adaptive time stepping scheme is that the time step
      can become too large such that zones of instability are skipped
      altogether and incorrect results are obtained. There were some examples
      in which the previous solver indeed didn't perform as expected because
      of that.
      Therefore make the solver more conservative in determining the step
      size. If for a certain time step a large change in variables is
      detected, the solver redoes the step with a smaller time increment even
      if it converged before until the change in variables during the step is
      acceptable. This leads to more datapoints during for example snapping
      and leads to more robust behavior when the maximum step size is large.
    • Bert Van Raemdonck's avatar
      Adaptive time step solver · 781b5452
      Bert Van Raemdonck authored
      Add ImplicitEulerNewtonAdaptiveTimeStep solver based on the parent
      ImplicitEulerNewton class but with a varying time step. The solver
      reduces the time step when convergence is not reached and increases it
      again when convergence was quick. This results in a way more stable
      simulations and significant speed-ups because the step time can be put
      higher on average without affecting the performance in the regions where
      a small time step is required to converge.
    • Bert Van Raemdonck's avatar
      Conventional simulation stepping controls · 8b840ed0
      Bert Van Raemdonck authored
      Provide stepping controls not by specifying the number of steps per
      second but rather the time step, as is common in most simulation
      programs. Also allow for the option to provide a minimum and maximum
      step size, but this is not used in the constant time step solver.
      Finally add the option to provide a maximum number of time steps to
      prevent the simulation from running unexpectedly long.
    • Bert Van Raemdonck's avatar
      Dynamic simulation memory management · 9f313aeb
      Bert Van Raemdonck authored
      Allocate memory during the simulation instead of everything happening
      before the start of the simulation. This uses a very general set of
      functions that can be used by any solver and only require an ever more
      accurate estimate of the amount of steps required in the simulation.
      Since these functions are so general, it makes sense to put them in the
      simulation class rather than repeating them in various solver classes.
      This means that the solver class is more about the operations during a
      single simulation step while the simulation class takes care of the full
      simulation flow and storage of the results.
    • Bert Van Raemdonck's avatar
      Time-based simulation progress · 631831fd
      Bert Van Raemdonck authored
      Determine progress of the simulation (for printing the progress messages
      and for determining when the simulation is finished) based on the
      current simulation time rather than from the amount of predicted steps.
      This allows to more easily work with solvers in which the amount of time
      steps is not known in advance.
      Also correct the amount of needed steps of the constant time step solver
      so the simulation is not stopped the increment before the time reaches
      the provided duration.
    • Bert Van Raemdonck's avatar
      Refactor ImplicitEulerNewtonConstantTimeStep · f54edebb
      Bert Van Raemdonck authored
      Refactor the ImplicitEulerNewtonConstantTimeStep class in order to use a
      number of its generic functions in other solvers later on. Write it as a
      child of a parent class with most generic functions (reporting on
      progress, general Newton solver) and subdivide the big block of code
      that was the run_step function in pieces that can be reused. Interaction
      with the simulation object has not been changed at this point
    • Bert Van Raemdonck's avatar
      Initial values for states and arguments · 6ee4f78b
      Bert Van Raemdonck authored
      Extend variable class with an initial_value property that works for both
      states and arguments and is filled in before the start of a simulation
      to get the proper initial conditions. The initial value can be set in
      every component and component/fluid combination. With this feature, the
      case of inflation of an actuator with a compressible fluid works
    • Bert Van Raemdonck's avatar
      Treat states analogous to arguments · 8a0a8fd7
      Bert Van Raemdonck authored
      Implement states also as their own variables which get assigned to the
      component in a similar way as the arguments. Also remove the different
      way in which arguments and states are handled to get the amount of each
      of them in the simulation object. This leads to more parallel structures
      in the code which one day might be performed by the same functions and
      in any case makes it easier to implement operations on states and
      arguments in the future
    • Bert Van Raemdonck's avatar
      Object-oriented initialization of terminals · 2a388dd5
      Bert Van Raemdonck authored
      Rewrite the way in which terminals are initialized to be more
      object-oriented. This allows to easily provide more information to the
      terminal variables that can be component specific since the variables
      are initialized in the components and not in the general terminal
    • Bert Van Raemdonck's avatar
      Evaluate actuator curve with volume · fd08b848
      Bert Van Raemdonck authored
      Previously, in the actuator component, the pressure was determined by
      interpolating the pressure-normal volume curve at the current normal
      volume. This works fine in most cases, but for certain functional
      pressure-volume curves, the pressure-normal volume curve can become
      non-functional for compressible fluids. Since the current curve
      interpreter is not equiped to deal with such non-functional curves, this
      results in erroneous behavior. Therefore, evaluate the actuator
      characteristic by evaluating its pressure-volume curve instead.
      A disadvantage is that the solver becomes more sensitive to the initial
      values of the arguments.