@@ -105,15 +105,12 @@ bool SmartChargingManager::getSetpoint(unsigned int
105105 }
106106 }
107107
108- // Compute connector setpoint if a transaction is active on the connector
108+ // Compute connector setpoint
109109 connector_setpoint.clear ();
110- if (connector->transaction_id != 0 )
110+ computeSetpoint (connector, connector_setpoint, unit, m_profile_db.txProfiles ());
111+ if (!connector_setpoint.isSet ())
111112 {
112- computeSetpoint (connector, connector_setpoint, unit, m_profile_db.txProfiles ());
113- if (!connector_setpoint.isSet ())
114- {
115- computeSetpoint (connector, connector_setpoint, unit, m_profile_db.txDefaultProfiles ());
116- }
113+ computeSetpoint (connector, connector_setpoint, unit, m_profile_db.txDefaultProfiles ());
117114 }
118115
119116 // Connector setpoint cannot be greater than charge point setpoint
@@ -541,16 +538,8 @@ void SmartChargingManager::computeSetpoint(Connector*
541538 ocpp::types::ChargingRateUnitType unit,
542539 const ProfileDatabase::ChargingProfileList& profiles_list)
543540{
544- unsigned int level = 0 ;
545541 for (const auto & profile : profiles_list)
546542 {
547- // Check if the profile has been found
548- if (connector_setpoint.isSet () && (profile.second .stackLevel < level))
549- {
550- // Profile found
551- break ;
552- }
553-
554543 // Check connector
555544 if ((profile.first == connector->id ) || (profile.first == 0 ))
556545 {
@@ -560,19 +549,8 @@ void SmartChargingManager::computeSetpoint(Connector*
560549 {
561550 // Apply setpoint
562551 fillSetpoint (connector_setpoint, unit, profile.second , profile.second .chargingSchedule .chargingSchedulePeriod [period]);
563- }
564552
565- // Check connector type
566- if (profile.first == 0 )
567- {
568- // Any connector profile, save stack level in case of a connector specific
569- // profile with the same stack level exists
570- level = profile.second .stackLevel ;
571- }
572- else
573- {
574- // Connector specific profile, stop search since it has highest priority
575- // over any connector profile
553+ // Highest applicable profile found
576554 break ;
577555 }
578556 }
@@ -598,7 +576,7 @@ bool SmartChargingManager::isProfileActive(Connector* c
598576
599577 // Check schedule validity
600578 if ((start_of_schedule <= time_point) &&
601- (!profile.chargingSchedule .duration .isSet () || ((start_of_schedule + profile.chargingSchedule .duration ) < = time_point)))
579+ (!profile.chargingSchedule .duration .isSet () || ((start_of_schedule + profile.chargingSchedule .duration ) > = time_point)))
602580 {
603581 // Look for the matching period
604582 const auto & schedule_periods = profile.chargingSchedule .chargingSchedulePeriod ;
0 commit comments