Skip to content

Commit

Permalink
Merge pull request #2153 from SCADA-LTS/fix/#2148_Fixed_tolerance_for…
Browse files Browse the repository at this point in the history
…_save_synchronized_mode

Fix/#2148 fixed tolerance for save synchronized mode
  • Loading branch information
Limraj authored Apr 1, 2022
2 parents 4534187 + a443ccf commit 9469652
Show file tree
Hide file tree
Showing 79 changed files with 37,188 additions and 604 deletions.
6 changes: 5 additions & 1 deletion WebContent/WEB-INF/jsp/systemSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,11 @@
<tr>
<td class="formLabelRequired"><fmt:message key="systemsettings.misc.dataPointRuntimeValueSynchronized"/></td>
<td class="formField">
<input id="<c:out value="<%= SystemSettingsDAO.DATAPOINT_RUNTIME_VALUE_SYNCHRONIZED %>"/>" type="checkbox" class="formShort"/>
<select id="<c:out value="<%= SystemSettingsDAO.DATAPOINT_RUNTIME_VALUE_SYNCHRONIZED %>"/>">
<option value="NONE"><fmt:message key="systemsettings.misc.dataPointRuntimeValueSynchronized.none"/></option>
<option value="PARTIAL"><fmt:message key="systemsettings.misc.dataPointRuntimeValueSynchronized.partial"/></option>
<option value="ALL"><fmt:message key="systemsettings.misc.dataPointRuntimeValueSynchronized.all"/></option>
</select>
</td>
</tr>
<tr>
Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,8 @@ test {
includeTestsMatching "org.scada_lts.dao.NewInstanceUserTest"
includeTestsMatching "org.scada_lts.dao.NewInstanceUsersProfileTest"
includeTestsMatching "br.org.scadabr.vo.EqualsHashcodePermissionTest"
includeTestsMatching "com.serotonin.mango.rt.dataImage.datapointrt.DataPointRtTestsSuite"
includeTestsMatching "com.serotonin.mango.rt.dataImage.DataPointSyncModeTest"
includeTestsMatching "com.serotonin.mango.rt.RuntimeManagerCreateDataPointRtTest"
}
}
12 changes: 12 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,18 @@
<test name="org.scada_lts.utils.UrlValidatorUtilsTest"
haltonfailure="yes">
</test>

<test name="com.serotonin.mango.rt.dataImage.datapointrt.DataPointRtTestsSuite"
haltonfailure="yes">
</test>

<test name="com.serotonin.mango.rt.dataImage.DataPointSyncModeTest"
haltonfailure="yes">
</test>

<test name="com.serotonin.mango.rt.RuntimeManagerCreateDataPointRtTest"
haltonfailure="yes">
</test>
</junit>
<record action="stop" name="${junit.log.name}"/>

Expand Down
5 changes: 4 additions & 1 deletion scadalts-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,5 +446,8 @@
"watchdog.response.unauthorized": "You do not have permission to this action!",
"watchdog.response.unavailable": "Watchdog server is unreachable!",
"watchdog.response.unexpected": "Scada server error occurred!",
"systemsettings.misc.dataPointRuntimeValueSynchronized": "Datapoint runtime value synchronized"
"systemsettings.misc.dataPointRuntimeValueSynchronized": "Duplicate values reduction",
"systemsettings.misc.dataPointRuntimeValueSynchronized.all": "All",
"systemsettings.misc.dataPointRuntimeValueSynchronized.partial": "Partial",
"systemsettings.misc.dataPointRuntimeValueSynchronized.none": "None"
}
13 changes: 9 additions & 4 deletions scadalts-ui/src/views/SystemSettings/MiscSettingsComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@
dense
></v-select>
</v-col>
<v-col cols="6">
<v-checkbox
<v-col cols="12">
<v-select
@change="watchDataChange()"
v-model="miscSettings.dataPointRuntimeValueSynchronized"
:items="dataPointRuntimeValueSynchronized"
item-value="value"
item-text="text"
:label="$t('systemsettings.misc.dataPointRuntimeValueSynchronized')"
dense
></v-checkbox>
></v-select>
</v-col>
</v-row>
</v-card-text>
Expand Down Expand Up @@ -142,7 +143,11 @@ export default {
status: false,
message: '',
},
dataPointRuntimeValueSynchronized: false,
dataPointRuntimeValueSynchronized: [
{ value: 'NONE', text: this.$t('systemsettings.misc.dataPointRuntimeValueSynchronized.none') },
{ value: 'PARTIAL', text: this.$t('systemsettings.misc.dataPointRuntimeValueSynchronized.partial') },
{ value: 'ALL', text: this.$t('systemsettings.misc.dataPointRuntimeValueSynchronized.all') },
]
};
},
Expand Down
4 changes: 3 additions & 1 deletion src/br/org/scadabr/rt/scripting/ContextualizedScriptRT.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import javax.script.ScriptException;

import com.serotonin.mango.rt.dataImage.PointValueTime;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mozilla.javascript.Context;
Expand Down Expand Up @@ -94,8 +95,9 @@ public void execute() throws ScriptException {
IDataPoint point = context.get(varName);
int dt = point.getDataTypeId();

PointValueTime currentValue = point.getPointValue();
LOG.debug("Var: " + varName + ", value: "
+ (point.getPointValue() == null ? "null" : point.getPointValue().toString()));
+ (currentValue == null ? "null" : currentValue.toString()));

if (dt == DataTypes.BINARY)
scope.put(varName, scope, new BinaryPointWrapper(point, wrapperContext));
Expand Down
7 changes: 5 additions & 2 deletions src/com/serotonin/mango/rt/RuntimeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,12 @@ private void startDataPoint(DataPointVO vo) {
}

public static DataPointRT createDataPointRT(DataPointVO vo) {
boolean dataPointRtSynchronized = new SystemSettingsService().isDataPointRtValueSynchronized();
if(dataPointRtSynchronized)
SystemSettingsService systemSettingsService = new SystemSettingsService();
DataPointSyncMode mode = systemSettingsService.getDataPointRtValueSynchronized();
if(mode == DataPointSyncMode.HIGH)
return new DataPointSynchronizedRT(vo, vo.getPointLocator().createRuntime());
if(mode == DataPointSyncMode.MEDIUM)
return new DataPointNonSyncRT(vo, vo.getPointLocator().createRuntime());
return new DataPointRT(vo, vo.getPointLocator().createRuntime());
}

Expand Down
Loading

0 comments on commit 9469652

Please sign in to comment.