if h > hControl: print "hControl must be bigger than h" exit(1) # Declaration of the Dynamical System processDS = FirstOrderLinearDS(x0, A) processDS.setComputebFunction("RelayPlugin", "computeB") # Control simulation sim = ControlZOHSimulation(t0, T, h) sim.setSaveOnlyMainSimulation(True) sim.addDynamicalSystem(processDS) # Actuator, Sensor & ControlManager sens = LinearSensor(processDS, sensorC) sim.addSensor(sens, hControl) act = LinearSMC(sens) act.setCsurface(Csurface) act.setB(Brel) sim.addActuator(act, hControl) # Initialization sim.initialize() # Run simulation sim.run() # Get data dataPlot = sim.data() # Save to disk savetxt('SMCExampleImplicit-py.dat', dataPlot)
if h > hControl: print("hControl must be bigger than h") exit(1) # Declaration of the Dynamical System processDS = FirstOrderLinearDS(x0, A) processDS.setComputebFunction("RelayPlugin", "computeB") # Control simulation sim = ControlZOHSimulation(t0, T, h) sim.setSaveOnlyMainSimulation(True) sim.addDynamicalSystem(processDS) # Actuator, Sensor & ControlManager sens = LinearSensor(processDS, sensorC) sim.addSensor(sens, hControl) act = LinearSMC(sens) act.setCsurface(Csurface) act.setB(Brel) sim.addActuator(act, hControl) # Initialization sim.initialize() # Run simulation sim.run() # Get data dataPlot = sim.data() # Save to disk savetxt('SMCExampleImplicit-py.dat', dataPlot)
process.nonSmoothDynamicalSystem().insertDynamicalSystem(processDS) # time discretisation processTD = TimeDiscretisation(t0, h) tSensor = TimeDiscretisation(t0, hControl) tActuator = TimeDiscretisation(t0, hControl) # Creation of the Simulation processSimulation = TimeStepping(processTD, 0) processSimulation.setName("plant simulation") # Declaration of the integrator processIntegrator = ZeroOrderHoldOSI(processDS) processSimulation.insertIntegrator(processIntegrator) # Actuator, Sensor & ControlManager control = ControlManager(process) sens = LinearSensor(tSensor, processDS, sensorC) control.addSensorPtr(sens) act = LinearSMC(tActuator, processDS) act.setCsurfacePtr(Csurface) act.setBPtr(Brel) #act.setDPtr(Drel) act.addSensorPtr(sens) control.addActuatorPtr(act) # Initialization process.initialize(processSimulation) control.initialize() # This is not working right now #eventsManager = s.eventsManager() # Matrix for data storage dataPlot = empty((3*(N+1), outputSize)) #dataPlot[0, 0] = processDS.t0()