home › Forums › # Technical Support › function in not loaded error
- This topic has 1 reply, 1 voice, and was last updated 3 years, 1 month ago by
Juan Rada-Vilela (admin).
-
AuthorPosts
-
May 11, 2020 at 15:27 #6889
CARLOS GARZON
GuestHello:
I have a problem on runtime error do know where to load the function
—————————————————————————–
import fuzzylite as fl#Declaring and Initializing the Fuzzy Engine
engine = fl.Engine(
name=”Tesis”,
description=”Dimmer Fuzzy System which dims light based upon Light Conditions, Activity and Light Standard”
)#Defining the Input Variables (Fuzzification)
engine.input_variables = [
fl.InputVariable(
name=”Ambient”,
description=””,
enabled=True,
minimum=0.001,
maximum=255.000,
lock_range=False,
terms=[
fl.Trapezoid(“Sensor”, 0.000, 255.000, 255.000, 255.000),
]
),
fl.InputVariable(
name=”Enable”,
description=””,
enabled=True,
minimum=0.001,
maximum=1.000,
lock_range=False,
terms=[
fl.Rectangle(“On”, 0.500, 1.000),
fl.Rectangle(“Off”, 0.000, 0.500),
]
),
fl.InputVariable(
name=”NormActivity”,
description=””,
enabled=True,
minimum=7.000,
maximum=255.000,
lock_range=False,
terms=[
fl.Rectangle(“GralTV”, 7.000, 17.000),
fl.Rectangle(“GralZones”, 58.000, 68.000),
fl.Rectangle(“GralKitchen”, 92.000, 102.000),
fl.Rectangle(“Bathroom”, 160.000, 170.000),
fl.Rectangle(“FoodPrep”, 194.000, 204.000),
fl.Rectangle(“WorkClean”, 245.000, 254.999)
]
)
]#Defining the Output Variables (Defuzzification)
engine.output_variables = [
fl.OutputVariable(
name=”Power”,
description=””,
enabled=True,
minimum=0.000,
maximum=255.000,
lock_range=False,
aggregation=fl.AlgebraicSum,
defuzzifier=fl.SmallestOfMaximum(200),
lock_previous=False,
terms=[
fl.Function(“LED2″,”le(Ambient,NormActivity)”,engine)
]
)
]#Creation of Fuzzy Rule Base
engine.rule_blocks = [
fl.RuleBlock(
name=”TesisRule”,
description=””,
enabled=True,
conjunction=fl.AlgebraicProduct(),
disjunction=None,
implication=fl.Minimum(),
activation=fl.General(),
rules=[
fl.Rule.create(“if Ambient is Sensor and Enable is On then Power is not LED2”,engine)
]
)
]ambient = engine.input_variable(“Ambient”)
enable = engine.input_variable(“Enable”)
normActivity = engine.input_variable(“NormActivity”)
power = engine.output_variable(“Power”)ambient.value = 7
enable.value = 1
normActivity.value = 250engine.process()
print(“Salida en LED: “,power.value.as_integer_ratio)
———————————————————————-
File “C:\Users\Direccion\Anaconda3\lib\site-packages\fuzzylite\term.py”, line 1235, in evaluate
raise RuntimeError(f”function ‘{self.formula}’ is not loaded”)RuntimeError: function ‘le(Ambient,NormActivity)’ is not loaded
August 4, 2020 at 23:29 #6912Juan Rada-Vilela (admin)
KeymasterHi,
I am very sorry for such a late response. It was classified as spam and I had no visibility.
The problem is that
fl.Function(“LED2″,”le(Ambient,NormActivity)”,engine)
does not load automatically, which is a bug. You have to load that function manually.led2 = fl.Function(“LED2″,”le(Ambient,NormActivity)”,engine) led2.load() # And then add into your controller.
Cheers,
Juan
-
AuthorPosts
- You must be logged in to reply to this topic.