home Forums # Technical Support Feedback in QtFuzzyLite 6

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2625
    Unknown
    Member

    Hello, I used QtFuzzyLite 6 to design a controller. Now I want to test it in a simulation. Is there a possibility to design somthing like a feedback loop so that the controller output influences the controller input values for the next simulation step?
    What about the option of Client/Server communication via TCP/IP? May it be used for the described purpose? Does somebody have experiences how to use this way of data exchange for a controller simulation?
    Thanks a lot.

    #2626

    Hi Joerg,

    thank you for your interesting questions.

    It would be better if you provide an example of what you are trying to achieve.

    For what I understand, it seems to me that you may want to use output variables as antecedents in the rules, although this does not refer to the next simulation step (t+1). Consider the example “SimpleDimmerInverse”, where the output of Power is computed and used in the same simulation step:

    
    #File: /fuzzylite/examples/mamdani/SimpleDimmerInverse.fll
    Engine: SimpleDimmerInverse
    InputVariable: Ambient
      enabled: true
      range: 0.000 1.000
      lock-range: false
      term: DARK Triangle 0.000 0.250 0.500
      term: MEDIUM Triangle 0.250 0.500 0.750
      term: BRIGHT Triangle 0.500 0.750 1.000
    OutputVariable: Power
      enabled: true
      range: 0.000 1.000
      lock-range: false
      aggregation: Maximum
      defuzzifier: Centroid 200
      default: nan
      lock-previous: false
      term: LOW Triangle 0.000 0.250 0.500
      term: MEDIUM Triangle 0.250 0.500 0.750
      term: HIGH Triangle 0.500 0.750 1.000
    OutputVariable: InversePower
      enabled: true
      range: 0.000 1.000
      lock-range: false
      aggregation: Maximum
      defuzzifier: Centroid 500
      default: nan
      lock-previous: false
      term: LOW Cosine 0.200 0.500
      term: MEDIUM Cosine 0.500 0.500
      term: HIGH Cosine 0.800 0.500
    RuleBlock: 
      enabled: true
      conjunction: none
      disjunction: none
      implication: Minimum
      activation: General
      rule: if Ambient is DARK then Power is HIGH
      rule: if Ambient is MEDIUM then Power is MEDIUM
      rule: if Ambient is BRIGHT then Power is LOW
      rule: if Power is LOW then InversePower is HIGH
      rule: if Power is MEDIUM then InversePower is MEDIUM
      rule: if Power is HIGH then InversePower is LOW
    

    Alternatively, you could (1) create your own activation method, or (2) create your own way to process the engine. For (1), you could create an activation method that stores the output values at (t-1), computes the current outputs at (t), and changes the current outputs according to (t-1). For (2), you do not execute Engine::process(), but instead create a method of your own to do the same as in (1). You can take a look at what Engine::process() does for an idea. In cases (1) and (2), you will not be able to see the simulation in QtFuzzyLite, though.

    If you provide a more specific example of what you are trying to achieve, there may be other solutions.

    Cheers.

    #2629
    Unknown
    Member

    Dear Juan,
    thank you very much for your fast and kind reply. I was some days out of the office so I can reply only now. Sorry for the incomplete description of my problem.
    A little bit simplified my engine is a heating unit in a room. Output of the controller is the heater power. But the heater should not only stabilize the current room temperature in a certain interval, it should also take into account the expected weather conditions of tomorrow and the expected tomorrow energy costs.
    So for my fuzzy control, which I would like to use for a time step simulation, I have two different kinds of input values. First, external parameters (weather – W, costs – C) which I can provide to the controller e.g. as a file in the QtFuzzyLite Simulation tool.
    Second, the room temperature T. I imagine the calculation as follows:
    For the values Tn, Wn and Cn (at time n) the fuzzy controller calculates the heater power Pn. This Pn changes the room temperature to Tn+1 according to a room model. Together with Wn+1 and Cn+1 (from the file) this Tn+1 should be the input for the next controller calculation.
    Is it possible to solve this problem using only QtFuzzyLite-Tools? For example, can I use the file monitor option of the simulation tool? How does it work? Is there an interface to make Pn accessible for external software?
    I’m not very familiar with C++ programming. Up to now all my attempts to compile a FuzzyLite project with VS2017 failed…
    Many thanks and best regards
    Joerg

    #2631

    Hi,

    thank you for your post and interesting questions.

    At the moment, unfortunately, it is not possible to do what you suggest with only QtFuzzyLite, but it should not be too difficult to do using fuzzylite for C++ or jfuzzylite for Java.

    I have not tried compiling fuzzylite with VS2017, but I assume that it is not different from VS2015. Please, have a read at the updated compile instructions for fuzzylite 6 at https://github.com/fuzzylite/fuzzylite#compile-link-and-execute Also, please have a look at the sample project available at https://github.com/fuzzylite/fuzzylite/tree/release/examples/application . You should take a look at the definitions made in the CMakeList file.

    #2632
    Unknown
    Member

    Hi Juan,
    thank you for your answer. I will work through the compile instructions and come back with detailed questions if required.
    Best regards
    Joerg

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.