Skip to content

Commit

Permalink
Adds missing files from previous commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
HOehmen committed Feb 10, 2021
1 parent b031635 commit a803f1f
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/test/java/org/jreliability/testsystems/BridgeSystemTest.java
@@ -0,0 +1,54 @@
/*******************************************************************************
* JReliability is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* JReliability is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JReliability. If not, see http://www.gnu.org/licenses/.
*******************************************************************************/

package org.jreliability.testsystems;

import static org.junit.Assert.*;

import org.jreliability.function.ReliabilityFunction;
import org.jreliability.function.common.ExponentialReliabilityFunction;
import org.junit.Test;

public class BridgeSystemTest {
final double TEST_DELTA = 0.000001;

@Test
public void testBridgeSystem() {

ReliabilityFunction rel1 = new ExponentialReliabilityFunction(0.1);
ReliabilityFunction rel2 = new ExponentialReliabilityFunction(0.2);
ReliabilityFunction rel3 = new ExponentialReliabilityFunction(0.3);
ReliabilityFunction rel4 = new ExponentialReliabilityFunction(0.4);
ReliabilityFunction rel5 = new ExponentialReliabilityFunction(0.5);

BridgeSystem testSystem = new BridgeSystem(rel1, rel2, rel3, rel4, rel5);

ReliabilityFunction systemReliability = testSystem.get();

System.out.println(systemReliability.getY(0.1));
System.out.println(systemReliability.getY(0.3));
System.out.println(systemReliability.getY(0.9));
System.out.println(systemReliability.getY(2.7));
System.out.println(systemReliability.getY(8));
System.out.println(systemReliability.getY(25));

assertEquals(0.99897497, systemReliability.getY(0.1), TEST_DELTA);
assertEquals(0.99055298, systemReliability.getY(0.3), TEST_DELTA);
assertEquals(0.91912372, systemReliability.getY(0.9), TEST_DELTA);
assertEquals(0.55972244, systemReliability.getY(2.7), TEST_DELTA);
assertEquals(0.09472739, systemReliability.getY(8), TEST_DELTA);
assertEquals(0.00055310, systemReliability.getY(25), TEST_DELTA);
}
}
@@ -0,0 +1,45 @@
/*******************************************************************************
* JReliability is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* JReliability is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JReliability. If not, see http://www.gnu.org/licenses/.
*******************************************************************************/

package org.jreliability.testsystems;

import static org.junit.Assert.*;

import org.jreliability.function.ReliabilityFunction;
import org.jreliability.function.common.ExponentialReliabilityFunction;
import org.junit.Test;

public class SeriesParallelSystemTest {
final double TEST_DELTA = 0.000001;

@Test
public void testSeriesParallelSystem() {

ReliabilityFunction rel1 = new ExponentialReliabilityFunction(0.1);
ReliabilityFunction rel2 = new ExponentialReliabilityFunction(0.2);
ReliabilityFunction rel3 = new ExponentialReliabilityFunction(0.3);

SeriesParallelSystem testSystem = new SeriesParallelSystem(rel1, rel2, rel3);

ReliabilityFunction systemReliability = testSystem.get();

assertEquals(0.97025433, systemReliability.getY(0.1), TEST_DELTA);
assertEquals(0.91235820, systemReliability.getY(0.3), TEST_DELTA);
assertEquals(0.75255622, systemReliability.getY(0.9), TEST_DELTA);
assertEquals(0.40093708, systemReliability.getY(2.7), TEST_DELTA);
assertEquals(0.05084809, systemReliability.getY(8), TEST_DELTA);
assertEquals(0.00004882, systemReliability.getY(25), TEST_DELTA);
}
}
39 changes: 39 additions & 0 deletions src/test/java/org/jreliability/testsystems/TC_NC_SystemTest.java
@@ -0,0 +1,39 @@
/*******************************************************************************
* JReliability is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* JReliability is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JReliability. If not, see http://www.gnu.org/licenses/.
*******************************************************************************/

package org.jreliability.testsystems;

import static org.junit.Assert.*;

import org.jreliability.function.ReliabilityFunction;
import org.junit.Test;

public class TC_NC_SystemTest {
final double TEST_DELTA = 0.000001;

@Test
public void testTC_NC_System() {
TC_NC_System testSystem = new TC_NC_System();

ReliabilityFunction systemReliability = testSystem.get();

assertEquals(0.99800498, systemReliability.getY(0.1), TEST_DELTA);
assertEquals(0.98239756, systemReliability.getY(0.9), TEST_DELTA);
assertEquals(0.86728735, systemReliability.getY(8), TEST_DELTA);
assertEquals(0.69742613, systemReliability.getY(25), TEST_DELTA);
assertEquals(0.35630174, systemReliability.getY(100), TEST_DELTA);
assertEquals(0.04978123, systemReliability.getY(300), TEST_DELTA);
}
}
39 changes: 39 additions & 0 deletions src/test/java/org/jreliability/testsystems/TI_NC_SystemTest.java
@@ -0,0 +1,39 @@
/*******************************************************************************
* JReliability is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* JReliability is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JReliability. If not, see http://www.gnu.org/licenses/.
*******************************************************************************/

package org.jreliability.testsystems;

import static org.junit.Assert.*;

import org.jreliability.function.ReliabilityFunction;
import org.junit.Test;

public class TI_NC_SystemTest {
final double TEST_DELTA = 0.000001;

@Test
public void testTI_NC_System() {
TI_NC_System testSystem = new TI_NC_System();

ReliabilityFunction systemReliability = testSystem.get();

assertEquals(0.99601972, systemReliability.getY(0.1), TEST_DELTA);
assertEquals(0.96543420, systemReliability.getY(0.9), TEST_DELTA);
assertEquals(0.73542404, systemReliability.getY(8), TEST_DELTA);
assertEquals(0.33379704, systemReliability.getY(25), TEST_DELTA);
assertEquals(0.00731465, systemReliability.getY(100), TEST_DELTA);
assertEquals(0.00000374, systemReliability.getY(250), TEST_DELTA);
}
}
44 changes: 44 additions & 0 deletions src/test/java/org/jreliability/testsystems/TMRTest.java
@@ -0,0 +1,44 @@
/*******************************************************************************
* JReliability is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* JReliability is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JReliability. If not, see http://www.gnu.org/licenses/.
*******************************************************************************/

package org.jreliability.testsystems;

import static org.junit.Assert.*;

import org.jreliability.function.ReliabilityFunction;
import org.jreliability.function.common.ExponentialReliabilityFunction;
import org.junit.Test;

public class TMRTest {
final double TEST_DELTA = 0.000001;

@Test
public void testTMR() {
ReliabilityFunction rel1 = new ExponentialReliabilityFunction(0.1);
ReliabilityFunction rel2 = new ExponentialReliabilityFunction(0.2);
ReliabilityFunction rel3 = new ExponentialReliabilityFunction(0.3);

TMR testSystem = new TMR(rel1, rel2, rel3);

ReliabilityFunction systemReliability = testSystem.get();

assertEquals(0.99893533, systemReliability.getY(0.1), TEST_DELTA);
assertEquals(0.99101917, systemReliability.getY(0.3), TEST_DELTA);
assertEquals(0.93318746, systemReliability.getY(0.9), TEST_DELTA);
assertEquals(0.64789645, systemReliability.getY(2.7), TEST_DELTA);
assertEquals(0.13333630, systemReliability.getY(8), TEST_DELTA);
assertEquals(0.00060159, systemReliability.getY(25), TEST_DELTA);
}
}

0 comments on commit a803f1f

Please sign in to comment.