Procházet zdrojové kódy

renamed controlled scenario to distinguish from new ones

Cláudio Gomes před 8 roky
rodič
revize
22cb269506

+ 1 - 2
SemanticAdaptationForFMI/FMIAbstraction/src/sampleunits/InacurateControllerArmatureAdaptation.py

@@ -2,8 +2,7 @@ import logging
 
 import numpy
 
-from units.AbstractSimulationUnit import AbstractSimulationUnit, STEP_ACCEPT, \
-    INIT_MODE
+from units.AbstractSimulationUnit import AbstractSimulationUnit, STEP_ACCEPT
 
 
 l = logging.getLogger()

+ 6 - 4
SemanticAdaptationForFMI/FMIAbstraction/src/sampleunits/PowerFMU.py

@@ -2,7 +2,7 @@ from units.CTSimulationUnit_Euler import CTSimulationUnit_Euler
 
 class PowerFMU(CTSimulationUnit_Euler):
     
-    def __init__(self, name, num_rtol, num_atol, internal_step_size, J, b, K, R, L, V):
+    def __init__(self, name, num_rtol, num_atol, internal_step_size, J, b, K, R, L, V_a):
         self.name = name
         
         self.up = "up"
@@ -16,7 +16,7 @@ class PowerFMU(CTSimulationUnit_Euler):
         self.i = "i"
         
         def get_v(up, down):
-            return V if up > 0.5 else (-V if down>0.5 else 0.0)
+            return V_a if up > 0.5 else (-V_a if down>0.5 else 0.0)
         
         def der_theta(x, u):
             return x[self.omega]
@@ -32,8 +32,10 @@ class PowerFMU(CTSimulationUnit_Euler):
                              self.i: der_i
                              }
         
-        algebraic_functions = []
+        algebraic_functions = {}
         
-        CTSimulationUnit_Euler.__init__(self, name, num_rtol, num_atol, internal_step_size, state_derivatives, {}, input_vars)
+        CTSimulationUnit_Euler.__init__(self, name, 
+                                        num_rtol, num_atol, internal_step_size, 
+                                        state_derivatives, algebraic_functions, input_vars)
     
     

+ 5 - 0
SemanticAdaptationForFMI/FMIAbstraction/src/scenarios/ControlledScenario.py

@@ -10,6 +10,11 @@ from sampleunits.PowerFMU import PowerFMU
 from sampleunits.PowerInputAdaptation import PowerInputAdaptation
 from sampleunits.WindowFMU import WindowFMU
 
+"""
+In this scenario, the controller is a statchart that receives events at his input.
+The main semantic adaptation is getting the continuous armature signal coming from the power system,
+and converting it into an event.
+"""
 
 NUM_RTOL = 1e-08
 NUM_ATOL = 1e-08