  Optimizing CPS behavior in terms of energy consumption can have a significant
impact on system reliability. The environment influences the system's behavior,
and neglecting the environmental behavior has an indirect negative impact on
optimizing the system's behavior. In this work, to increase the system's
flexibility, the behavior of the environment is modeled dynamically to apply
the disorderliness of its behavior. The resulting models are formally verified.
By examining the past environmental behavior and predicting its future
behavior, energy optimization is done more dynamically. The verification
results acquired using a UPPAAL-SMC show that the optimization of system
behavior by predicting the environmental behavior has been successful. Our
approach is demonstrated using a case study within an I4 setting.
