Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(104): added descriptions to control ti numbers #1400

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export function getSignalName(tiNumber: string): string {
return get('protocol104.values.signalNames.tiNumber50');
case '51':
return get('protocol104.values.signalNames.tiNumber51');
case '58':
return get('protocol104.values.signalNames.tiNumber58');
case '59':
return get('protocol104.values.signalNames.tiNumber59');
case '60':
return get('protocol104.values.signalNames.tiNumber60');
case '61':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export function createAddressesAction(
const ctlModel = getCtlModel(lnElement, doElement);
if (ctlModel !== null && ctlModel !== 'status-only') {
const selectedControlTi =
getValue(inputs.find(i => i.label === 'controlTi')!) ?? '';
getValue(inputs.find(i => i.label === 'controlTi')!)?.split(
' ('
)[0] ?? '';
const controlInverted = getSwitchValue(wizard, 'controlInverted');

const tiInformation = cdcProcessing.control[selectedControlTi];
Expand Down Expand Up @@ -336,7 +338,12 @@ export function createAddressesWizard(
${controlTis.map(
controlTi =>
html` <mwc-list-item value="${controlTi}">
<span>${controlTi}</span>
<span
>${controlTi +
' (' +
getSignalName(controlTi) +
')'}</span
>
</mwc-list-item>`
)}
</wizard-select>`
Expand All @@ -345,7 +352,9 @@ export function createAddressesWizard(
fields.push(
html` <wizard-textfield
label="controlTi"
.maybeValue=${controlTis[0] ? controlTis[0] : ''}
.maybeValue=${controlTis[0]
? controlTis[0] + ' (' + getSignalName(controlTis[0]) + ')'
: ''}
disabled
>
</wizard-textfield>`
Expand Down
2 changes: 2 additions & 0 deletions packages/open-scd/src/translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ export const de: Translations = {
tiNumber49: 'Sollwertbefehl, skalierte Wert',
tiNumber50: 'Sollwertbefehl, Kurz-Gleitkommazahl',
tiNumber51: 'Bit string von 32 Bit Befehl',
tiNumber58: 'Einzelbefehl mit Zeitstempel CP56Time2a',
tiNumber59: 'Doppelbefehl mit Zeitstempel CP56Time2a',
tiNumber60: 'Regelungsschritt-Befehl mit Zeitstempel CP56Time2a',
tiNumber61:
'Gemessener Wert, normalisierter Wert Befehl mit Zeitstempel CP56Time2a',
Expand Down
2 changes: 2 additions & 0 deletions packages/open-scd/src/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ export const en = {
tiNumber49: 'Set-point Command, scaled value',
tiNumber50: 'Set-point Command, short floating point number',
tiNumber51: 'Bit string 32 bit command',
tiNumber58: 'Single command with time tag CP56Time2a',
tiNumber59: 'Double command with time tag CP56Time2a',
tiNumber60: 'Regulating step command with time tag CP56Time2a',
tiNumber61:
'Measured value, normalized value command with time tag CP56Time2a',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {

import { fetchDoc } from '../../../wizards/test-support.js';
import { Switch } from '@material/mwc-switch';
import { WizardSelect } from '../../../../../src/wizard-select.js';
import { WizardTextField } from '../../../../../src/wizard-textfield.js';

describe('Wizards for preparing 104 Address Creation', () => {
let doc: XMLDocument;
Expand Down Expand Up @@ -143,6 +145,9 @@ describe('Wizards for preparing 104 Address Creation', () => {
});

describe('show prepare 104 Address creation (single monitor TI and single control TI with CtlModel)', () => {
const newMonitorTiValue = '30';
const newControlTiValue = '58';

beforeEach(async () => {
await prepareWizard(
'IED[name="B1"] LN[lnType="SE_GGIO_SET_V002"]',
Expand All @@ -151,6 +156,9 @@ describe('Wizards for preparing 104 Address Creation', () => {
});

it('when processing the request without Check Selected, the expected Create Actions are returned', () => {
inputs[3].value = newMonitorTiValue;
inputs[5].value = newControlTiValue;

const actions = createAddressesAction(
lnElement,
doElement,
Expand All @@ -160,6 +168,28 @@ describe('Wizards for preparing 104 Address Creation', () => {
expectCreateActions(actions, 2);
});

it('TIs contain descriptions', async () => {
const monitorTi = element.wizardUI.dialog!.querySelector(
'wizard-textfield[label="monitorTi"]'
) as WizardTextField;
expect(monitorTi).to.exist;

const controlTi = element.wizardUI.dialog!.querySelector(
`wizard-textfield[label="controlTi"]`
) as WizardTextField;
expect(controlTi).to.exist;

const monitorTiValue = monitorTi.value;
const controlTiValue = controlTi.value;

expect(monitorTiValue).to.equal(
`${newMonitorTiValue} ([protocol104.values.signalNames.tiNumber${newMonitorTiValue}])`
);
expect(controlTiValue).to.equal(
`${newControlTiValue} ([protocol104.values.signalNames.tiNumber${newControlTiValue}])`
);
});

it('when processing the request with Check Selected, the expected Create Actions are returned', async () => {
const switchElement = element.wizardUI.dialog!.querySelector<Switch>(
`mwc-switch[id="controlCheck"]`
Expand Down
Loading